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:
@@ -19,7 +19,11 @@ public class ADIS16448Swerve extends SwerveIMU
|
||||
/**
|
||||
* Offset for the ADIS16448.
|
||||
*/
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
private Rotation3d offset = new Rotation3d();
|
||||
/**
|
||||
* Inversion for the gyro
|
||||
*/
|
||||
private boolean invertedIMU = false;
|
||||
|
||||
/**
|
||||
* Construct the ADIS16448 imu and reset default configurations. Publish the gyro to the SmartDashboard.
|
||||
@@ -60,6 +64,16 @@ public class ADIS16448Swerve 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.
|
||||
*
|
||||
@@ -67,9 +81,10 @@ public class ADIS16448Swerve extends SwerveIMU
|
||||
*/
|
||||
public Rotation3d getRawRotation3d()
|
||||
{
|
||||
return new Rotation3d(Math.toRadians(-imu.getGyroAngleX()),
|
||||
Math.toRadians(-imu.getGyroAngleY()),
|
||||
Math.toRadians(-imu.getGyroAngleZ()));
|
||||
Rotation3d reading = new Rotation3d(Math.toRadians(-imu.getGyroAngleX()),
|
||||
Math.toRadians(-imu.getGyroAngleY()),
|
||||
Math.toRadians(-imu.getGyroAngleZ()));
|
||||
return invertedIMU ? reading.unaryMinus() : reading;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user