mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Correct Mecanum example axes (#3955)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user