Package swervelib.imu
Class CanandgyroSwerve
java.lang.Object
swervelib.imu.SwerveIMU
swervelib.imu.CanandgyroSwerve
- All Implemented Interfaces:
AutoCloseable
SwerveIMU interface for the Boron
Canandgyro by Redux Robotics-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doubleWait time for status frames to show up. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear sticky faults onCanandgyro.voidclose()voidResetCanandgyroto factory default.getAccel()Fetch the acceleration [x, y, z] from the IMU in meters per second squared.getIMU()Get the instantiatedCanandgyroIMU object.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
-
CanandgyroSwerve
public CanandgyroSwerve(int canid) Generate the SwerveIMU forCanandgyro.- Parameters:
canid- CAN ID for the BoronCanandgyro
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classSwerveIMU
-
factoryDefault
public void factoryDefault()ResetCanandgyroto factory default.- Specified by:
factoryDefaultin classSwerveIMU
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults onCanandgyro.- 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 instantiatedCanandgyroIMU object.
-