Skip to content

Commit

Permalink
Arcade drive tutorial code
Browse files Browse the repository at this point in the history
  • Loading branch information
rcahoon committed Feb 9, 2024
1 parent 45b0b05 commit 5f3b656
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/team766/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void run(final Context context) {

// Add driver controls here - make sure to take/release ownership
// of mechanisms when appropriate.
Robot.drive.setDrivePower(joystick0.getAxis(1), joystick1.getAxis(1));
Robot.drive.setArcadeDrivePower(joystick0.getAxis(1), joystick0.getAxis(0));
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/com/team766/robot/mechanisms/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ public void setDrivePower(double leftPower, double rightPower) {
leftMotor.set(leftPower);
rightMotor.set(rightPower);
}

public void setArcadeDrivePower(double forward, double turn) {
double leftMotorPower = turn + forward;
double rightMotorPower = -turn + forward;
setDrivePower(leftMotorPower, rightMotorPower);
}
}

0 comments on commit 5f3b656

Please sign in to comment.