Skip to content

Commit

Permalink
made robot drive
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavsial committed Nov 7, 2024
1 parent e4161c8 commit 245cc2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/team766/robot/rookie_bot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ public OI() {
joystick2 = RobotProvider.instance.getJoystick(2);
}



public void run(final Context context) {
while (true) {
// wait for driver station data (and refresh it using the WPILib APIs)
context.waitFor(() -> RobotProvider.instance.hasNewDriverStationData());
RobotProvider.instance.refreshDriverStationData();

Robot.drive.setArcadeDrivePower(joystick0.getAxis(1), joystick0.getAxis(4));

// Add driver controls here - make sure to take/release ownership
// of mechanisms when appropriate.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,13 @@ public void drive(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;
drive(leftMotorPower, rightMotorPower);



}
}

0 comments on commit 245cc2e

Please sign in to comment.