OnboardIMU

class wpilib.OnboardIMU(mount_orientation: wpilib._wpilib.OnboardIMU.MountOrientation)

Bases: pybind11_object

Systemcore onboard IMU

Constructs a handle to the Systemcore onboard IMU.

Parameters:

mount_orientation – the mount orientation of Systemcore to determine yaw.

class MountOrientation(value: SupportsInt | SupportsIndex)

Bases: pybind11_object

A mount orientation of Systemcore

Members:

FLAT : Flat (mounted parallel to the ground).

LANDSCAPE : Landscape (vertically mounted with long edge of Systemcore parallel to

the ground).

PORTRAIT : Portrait (vertically mounted with the short edge of Systemcore parallel

to the ground).

FLAT = <MountOrientation.FLAT: 0>
LANDSCAPE = <MountOrientation.LANDSCAPE: 1>
PORTRAIT = <MountOrientation.PORTRAIT: 2>
OnboardIMU.MountOrientation.name -> str
property value
get_accel_x() wpimath.units.meters_per_second_squared

Get the acceleration along the X axis of the IMU.

Returns:

acceleration along the X axis

get_accel_y() wpimath.units.meters_per_second_squared

Get the acceleration along the Z axis of the IMU.

Returns:

acceleration along the Z axis

get_accel_z() wpimath.units.meters_per_second_squared

Get the acceleration along the Z axis of the IMU.

Returns:

acceleration along the Z axis

get_angle_x() wpimath.units.radians

Get the angle about the X axis of the IMU.

Returns:

angle about the X axis

get_angle_y() wpimath.units.radians

Get the angle about the Y axis of the IMU.

Returns:

angle about the Y axis

get_angle_z() wpimath.units.radians

Get the angle about the Z axis of the IMU.

Returns:

angle about the Z axis

get_gyro_rate_x() wpimath.units.radians_per_second

Get the angular rate about the X axis of the IMU.

Returns:

angular rate about the X axis

get_gyro_rate_y() wpimath.units.radians_per_second

Get the angular rate about the Y axis of the IMU.

Returns:

angular rate about the Y axis

get_gyro_rate_z() wpimath.units.radians_per_second

Get the angular rate about the Z axis of the IMU.

Returns:

angular rate about the Z axis

get_quaternion() wpimath._wpimath.Quaternion

Get the 3D orientation as a wpi::math::Quaternion.

Returns:

3D orientation

get_rotation2d() wpimath._wpimath.Rotation2d

Get the yaw as a wpi::math::Rotation2d.

Returns:

yaw

get_rotation3d() wpimath._wpimath.Rotation3d

Get the 3D orientation as a wpi::math::Rotation3d.

Returns:

3D orientation

get_yaw() wpimath.units.radians

Get the yaw value

Returns:

yaw value

reset_yaw() None

Reset the current yaw value to 0. Future reads of the yaw value will be relative to the current orientation.