Skip to content

Commit

Permalink
Adjust the IMU angular velocity axes (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunerwalker2 committed Dec 9, 2021
1 parent 6a2a086 commit 056b1d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 056b1d9

Please sign in to comment.