mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-19 06:21:40 +00:00
Updated to 2024.4.6.1
This commit is contained in:
@@ -23,7 +23,11 @@ public class NavXSwerve extends SwerveIMU
|
||||
/**
|
||||
* Offset for the NavX.
|
||||
*/
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
/**
|
||||
* Inversion for the gyro
|
||||
*/
|
||||
private boolean invertedIMU = false;
|
||||
/**
|
||||
* An {@link Alert} for if there is an error instantiating the NavX.
|
||||
*/
|
||||
@@ -124,6 +128,16 @@ public class NavXSwerve extends SwerveIMU
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the gyro to invert its default direction
|
||||
*
|
||||
* @param invertIMU invert gyro direction
|
||||
*/
|
||||
public void setInverted(boolean invertIMU)
|
||||
{
|
||||
invertedIMU = invertIMU;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the {@link Rotation3d} from the IMU without any zeroing. Robot relative.
|
||||
*
|
||||
@@ -132,7 +146,7 @@ public class NavXSwerve extends SwerveIMU
|
||||
@Override
|
||||
public Rotation3d getRawRotation3d()
|
||||
{
|
||||
return gyro.getRotation3d();
|
||||
return invertedIMU ? gyro.getRotation3d().unaryMinus() : gyro.getRotation3d();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user