mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Upgrading to 2025.7.2
This commit is contained in:
@@ -20,7 +20,7 @@ public class NavXSwerve extends SwerveIMU
|
||||
/**
|
||||
* Mutable {@link MutAngularVelocity} for readings.
|
||||
*/
|
||||
private final MutAngularVelocity yawVel = new MutAngularVelocity(0, 0, DegreesPerSecond);
|
||||
private final MutAngularVelocity yawVel = new MutAngularVelocity(0, 0, DegreesPerSecond);
|
||||
/**
|
||||
* NavX IMU.
|
||||
*/
|
||||
@@ -28,15 +28,15 @@ public class NavXSwerve extends SwerveIMU
|
||||
/**
|
||||
* Offset for the NavX.
|
||||
*/
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
/**
|
||||
* Inversion for the gyro
|
||||
*/
|
||||
private boolean invertedIMU = false;
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
/**
|
||||
* An {@link Alert} for if there is an error instantiating the NavX.
|
||||
*/
|
||||
private Alert navXError;
|
||||
/**
|
||||
* Inversion state of the {@link AHRS}.
|
||||
*/
|
||||
private boolean inverted = false;
|
||||
|
||||
/**
|
||||
* Constructor for the NavX({@link AHRS}) swerve.
|
||||
@@ -61,7 +61,8 @@ public class NavXSwerve extends SwerveIMU
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
public void close()
|
||||
{
|
||||
imu.close();
|
||||
}
|
||||
|
||||
@@ -101,8 +102,8 @@ public class NavXSwerve extends SwerveIMU
|
||||
*/
|
||||
public void setInverted(boolean invertIMU)
|
||||
{
|
||||
invertedIMU = invertIMU;
|
||||
setOffset(getRawRotation3d());
|
||||
inverted = invertIMU;
|
||||
// setOffset(getRawRotation3d());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +114,7 @@ public class NavXSwerve extends SwerveIMU
|
||||
@Override
|
||||
public Rotation3d getRawRotation3d()
|
||||
{
|
||||
return invertedIMU ? imu.getRotation3d().unaryMinus() : imu.getRotation3d();
|
||||
return inverted ? imu.getRotation3d().unaryMinus() : imu.getRotation3d();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +125,7 @@ public class NavXSwerve extends SwerveIMU
|
||||
@Override
|
||||
public Rotation3d getRotation3d()
|
||||
{
|
||||
return getRawRotation3d().minus(offset);
|
||||
return getRawRotation3d().rotateBy(offset.unaryMinus());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user