mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Make drive classes follow NWU axes convention (#4079)
All trigonometric functions and vector classes assume North-West-Up axes convention, so using North-East-Down convention with them is really error-prone. We've broken something every time we touched the drive classes. We originally used North-East-Down to match the joystick convention, but the volume of long-lived bugs has made this not worth it in retrospect. The rest of WPILib also uses North-West-Up, so this makes things consistent. KilloughDrive was removed since no one uses it.
This commit is contained in:
@@ -51,6 +51,6 @@ public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
m_robotDrive.driveCartesian(
|
||||
-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ(), m_gyro.getAngle());
|
||||
-m_joystick.getY(), m_joystick.getX(), m_joystick.getZ(), m_gyro.getRotation2d());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class DriveSubsystem extends SubsystemBase {
|
||||
*/
|
||||
public void drive(double xSpeed, double ySpeed, double rot, boolean fieldRelative) {
|
||||
if (fieldRelative) {
|
||||
m_drive.driveCartesian(ySpeed, xSpeed, rot, -m_gyro.getAngle());
|
||||
m_drive.driveCartesian(ySpeed, xSpeed, rot, m_gyro.getRotation2d());
|
||||
} else {
|
||||
m_drive.driveCartesian(ySpeed, xSpeed, rot);
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public class Robot extends TimedRobot {
|
||||
|
||||
@Override
|
||||
public void teleopPeriodic() {
|
||||
// Use the joystick X axis for lateral movement, Y axis for forward
|
||||
// Use the joystick X axis for forward movement, Y axis for lateral
|
||||
// movement, and Z axis for rotation.
|
||||
m_robotDrive.driveCartesian(-m_stick.getY(), m_stick.getX(), m_stick.getZ(), 0.0);
|
||||
m_robotDrive.driveCartesian(-m_stick.getY(), m_stick.getX(), m_stick.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user