joystick -> manettes

This commit is contained in:
samuel desharnais 2025-02-06 17:59:57 -05:00
parent cf29380c64
commit de156e3789

View File

@ -38,7 +38,8 @@ public class RobotContainer {
private final Telemetry logger = new Telemetry(MaxSpeed);
private final CommandXboxController joystick = new CommandXboxController(0);
private final CommandXboxController manette1 = new CommandXboxController(0);
private final CommandXboxController manette2 = new CommandXboxController(0);
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
@ -58,21 +59,21 @@ public class RobotContainer {
drivetrain.setDefaultCommand(
// Drivetrain will execute this command periodically
drivetrain.applyRequest(() ->
drive.withVelocityX(-joystick.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward)
.withVelocityY(-joystick.getLeftX() * MaxSpeed) // Drive left with negative X (left)
.withRotationalRate(-joystick.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left)
drive.withVelocityX(-manette1.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward)
.withVelocityY(-manette1.getLeftX() * MaxSpeed) // Drive left with negative X (left)
.withRotationalRate(-manette1.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left)
)
);
// Run SysId routines when holding back/start and X/Y.
// Note that each routine should be run exactly once in a single log.
joystick.back().and(joystick.y()).whileTrue(drivetrain.sysIdDynamic(Direction.kForward));
joystick.back().and(joystick.x()).whileTrue(drivetrain.sysIdDynamic(Direction.kReverse));
joystick.start().and(joystick.y()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kForward));
joystick.start().and(joystick.x()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kReverse));
manette1.back().and(manette1.y()).whileTrue(drivetrain.sysIdDynamic(Direction.kForward));
manette1.back().and(manette1.x()).whileTrue(drivetrain.sysIdDynamic(Direction.kReverse));
manette1.start().and(manette1.y()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kForward));
manette1.start().and(manette1.x()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kReverse));
// reset the field-centric heading on left bumper press
joystick.leftBumper().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric()));
manette1.leftBumper().onTrue(drivetrain.runOnce(() -> drivetrain.seedFieldCentric()));
drivetrain.registerTelemetry(logger::telemeterize);
}