TankDrive + auto example

This commit is contained in:
Bradley Bickford 2025-10-16 15:57:55 -04:00
parent 34388d6364
commit c862234c3e
2 changed files with 12 additions and 1 deletions

View File

@ -29,6 +29,11 @@ public class RobotContainer {
}
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
return drivetrain.tankDrive(() -> .5, () -> .5)
.withTimeout(2.5)
.andThen(
drivetrain.tankDrive(() -> -.4, () -> .4).withTimeout(1),
drivetrain.tankDrive(() -> .5, () -> .5).withTimeout(1.5)
);
}
}

View File

@ -37,4 +37,10 @@ public class Drivetrain extends SubsystemBase {
dt.arcadeDrive(forwardBackward.getAsDouble(), leftRight.getAsDouble());
});
}
public Command tankDrive(DoubleSupplier leftSpeed, DoubleSupplier rightSpeed) {
return run(() -> {
dt.tankDrive(leftSpeed.getAsDouble(), rightSpeed.getAsDouble());
});
}
}