ADIS16448_IMU

class wpilib.ADIS16448_IMU(*args, **kwargs)

Bases: Sendable

Overloaded function.

  1. __init__(self: wpilib._wpilib.ADIS16448_IMU) -> None

IMU constructor on onboard MXP CS0, Z-up orientation, and complementary AHRS computation.

  1. __init__(self: wpilib._wpilib.ADIS16448_IMU, yaw_axis: wpilib._wpilib.ADIS16448_IMU.IMUAxis, port: wpilib._wpilib.SPI.Port, cal_time: wpilib._wpilib.ADIS16448_IMU.CalibrationTime) -> None

IMU constructor on the specified MXP port and orientation.

Parameters:
  • yaw_axis – The axis where gravity is present. Valid options are kX, kY, and kZ

  • port – The SPI port where the IMU is connected.

  • cal_time – The calibration time that should be used on start-up.

class CalibrationTime(value: int)

Bases: pybind11_object

ADIS16448 calibration times.

Members:

_32ms : 32 ms calibration time.

_64ms : 64 ms calibration time.

_128ms : 128 ms calibration time.

_256ms : 256 ms calibration time.

_512ms : 512 ms calibration time.

_1s : 1 s calibration time.

_2s : 2 s calibration time.

_4s : 4 s calibration time.

_8s : 8 s calibration time.

_16s : 16 s calibration time.

_32s : 32 s calibration time.

_64s : 64 s calibration time.

property name
property value
class IMUAxis(value: int)

Bases: pybind11_object

IMU axes.

Members:

kX : The IMU’s X axis.

kY : The IMU’s Y axis.

kZ : The IMU’s Z axis.

kX = <IMUAxis.kX: 0>
kY = <IMUAxis.kY: 1>
kZ = <IMUAxis.kZ: 2>
property name
property value
calibrate() None

Initialize the IMU.

Perform gyro offset calibration by collecting data for a number of seconds and computing the center value. The center value is subtracted from subsequent measurements.

It’s important to make sure that the robot is not moving while the centering calculations are in progress, this is typically done when the robot is first turned on while it’s sitting at rest before the match starts.

The calibration routine can be triggered by the user during runtime.

configCalTime(new_cal_time: wpilib._wpilib.ADIS16448_IMU.CalibrationTime) int

Configures the calibration time used for the next calibrate.

Parameters:

new_cal_time – The calibration time that should be used

configDecRate(decimationRate: int) int

Configures the decimation rate of the IMU.

Parameters:

decimationRate – The new decimation value.

Returns:

0 if success, 1 if no change, 2 if error.

getAccelX() wpimath.units.meters_per_second_squared

Returns the acceleration in the X axis.

getAccelY() wpimath.units.meters_per_second_squared

Returns the acceleration in the Y axis.

getAccelZ() wpimath.units.meters_per_second_squared

Returns the acceleration in the Z axis.

getAngle() wpimath.units.degrees

Returns the yaw axis angle in degrees (CCW positive).

getBarometricPressure() wpimath.units.pounds_per_square_inch

Returns the barometric pressure.

getGyroAngleX() wpimath.units.degrees

Returns the accumulated gyro angle in the X axis.

getGyroAngleY() wpimath.units.degrees

Returns the accumulated gyro angle in the Y axis.

getGyroAngleZ() wpimath.units.degrees

Returns the accumulated gyro angle in the Z axis.

getGyroRateX() wpimath.units.degrees_per_second

Returns the angular rate in the X axis.

getGyroRateY() wpimath.units.degrees_per_second

Returns the angular rate in the Y axis.

getGyroRateZ() wpimath.units.degrees_per_second

Returns the angular rate in the Z axis.

getMagneticFieldX() wpimath.units.teslas

Returns the magnetic field strength in the X axis.

getMagneticFieldY() wpimath.units.teslas

Returns the magnetic field strength in the Y axis.

getMagneticFieldZ() wpimath.units.teslas

Returns the magnetic field strength in the Z axis.

getPort() int

Get the SPI port number.

Returns:

The SPI port number.

getRate() wpimath.units.degrees_per_second

Returns the yaw axis angular rate in degrees per second (CCW positive).

getTemperature() wpimath.units.celsius

Returns the temperature.

getXComplementaryAngle() wpimath.units.degrees

Returns the complementary angle around the X axis computed from accelerometer and gyro rate measurements.

getXFilteredAccelAngle() wpimath.units.degrees

Returns the X-axis filtered acceleration angle.

getYComplementaryAngle() wpimath.units.degrees

Returns the complementary angle around the Y axis computed from accelerometer and gyro rate measurements.

getYFilteredAccelAngle() wpimath.units.degrees

Returns the Y-axis filtered acceleration angle.

getYawAxis() wpilib._wpilib.ADIS16448_IMU.IMUAxis
initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
isConnected() bool

Checks the connection status of the IMU.

Returns:

True if the IMU is connected, false otherwise.

reset() None

Reset the gyro.

Resets the gyro accumulations to a heading of zero. This can be used if there is significant drift in the gyro and it needs to be recalibrated after running.

setYawAxis(yaw_axis: wpilib._wpilib.ADIS16448_IMU.IMUAxis) int