Skip to content

Commit

Permalink
have arm not move while driving, brake mode on drivetrain
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacThoman committed Sep 22, 2023
1 parent 3f20862 commit b8f8c99
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Gradle build
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
gradle:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Set gradlew executable
run: chmod +x ./gradlew

- name: Execute Gradle build
run: ./gradlew build
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public RobotContainer() {
// Configure the trigger bindings
configureBindings();

grabberSub.setDefaultCommand(new RunCommand(()-> grabberSub.joystickDrive(xboxController.getLeftY(),xboxController.getRightY()), grabberSub));
grabberSub.setDefaultCommand(new RunCommand(()-> grabberSub.joystickDrive(xboxController.getLeftY(),xboxController.getRightY(), xboxController.getLeftBumper()), grabberSub));
efSub.setDefaultCommand(new RunCommand(()->efSub.driveThing(xboxController.getLeftTriggerAxis() - xboxController.getRightTriggerAxis()),efSub));
swerveSubsystem.setDefaultCommand(new RunCommand(()->swerveSubsystem.joystickDrive(0,0,0),swerveSubsystem));
}
Expand All @@ -59,7 +59,7 @@ public RobotContainer() {
* joysticks}.
*/
private void configureBindings() {
new JoystickButton(xboxController, XboxController.Button.kA.value).whileTrue(new RunCommand(()->grabberSub.joystickDrive(operator1.getY()*0.5,operator2.getY()*0.5),grabberSub));
new JoystickButton(xboxController, XboxController.Button.kA.value).whileTrue(new RunCommand(()->grabberSub.joystickDrive(operator1.getY()*0.5,operator2.getY()*0.5, xboxController.getLeftBumper()),grabberSub));
new JoystickButton(xboxController,XboxController.Button.kB.value).whileTrue(new InstantCommand(()->grabberSub.goHome()));

new JoystickButton(xboxController,XboxController.Button.kLeftBumper.value).whileTrue(new RunCommand(()->swerveSubsystem.joystickDrive(xboxController.getLeftY()*-1, xboxController.getLeftX()*-1, xboxController.getRightX()*-1),swerveSubsystem));
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/subsystems/GrabberSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ public double[] thetaPhiToXYMeters(double stageOneAng, double stageTwoAng){
}
double lastControllerUpdateTime = Timer.getFPGATimestamp();

public void joystickDrive(double stageOneSpeed, double stageTwoSpeed){
public void joystickDrive(double stageOneSpeed, double stageTwoSpeed, boolean disabled){
if(disabled){
stageOneSpeed = 0;
stageTwoSpeed = 0;
}
double timeSinceLastUpdate = Timer.getFPGATimestamp() - lastControllerUpdateTime;
if(Math.abs(stageOneSpeed)<0.05) stageOneSpeed = 0;
if(Math.abs(stageTwoSpeed)<0.05) stageTwoSpeed = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/drive/SwerveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public SwerveModule(int driveMotorId, int turningMotorId, boolean driveMotorReve
driveMotor.setStatusFramePeriod(StatusFrameEnhanced.Status_Brushless_Current, 251, 1000);

// driveMotor.configAllSettings(Robot.ctreConfigs.swerveDriveMotor, 1000);
driveMotor.setNeutralMode(NeutralMode.Coast);
driveMotor.setNeutralMode(NeutralMode.Brake);
driveMotor.setInverted(driveMotorReversed);
//debug output: driveMotor.config_kF(0, 0);
//debug output: driveMotor.config_kP(0, 0);
Expand Down

0 comments on commit b8f8c99

Please sign in to comment.