joystick -> manettes
This commit is contained in:
parent
cf29380c64
commit
de156e3789
@ -38,7 +38,8 @@ public class RobotContainer {
|
|||||||
|
|
||||||
private final Telemetry logger = new Telemetry(MaxSpeed);
|
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();
|
public final CommandSwerveDrivetrain drivetrain = TunerConstants.createDrivetrain();
|
||||||
|
|
||||||
@ -58,21 +59,21 @@ public class RobotContainer {
|
|||||||
drivetrain.setDefaultCommand(
|
drivetrain.setDefaultCommand(
|
||||||
// Drivetrain will execute this command periodically
|
// Drivetrain will execute this command periodically
|
||||||
drivetrain.applyRequest(() ->
|
drivetrain.applyRequest(() ->
|
||||||
drive.withVelocityX(-joystick.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward)
|
drive.withVelocityX(-manette1.getLeftY() * MaxSpeed) // Drive forward with negative Y (forward)
|
||||||
.withVelocityY(-joystick.getLeftX() * MaxSpeed) // Drive left with negative X (left)
|
.withVelocityY(-manette1.getLeftX() * MaxSpeed) // Drive left with negative X (left)
|
||||||
.withRotationalRate(-joystick.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left)
|
.withRotationalRate(-manette1.getRightX() * MaxAngularRate) // Drive counterclockwise with negative X (left)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Run SysId routines when holding back/start and X/Y.
|
// Run SysId routines when holding back/start and X/Y.
|
||||||
// Note that each routine should be run exactly once in a single log.
|
// Note that each routine should be run exactly once in a single log.
|
||||||
joystick.back().and(joystick.y()).whileTrue(drivetrain.sysIdDynamic(Direction.kForward));
|
manette1.back().and(manette1.y()).whileTrue(drivetrain.sysIdDynamic(Direction.kForward));
|
||||||
joystick.back().and(joystick.x()).whileTrue(drivetrain.sysIdDynamic(Direction.kReverse));
|
manette1.back().and(manette1.x()).whileTrue(drivetrain.sysIdDynamic(Direction.kReverse));
|
||||||
joystick.start().and(joystick.y()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kForward));
|
manette1.start().and(manette1.y()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kForward));
|
||||||
joystick.start().and(joystick.x()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kReverse));
|
manette1.start().and(manette1.x()).whileTrue(drivetrain.sysIdQuasistatic(Direction.kReverse));
|
||||||
|
|
||||||
// reset the field-centric heading on left bumper press
|
// 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);
|
drivetrain.registerTelemetry(logger::telemeterize);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user