[examples] Correct Mecanum example axes (#3955)

This commit is contained in:
sciencewhiz
2022-01-27 21:57:41 -07:00
committed by GitHub
parent 7ea1be9c01
commit 560094ad92
4 changed files with 9 additions and 8 deletions

View File

@@ -11,8 +11,8 @@ import edu.wpi.first.wpilibj.drive.MecanumDrive;
import edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax;
/**
* This is a sample program that uses mecanum drive with a gyro sensor to maintain rotation
* vectorsin relation to the starting orientation of the robot (field-oriented controls).
* This is a sample program that uses mecanum drive with a gyro sensor to maintain rotation vectors
* in relation to the starting orientation of the robot (field-oriented controls).
*/
public class Robot extends TimedRobot {
// gyro calibration constant, may need to be adjusted;
@@ -51,6 +51,6 @@ public class Robot extends TimedRobot {
@Override
public void teleopPeriodic() {
m_robotDrive.driveCartesian(
m_joystick.getX(), m_joystick.getY(), m_joystick.getZ(), m_gyro.getAngle());
-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ(), m_gyro.getAngle());
}
}

View File

@@ -42,6 +42,6 @@ public class Robot extends TimedRobot {
public void teleopPeriodic() {
// Use the joystick X axis for lateral movement, Y axis for forward
// movement, and Z axis for rotation.
m_robotDrive.driveCartesian(m_stick.getX(), m_stick.getY(), m_stick.getZ(), 0.0);
m_robotDrive.driveCartesian(-m_stick.getY(), m_stick.getX(), m_stick.getZ(), 0.0);
}
}