ADIS16470_IMU

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

Bases: Sendable

Overloaded function.

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

Creates a new ADIS16740 IMU object.

The default setup is the onboard SPI port with a calibration time of 4 seconds. Yaw, pitch, and roll are kZ, kX, and kY respectively.

  1. __init__(self: wpilib._wpilib.ADIS16470_IMU, yaw_axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis, pitch_axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis, roll_axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis) -> None

Creates a new ADIS16740 IMU object.

The default setup is the onboard SPI port with a calibration time of 4 seconds.

:emphasis:`Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch,or kRoll will result in an error.`

Parameters:
  • yaw_axis – The axis that measures the yaw

  • pitch_axis – The axis that measures the pitch

  • roll_axis – The axis that measures the roll

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

Creates a new ADIS16740 IMU object.

:emphasis:`Input axes limited to kX, kY and kZ. Specifying kYaw, kPitch, or kRoll will result in an error.`

Parameters:
  • yaw_axis – The axis that measures the yaw

  • pitch_axis – The axis that measures the pitch

  • roll_axis – The axis that measures the roll

  • port – The SPI Port the gyro is plugged into

  • cal_time – Calibration time

class CalibrationTime(value: int)

Bases: pybind11_object

ADIS16470 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.

kX, kY, and kZ refer to the IMU’s X, Y, and Z axes respectively. kYaw, kPitch, and kRoll are configured by the user to refer to an X, Y, or Z axis.

Members:

kX : The IMU’s X axis.

kY : The IMU’s Y axis.

kZ : The IMU’s Z axis.

kYaw : The user-configured yaw axis.

kPitch : The user-configured pitch axis.

kRoll : The user-configured roll axis.

kPitch = <IMUAxis.kPitch: 4>
kRoll = <IMUAxis.kRoll: 5>
kX = <IMUAxis.kX: 0>
kY = <IMUAxis.kY: 1>
kYaw = <IMUAxis.kYaw: 3>
kZ = <IMUAxis.kZ: 2>
property name
property value
calibrate() None

Switches the active SPI port to standard SPI mode, writes the command to activate the new null configuration, and re-enables auto SPI.

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

Switches the active SPI port to standard SPI mode, writes a new value to the NULL_CNFG register in the IMU, and re-enables auto SPI.

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(axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis = <IMUAxis.kYaw: 3>) wpimath.units.degrees

Returns the axis angle (CCW positive).

Parameters:

axis – The IMUAxis whose angle to return. Defaults to user configured Yaw.

Returns:

The axis angle (CCW positive).

getPitchAxis() wpilib._wpilib.ADIS16470_IMU.IMUAxis

Returns which axis, kX, kY, or kZ, is set to the pitch axis.

Returns:

IMUAxis Pitch Axis

getPort() int

Gets the SPI port number.

Returns:

The SPI port number.

getRate(axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis = <IMUAxis.kYaw: 3>) wpimath.units.degrees_per_second

Returns the axis angular rate (CCW positive).

Parameters:

axis – The IMUAxis whose rate to return. Defaults to user configured Yaw.

Returns:

Axis angular rate (CCW positive).

getRollAxis() wpilib._wpilib.ADIS16470_IMU.IMUAxis

Returns which axis, kX, kY, or kZ, is set to the roll axis.

Returns:

IMUAxis Roll Axis

getXComplementaryAngle() wpimath.units.degrees

Returns the X-axis complementary angle.

getXFilteredAccelAngle() wpimath.units.degrees

Returns the X-axis filtered acceleration angle.

getYComplementaryAngle() wpimath.units.degrees

Returns the Y-axis complementary angle.

getYFilteredAccelAngle() wpimath.units.degrees

Returns the Y-axis filtered acceleration angle.

getYawAxis() wpilib._wpilib.ADIS16470_IMU.IMUAxis

Returns which axis, kX, kY, or kZ, is set to the yaw axis.

Returns:

IMUAxis Yaw Axis

initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
isConnected() bool

Checks the connection status of the IMU.

Returns:

True if the IMU is connected, false otherwise.

property m_pitch_axis wpilib._wpilib.ADIS16470_IMU.IMUAxis
property m_roll_axis wpilib._wpilib.ADIS16470_IMU.IMUAxis
property m_yaw_axis wpilib._wpilib.ADIS16470_IMU.IMUAxis
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.

setGyroAngle(axis: wpilib._wpilib.ADIS16470_IMU.IMUAxis, angle: wpimath.units.degrees) None

Allow the designated gyro angle to be set to a given value. This may happen with unread values in the buffer, it is suggested that the IMU is not moving when this method is run.

Parameters:
  • axis – IMUAxis that will be changed

  • angle – The new angle (CCW positive)

setGyroAngleX(angle: wpimath.units.degrees) None

Allow the gyro angle X to be set to a given value. This may happen with unread values in the buffer, it is suggested that the IMU is not moving when this method is run.

Parameters:

angle – The new angle (CCW positive)

setGyroAngleY(angle: wpimath.units.degrees) None

Allow the gyro angle Y to be set to a given value. This may happen with unread values in the buffer, it is suggested that the IMU is not moving when this method is run.

Parameters:

angle – The new angle (CCW positive)

setGyroAngleZ(angle: wpimath.units.degrees) None

Allow the gyro angle Z to be set to a given value. This may happen with unread values in the buffer, it is suggested that the IMU is not moving when this method is run.

Parameters:

angle – The new angle (CCW positive)