Skip to content

Commit

Permalink
fix: corrected the angular velocity axes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunerwalker2 committed Dec 9, 2021
1 parent 1a52698 commit 5143277
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,20 @@ 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;
/*TODO: IMPORTANT!
If you are using the X axis from the above diagram,
ensure that you use the negative Z axis for angular velocity ONLY.
Likewise, if you are using the Z axis from above, ensure that you use the
negative X axis for angular velocity ONLY (this does NOT affect orientation).
//For angular velocity around the X axis:
return (double) -imu.getAngularVelocity().zRotationRate;
The Y axis is not affected.
*/

//See comment above, following is for angular velocity around the Z axis
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,20 @@ 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;
/*TODO: IMPORTANT!
If you are using the X axis from the above diagram,
ensure that you use the negative Z axis for angular velocity ONLY.
Likewise, if you are using the Z axis from above, ensure that you use the
negative X axis for angular velocity ONLY (this does NOT affect orientation).
//For angular velocity around the X axis:
return (double) -imu.getAngularVelocity().zRotationRate;
The Y axis is not affected.
*/

//See comment above, following is for angular velocity around the Z axis
return (double) -imu.getAngularVelocity().xRotationRate;
}

public static TrajectoryVelocityConstraint getVelocityConstraint(double maxVel, double maxAngularVel, double trackWidth) {
Expand Down

0 comments on commit 5143277

Please sign in to comment.