Skip to content

Commit

Permalink
Fix angular velocity
Browse files Browse the repository at this point in the history
Add workaround for FIRST-Tech-Challenge#1070
  • Loading branch information
rbrott committed Sep 19, 2024
1 parent a05fae8 commit dab1d63
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.AngularVelocity;
import org.firstinspires.ftc.robotcore.external.navigation.UnnormalizedAngleUnit;
import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles;
import org.firstinspires.ftc.teamcode.messages.TwoDeadWheelInputsMessage;

Expand Down Expand Up @@ -64,7 +65,15 @@ public Twist2dDual<Time> update() {
PositionVelocityPair perpPosVel = perp.getPositionAndVelocity();

YawPitchRollAngles angles = imu.getRobotYawPitchRollAngles();
AngularVelocity angularVelocity = imu.getRobotAngularVelocity(AngleUnit.RADIANS);
// Use degrees here to work around https://github.com/FIRST-Tech-Challenge/FtcRobotController/issues/1070
AngularVelocity angularVelocityDegrees = imu.getRobotAngularVelocity(AngleUnit.DEGREES);
AngularVelocity angularVelocity = new AngularVelocity(
UnnormalizedAngleUnit.RADIANS,
(float) Math.toRadians(angularVelocityDegrees.xRotationRate),
(float) Math.toRadians(angularVelocityDegrees.yRotationRate),
(float) Math.toRadians(angularVelocityDegrees.zRotationRate),
angularVelocityDegrees.acquisitionTime
);

FlightRecorder.write("TWO_DEAD_WHEEL_INPUTS", new TwoDeadWheelInputsMessage(parPosVel, perpPosVel, angles, angularVelocity));

Expand Down

0 comments on commit dab1d63

Please sign in to comment.