adafruit_bno08x

Helper library for the Hillcrest Laboratories BNO08x IMUs

  • Author(s): Bryan Siepert

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_bno08x.BNO08X(reset: DigitalInOut | None = None, debug: bool = False)

Library for the BNO08x IMUs from Hillcrest Laboratories

Parameters:

i2c_bus (I2C) – The I2C bus the BNO08x is connected to.

property acceleration: Tuple[float, float, float] | None

A tuple representing the acceleration measurements on the X, Y, and Z axes in meters per second squared

property activity_classification: dict | None

Returns the sensor’s assessment of the activity that is creating the motions that it is sensing, one of:

  • “Unknown”

  • “In-Vehicle”

  • “On-Bicycle”

  • “On-Foot”

  • “Still”

  • “Tilting”

  • “Walking”

  • “Running”

  • “On Stairs”

begin_calibration() None

Begin the sensor’s self-calibration routine

property calibration_status: int

Get the status of the self-calibration

enable_feature(feature_id: int) None

Used to enable a given feature of the BNO08x

property game_quaternion: Tuple[float, float, float, float] | None

A quaternion representing the current rotation vector expressed as a quaternion with no specific reference for heading, while roll and pitch are referenced against gravity. To prevent sudden jumps in heading due to corrections, the game_quaternion property is not corrected using the magnetometer. Some drift is expected

property geomagnetic_quaternion: Tuple[float, float, float, float] | None

A quaternion representing the current geomagnetic rotation vector

property gravity: Tuple[float, float, float] | None

A tuple representing the gravity vector in the X, Y, and Z components axes in meters per second squared

property gyro: Tuple[float, float, float] | None

A tuple representing Gyro’s rotation measurements on the X, Y, and Z axes in radians per second

hard_reset() None

Hardware reset the sensor to an initial unconfigured state

initialize() None

Initialize the sensor

property linear_acceleration: Tuple[float, float, float] | None

A tuple representing the current linear acceleration values on the X, Y, and Z axes in meters per second squared

property magnetic: Tuple[float, float, float] | None

A tuple of the current magnetic field measurements on the X, Y, and Z axes

property quaternion: Tuple[float, float, float, float] | None

A quaternion representing the current rotation vector

property raw_acceleration: Tuple[int, int, int] | None

Returns the sensor’s raw, unscaled value from the accelerometer registers

property raw_gyro: Tuple[int, int, int] | None

Returns the sensor’s raw, unscaled value from the gyro registers

property raw_magnetic: Tuple[int, int, int] | None

Returns the sensor’s raw, unscaled value from the magnetometer registers

save_calibration_data() None

Save the self-calibration data

property shake: bool | None

True if a shake was detected on any axis since the last time it was checked

This property has a “latching” behavior where once a shake is detected, it will stay in a “shaken” state until the value is read. This prevents missing shake events but means that this property is not guaranteed to reflect the shake state at the moment it is read

soft_reset() None

Reset the sensor to an initial unconfigured state

property stability_classification: str | None

Returns the sensor’s assessment of it’s current stability, one of:

  • “Unknown” - The sensor is unable to classify the current stability

  • “On Table” - The sensor is at rest on a stable surface with very little vibration

  • “Stationary” - The sensor’s motion is below the stable threshold but the stable duration requirement has not been met. This output is only available when gyro calibration is enabled

  • “Stable” - The sensor’s motion has met the stable threshold and duration requirements.

  • “In motion” - The sensor is moving.

property steps: int | None

The number of steps detected since the sensor was initialized

class adafruit_bno08x.Packet(packet_bytes: bytearray)

A class representing a Hillcrest LaboratorySensor Hub Transport packet

property channel_number: int

The packet channel

classmethod header_from_buffer(packet_bytes: bytearray) PacketHeader

Creates a PacketHeader object from a given buffer

classmethod is_error(header: PacketHeader) bool

Returns True if the header is an error condition

property report_id: int

The Packet’s Report ID

exception adafruit_bno08x.PacketError

Raised when the packet couldnt be parsed

class adafruit_bno08x.PacketHeader(channel_number, sequence_number, data_length, packet_byte_count)
channel_number

Alias for field number 0

data_length

Alias for field number 2

packet_byte_count

Alias for field number 3

sequence_number

Alias for field number 1

adafruit_bno08x.parse_sensor_id(buffer: bytearray) Tuple[int, ...]

Parse the fields of a product id report