[examples] Fix drive Joystick axes in several examples (#3769)

This commit is contained in:
Jason Daming
2021-12-06 18:40:10 -06:00
committed by GitHub
parent 8ee6257e92
commit 1ac02d2f58
3 changed files with 8 additions and 7 deletions

View File

@@ -30,12 +30,14 @@ RobotContainer::RobotContainer() {
ConfigureButtonBindings();
// Set up default drive command
// The left stick controls translation of the robot.
// Turning is controlled by the X axis of the right stick.
m_drive.SetDefaultCommand(frc2::RunCommand(
[this] {
m_drive.Drive(
units::meters_per_second_t(m_driverController.GetLeftY()),
units::meters_per_second_t(m_driverController.GetRightY()),
units::radians_per_second_t(m_driverController.GetLeftX()), false);
units::meters_per_second_t(m_driverController.GetLeftX()),
units::radians_per_second_t(m_driverController.GetRightX()), false);
},
{&m_drive}));
}

View File

@@ -50,7 +50,7 @@ public class RobotContainer {
new RunCommand(
() ->
m_robotDrive.arcadeDrive(
-m_driverController.getRightY(), m_driverController.getLeftX()),
-m_driverController.getLeftY(), m_driverController.getRightX()),
m_robotDrive));
}

View File

@@ -42,16 +42,15 @@ public class RobotContainer {
configureButtonBindings();
// Configure default commands
// Set the default drive command to split-stick arcade drive
m_robotDrive.setDefaultCommand(
// A split-stick arcade command, with forward/backward controlled by the left
// hand, and turning controlled by the right.
// The left stick controls translation of the robot.
// Turning is controlled by the X axis of the right stick.
new RunCommand(
() ->
m_robotDrive.drive(
m_driverController.getLeftY(),
m_driverController.getRightX(),
m_driverController.getLeftX(),
m_driverController.getRightX(),
false),
m_robotDrive));
}