drivers.imu module

class drivers.imu.BNO055(i2c, address=micropython.const)[source]

Bases: object

acceleration()[source]

Read tare-corrected acceleration in m/s².

acceleration_raw()[source]

Read uncalibrated acceleration in m/s².

calibration_status()[source]

Get calibration status for each sensor (sys, gyro, accel, mag).

Returns: Tuple of 4 values (0-3 each, higher = better calibrated).

clear_calibration_offsets()[source]

Reset all calibration offsets to zero.

clear_tare()[source]

Reset all tare offsets to zero.

euler()[source]

Read tare-corrected Euler angles in radians (heading, roll, pitch).

euler_raw()[source]

Read uncalibrated Euler angles in radians (heading, roll, pitch).

get_calibration_offsets()[source]

Retrieve stored calibration offset profile (22 bytes).

get_euler_tare()[source]

Get current Euler angle tare offset.

get_tare()[source]

Get current tare offsets.

Returns: Tuple (accel_tare, gyro_tare).

gravity()[source]

Read fusion-computed gravity vector in m/s².

gyro()[source]

Read tare-corrected angular velocity in rad/s.

gyro_raw()[source]

Read uncalibrated angular velocity in rad/s.

initialize(mode=micropython.const)[source]

Initialize sensor, configure power/units, and set operating mode.

Args:

mode: Operation mode (default: NDOF_OP_MODE).

Returns: True on success. Raises OSError if chip not found.

linear_acceleration()[source]

Read fusion-computed linear acceleration (gravity-removed) in m/s².

magnetic()[source]

Read magnetometer data in microteslas (µT).

quaternion()[source]

Read sensor fusion quaternion (w, x, y, z).

reset()[source]

Perform hardware reset and verify chip responds.

Returns: True if chip ready, False if timeout.

set_calibration_offsets(offsets)[source]

Load calibration offset profile (must be exactly 22 bytes).

set_euler_tare(euler_hrp)[source]

Manually set tare offset for Euler angles (heading, roll, pitch).

set_mode(mode)[source]

Set sensor operation mode and wait for stabilization.

set_tare(accel_xyz, gyro_xyz)[source]

Manually set tare offsets for acceleration and gyroscope.

tare_accel_gyro(sample_count=100, sample_delay_ms=5)[source]

Calibrate accelerometer and gyroscope offsets by sampling while stationary.

Args:

sample_count: Number of samples to average (default: 100). sample_delay_ms: Delay between samples in ms (default: 5).

Returns: Tuple (accel_tare, gyro_tare).

tare_euler(sample_count=20, sample_delay_ms=5)[source]

Calibrate Euler angle heading offset by sampling while stationary.

Args:

sample_count: Number of samples to average (default: 20). sample_delay_ms: Delay between samples in ms (default: 5).

Returns: Euler tare tuple (heading, roll, pitch).

temperature()[source]

Read sensor die temperature in degrees Celsius.

drivers.imu.cooperative_delay_ms(delay_ms, state=0)[source]

Yield for specified milliseconds, compatible with cooperative scheduler.