mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[examples] Fix drive Joystick axes in several examples (#3769)
This commit is contained in:
@@ -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}));
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user