Skip to content

Commit

Permalink
Task 1 Completion
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulSurvivorP1 committed Oct 17, 2024
1 parent c810b1a commit bbb970f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,25 @@ has a wheel placement diameter (163 mm) - width of the wheel (8 mm) = 155 mm

//TODO: Task 1-Rewrite TurnDegrees as a function that returns a functional command
//Code here:
public static Command TurnDegrees(double speed, double degrees){
return new FunctionalCommand(
() -> {
RobotContainer.m_xrpDrivetrain.arcadeDrive(0, 0);
RobotContainer.m_xrpDrivetrain.resetEncoders();
},

() -> RobotContainer.m_xrpDrivetrain.arcadeDrive(0, speed),

interrupted -> RobotContainer.m_xrpDrivetrain.arcadeDrive(0, 0),

() -> {
double inchPerDegree = Math.PI * 6.102 / 360;
return RobotContainer.m_xrpDrivetrain.getAverageTurningDistance() >= (inchPerDegree * degrees);
},

RobotContainer.m_xrpDrivetrain
);
}
//TODO: Task 3-Rewrite the following functions to use tank drive
//driveDistance or AltDriveDistance(choose 1)
//arcadeDriveCommand(rename as tankDriveCommand)
Expand Down

0 comments on commit bbb970f

Please sign in to comment.