Skip to content

Commit

Permalink
some stuff with kavin
Browse files Browse the repository at this point in the history
  • Loading branch information
InfinityJuice committed Oct 12, 2024
1 parent 723fb1f commit ec1caf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public Command getAutonomousCommand() {
RobotContainer.m_xrpDrivetrain, RobotContainer.m_rangefinder
);
*/

return new SequentialCommandGroup(
DriveCommands.tankDriveBackwards(2),
ServoCommands.servoPresetCommand(1),
Expand All @@ -91,5 +92,11 @@ public Command getAutonomousCommand() {
ServoCommands.servoSetAngleCommand(0)
)
);
//return DriveCommands.tankDriveDistance(5);
/*return new SequentialCommandGroup(
DriveCommands.tankDriveDistance(5),
DriveCommands.tankTurnDegrees(0.5, 50)
);
*/
}
}
10 changes: 6 additions & 4 deletions src/main/java/frc/robot/commands/DriveCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,15 @@ public static Command tankDriveCommand(Supplier<Double> left_speed, Supplier<Dou
public static Command tankTurnDegrees(double speed, double degrees){
final XRPDrivetrain m_drive = RobotContainer.m_xrpDrivetrain;
final double m_speed=speed;
/*
if (degrees<0) {
final double m_degrees=360*Math.abs(degrees);
final double m_degrees=360-Math.abs(degrees);
} else {
final double m_degrees=degrees;
}
*/
//im count 90 degrees as 90 degrees counterclockwise, 270 degrees as 270 degrees ccw aka 90 cw, so on
final double m_degrees=degrees%360;
final double m_degrees=degrees;
return new FunctionalCommand(
() -> {
m_drive.tankDrive(0, 0);
Expand All @@ -277,11 +279,11 @@ public static Command tankTurnDegrees(double speed, double degrees){
() -> {
if (m_degrees>180) {
//turn right
m_drive.tankDrive(m_speed, 0);
m_drive.tankDrive(m_speed, -m_speed);
}
if (m_degrees<=180) {
//turn left
m_drive.tankDrive(0,m_speed);
m_drive.tankDrive(-m_speed,m_speed);
}
},
interrupted -> m_drive.tankDrive(0, 0),
Expand Down

0 comments on commit ec1caf5

Please sign in to comment.