Closed
Description
It looks like imu.getRobotAngularVelocity always returns the zRotationRate (and presumably the other axes rates) in degrees regardless of the AngleUnit provided to the method. Consider the following code example:
while (opModeIsActive()) {
driveRobotBasedOnGamepadInput();
AngularVelocity avd = imu.getRobotAngularVelocity(AngleUnit.DEGREES);
AngularVelocity avr = imu.getRobotAngularVelocity(AngleUnit.RADIANS);
telemetry.addData("z ang vel (d)", "%4.2f", avd.zRotationRate);
telemetry.addData("z ang vel (r)", "%4.2f", avr.zRotationRate);
telemetry.update();
}
When I run this on a mecanum strafer robot, and rotate the robot left/right, the values printed for both the degrees and radians match and appear to be in degrees.
There appears to be a workaround, which is to use Math.toRadians(imu.getRobotAngularVelocity(AngleUnit.DEGREES).zRotationRate), but several libraries (including RoadRunner) use radians and would need to be updated with this workaround to operate correctly.
Metadata
Metadata
Assignees
Labels
No labels