Updated swervelib telemetry configurability. Reliable gyroscope modulo

This commit is contained in:
thenetworkgrinch
2023-02-24 19:11:05 -06:00
parent 9b699291e8
commit 69edd17103
121 changed files with 2280 additions and 501 deletions

View File

@@ -47,7 +47,7 @@ public class NavXSwerve extends SwerveIMU
public void factoryDefault()
{
// gyro.reset(); // Reported to be slow
yawOffset = gyro.getYaw() % 360;
yawOffset = Math.IEEEremainder(gyro.getYaw(), 360);
}
/**
@@ -67,7 +67,7 @@ public class NavXSwerve extends SwerveIMU
public void setYaw(double yaw)
{
// gyro.reset(); // Reported to be slow using the offset.
yawOffset = (yaw % 360) + (gyro.getYaw() % 360);
yawOffset = Math.IEEEremainder(yaw, 360) + Math.IEEEremainder(gyro.getYaw(), 360);
}
/**
@@ -78,9 +78,10 @@ public class NavXSwerve extends SwerveIMU
@Override
public void getYawPitchRoll(double[] yprArray)
{
yprArray[0] = (gyro.getYaw() % 360) - yawOffset;
yprArray[1] = gyro.getPitch() % 360;
yprArray[2] = gyro.getRoll() % 360;
yprArray[0] = (Math.IEEEremainder(gyro.getYaw(), 360)) - yawOffset;
yprArray[1] = Math.IEEEremainder(gyro.getPitch(), 360);
yprArray[2] = Math.IEEEremainder(gyro.getRoll(), 360);
}
/**