Package swervelib.imu
Class CanandgyroSwerve
java.lang.Object
swervelib.imu.SwerveIMU
swervelib.imu.CanandgyroSwerve
SwerveIMU interface for the Boron Candandgyro by Redux Robotics
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.reduxrobotics.sensors.canandgyro.CanandgyroBoron Canandgyro by Redux Robotics.private booleanInversion for the gyroprivate edu.wpi.first.math.geometry.Rotation3dOffset for the Boron Canandgyro.static doubleWait time for status frames to show up. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear sticky faults on IMU.voidReset IMU to factory default.Optional<edu.wpi.first.math.geometry.Translation3d>getAccel()Fetch the acceleration [x, y, z] from the IMU in meters per second squared.getIMU()Get the instantiated IMU object.doublegetRate()Fetch the rotation rate from the IMU in degrees per second.edu.wpi.first.math.geometry.Rotation3dFetch theRotation3dfrom the IMU without any zeroing.edu.wpi.first.math.geometry.Rotation3dFetch theRotation3dfrom the IMU.voidsetInverted(boolean invertIMU) Set the gyro to invert its default directionvoidsetOffset(edu.wpi.first.math.geometry.Rotation3d offset) Set the gyro offset.
-
Field Details
-
STATUS_TIMEOUT_SECONDS
public static double STATUS_TIMEOUT_SECONDSWait time for status frames to show up. -
imu
com.reduxrobotics.sensors.canandgyro.Canandgyro imuBoron Canandgyro by Redux Robotics. -
offset
private edu.wpi.first.math.geometry.Rotation3d offsetOffset for the Boron Canandgyro. -
invertedIMU
private boolean invertedIMUInversion for the gyro
-
-
Constructor Details
-
CanandgyroSwerve
public CanandgyroSwerve(int canid) Generate the SwerveIMU forCanandgyro.- Parameters:
canid- CAN ID for the Boron Canandgyro
-
-
Method Details
-
factoryDefault
public void factoryDefault()Reset IMU to factory default.- Specified by:
factoryDefaultin classSwerveIMU
-
clearStickyFaults
public void clearStickyFaults()Clear sticky faults on IMU.- Specified by:
clearStickyFaultsin classSwerveIMU
-
setOffset
public void setOffset(edu.wpi.first.math.geometry.Rotation3d offset) Set the gyro offset. -
setInverted
public void setInverted(boolean invertIMU) Set the gyro to invert its default direction- Specified by:
setInvertedin classSwerveIMU- Parameters:
invertIMU- invert gyro direction
-
getRawRotation3d
public edu.wpi.first.math.geometry.Rotation3d getRawRotation3d()Fetch theRotation3dfrom the IMU without any zeroing. Robot relative.- Specified by:
getRawRotation3din classSwerveIMU- Returns:
Rotation3dfrom the IMU.
-
getRotation3d
public edu.wpi.first.math.geometry.Rotation3d 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. -
getRate
public double getRate()Fetch the rotation rate from the IMU in degrees per second. If rotation rate isn't supported returns empty. -
getIMU
Get the instantiated IMU object.
-