Package swervelib.imu
Class Pigeon2Swerve
java.lang.Object
swervelib.imu.SwerveIMU
swervelib.imu.Pigeon2Swerve
- All Implemented Interfaces:
AutoCloseable
SwerveIMU interface for the
Pigeon2-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doubleWait time for status frames to show up. -
Constructor Summary
ConstructorsConstructorDescriptionPigeon2Swerve(int canid) Generate the SwerveIMU forPigeon2.Pigeon2Swerve(int canid, String canbus) Generate the SwerveIMU forPigeon2. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear sticky faults onPigeon2.voidclose()voidResetPigeon2to factory default.getAccel()Fetch the acceleration [x, y, z] from the IMU in meters per second squared.getIMU()Get the instantiatedPigeon2object.Fetch theRotation3dfrom the IMU without any zeroing.Fetch theRotation3dfrom the IMU.Fetch the rotation rate from the IMU asMutAngularVelocityvoidsetInverted(boolean invertIMU) Set the gyro to invert its default directionvoidsetOffset(Rotation3d offset) Set the gyro offset.
-
Field Details
-
STATUS_TIMEOUT_SECONDS
public static double STATUS_TIMEOUT_SECONDSWait time for status frames to show up.
-
-
Constructor Details
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classSwerveIMU
-
factoryDefault
public void factoryDefault()ResetPigeon2to factory default.- Specified by:
factoryDefaultin classSwerveIMU
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults onPigeon2.- Specified by:
clearStickyFaultsin classSwerveIMU
-
setOffset
Set the gyro offset.- Specified by:
setOffsetin classSwerveIMU- Parameters:
offset- gyro offset as aRotation3d.
-
setInverted
public void setInverted(boolean invertIMU) Set the gyro to invert its default direction- Specified by:
setInvertedin classSwerveIMU- Parameters:
invertIMU- invert gyro direction
-
getRawRotation3d
Fetch theRotation3dfrom the IMU without any zeroing. Robot relative.- Specified by:
getRawRotation3din classSwerveIMU- Returns:
Rotation3dfrom the IMU.
-
getRotation3d
Fetch theRotation3dfrom the IMU. Robot relative.- Specified by:
getRotation3din classSwerveIMU- Returns:
Rotation3dfrom the IMU.
-
getAccel
Fetch the acceleration [x, y, z] from the IMU in meters per second squared. If acceleration isn't supported returns empty.- Specified by:
getAccelin classSwerveIMU- Returns:
Translation3dof the acceleration as anOptional.
-
getYawAngularVelocity
Description copied from class:SwerveIMUFetch the rotation rate from the IMU asMutAngularVelocity- Specified by:
getYawAngularVelocityin classSwerveIMU- Returns:
MutAngularVelocityof the rotation rate.
-
getIMU
Get the instantiatedPigeon2object.
-