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=None, debug=False)

Library for the BNO08x IMUs from Hillcrest Laboratories

Parameters

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

property acceleration

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

property activity_classification

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()

Begin the sensor’s self-calibration routine

property calibration_status

Get the status of the self-calibration

enable_feature(feature_id)

Used to enable a given feature of the BNO08x

property game_quaternion

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

A quaternion representing the current geomagnetic rotation vector

property gyro

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

hard_reset()

Hardware reset the sensor to an initial unconfigured state

initialize()

Initialize the sensor

property linear_acceleration

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

property magnetic

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

property quaternion

A quaternion representing the current rotation vector

property raw_acceleration

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

property raw_gyro

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

property raw_magnetic

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

save_calibration_data()

Save the self-calibration data

property shake

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()

Reset the sensor to an initial unconfigured state

property stability_classification

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

The number of steps detected since the sensor was initialized

class adafruit_bno08x.Packet(packet_bytes)

A class representing a Hillcrest LaboratorySensor Hub Transport packet

property channel_number

The packet channel

classmethod header_from_buffer(packet_bytes)

Creates a PacketHeader object from a given buffer

classmethod is_error(header)

Returns True if the header is an error condition

property report_id

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)

Parse the fields of a product id report