diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java index d876be7d88..91ab37b771 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleMecanumDrive.java @@ -298,7 +298,12 @@ public Double getExternalHeadingVelocity() { // Rotate about the z axis is the default assuming your REV Hub/Control Hub is laying // flat on a surface - return (double) imu.getAngularVelocity().zRotationRate; + // To work around an SDK bug, use -zRotationRate in place of xRotationRate + // and -xRotationRate in place of zRotationRate (yRotationRate behaves as + // expected). This bug does NOT affect orientation. + // + // See https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/251 for details. + return (double) -imu.getAngularVelocity().xRotationRate; } public static TrajectoryVelocityConstraint getVelocityConstraint(double maxVel, double maxAngularVel, double trackWidth) { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleTankDrive.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleTankDrive.java index fcecc2fde5..ed0e1a6c9f 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleTankDrive.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/drive/SampleTankDrive.java @@ -302,7 +302,12 @@ public Double getExternalHeadingVelocity() { // Rotate about the z axis is the default assuming your REV Hub/Control Hub is laying // flat on a surface - return (double) imu.getAngularVelocity().zRotationRate; + // To work around an SDK bug, use -zRotationRate in place of xRotationRate + // and -xRotationRate in place of zRotationRate (yRotationRate behaves as + // expected). This bug does NOT affect orientation. + // + // See https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/251 for details. + return (double) -imu.getAngularVelocity().xRotationRate; } public static TrajectoryVelocityConstraint getVelocityConstraint(double maxVel, double maxAngularVel, double trackWidth) {