Skip to content

Commit

Permalink
Use Pigeon native function.
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Feb 7, 2024
1 parent e7f94fb commit 990f442
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/main/java/swervelib/imu/Pigeon2Swerve.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,7 @@ public void setInverted(boolean invertIMU)
@Override
public Rotation3d getRawRotation3d()
{
// TODO: Switch to suppliers.
StatusSignal<Double> w = imu.getQuatW();
StatusSignal<Double> x = imu.getQuatX();
StatusSignal<Double> y = imu.getQuatY();
StatusSignal<Double> z = imu.getQuatZ();
if(w.getStatus() != StatusCode.OK)
{
w = w.waitForUpdate(STATUS_TIMEOUT_SECONDS);
}
if(x.getStatus() != StatusCode.OK)
{
x = x.waitForUpdate(STATUS_TIMEOUT_SECONDS);
}
if(y.getStatus() != StatusCode.OK)
{
y = y.waitForUpdate(STATUS_TIMEOUT_SECONDS);
}
if(z.getStatus() != StatusCode.OK)
{
z = z.waitForUpdate(STATUS_TIMEOUT_SECONDS);
}
Rotation3d reading = new Rotation3d(new Quaternion(w.getValue(),
x.getValue(),
y.getValue(),
z.getValue()));
Rotation3d reading = imu.getRotation3d();
return invertedIMU ? reading.unaryMinus() : reading;
}

Expand Down

0 comments on commit 990f442

Please sign in to comment.