[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:
Tyler Veness
2022-10-27 21:59:11 -07:00
committed by GitHub
parent 9e22ffbebf
commit 66157397c1
24 changed files with 264 additions and 1463 deletions

View File

@@ -29,7 +29,7 @@ class Robot : public frc::TimedRobot {
*/
void TeleopPeriodic() override {
m_robotDrive.DriveCartesian(-m_joystick.GetY(), m_joystick.GetX(),
m_joystick.GetZ(), m_gyro.GetAngle());
m_joystick.GetZ(), m_gyro.GetRotation2d());
}
private:

View File

@@ -50,7 +50,7 @@ void DriveSubsystem::Periodic() {
void DriveSubsystem::Drive(double xSpeed, double ySpeed, double rot,
bool 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);
}

View File

@@ -21,7 +21,7 @@ class Robot : public frc::TimedRobot {
}
void TeleopPeriodic() override {
/* 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(),