Updated IMU

This commit is contained in:
thenetworkgrinch
2023-03-08 23:34:33 -06:00
parent ca03b2122f
commit ec958aecaa
117 changed files with 678 additions and 635 deletions

View File

@@ -403,7 +403,7 @@ public class SwerveDrive
// simulated
if (!SwerveDriveTelemetry.isSimulation)
{
imu.setYaw(0);
imu.setOffset(imu.getRawRotation3d());
} else
{
simIMU.setAngle(0);
@@ -682,7 +682,7 @@ public class SwerveDrive
if (!SwerveDriveTelemetry.isSimulation)
{
imu.setYaw(swerveDrivePoseEstimator.getEstimatedPosition().getRotation().getDegrees());
imu.setOffset(new Rotation3d(0, 0, swerveDrivePoseEstimator.getEstimatedPosition().getRotation().getRadians()));
// Yaw reset recommended by Team 1622
} else
{
@@ -691,13 +691,13 @@ public class SwerveDrive
}
/**
* Set the Gyroscope offset using a {@link Rotation3d} object. (Only yaw works currently.)
* Set the Gyroscope offset using a {@link Rotation3d} object.
*
* @param gyro Gyroscope offset.
*/
public void setGyro(Rotation3d gyro)
{
imu.setYaw(gyro.getZ());
imu.setOffset(gyro);
}
}