IMU – Inertial Measurement Unit

The IMU mounted on the SBC is the Bosch BMI088, a high-performance 6-axis inertial sensor (3 accelerometers + 3 gyroscopes) that allows for highly accurate measurement of orientation and detection of motion along three orthogonal axes.

Note

If you are an advanced IMU user and need to know more technical details, we suggest you take a look at the IMU manufacturer documentation.

Methods

class Imu

The Imu class allows you to easily configure the IMU settings and read its values.

read_acc_g()

Reads the IMU accelerometers values.

Return:

List with 3 elements of X,Y,Z axis accelerometer values in [G]

Example to read IMU accelerometer values:
>>> import sbc
>>> imu = sbc.Imu()
>>> print(imu.read_acc_g())
[0.009338379, -0.003387451, 0.9941711]
read_gyro_rad_s()

Reads the IMU gyroscopes values.

Return:

List with 3 elements of X,Y,Z axis gyroscope values in [rad/s]

Example to read IMU gyroscope values:
>>> import sbc
>>> imu = sbc.Imu()
>>> print(imu.read_gyro_rad_s())
[0.00186427, 0.007856565, 0.001731107]
read_temp_c()

Reads the IMU internal temperature sensor.

Return:

Internal temperature in [degC] units

Example to read IMU temperature:
>>> import sbc
>>> imu = sbc.Imu()
>>> print(imu.read_temp_c())
26.875
acc_config(freq_hz, range_g)

Configures IMU accelerometers frequency and range.
When the Imu class is instantiated, the accelerometer default values are 100Hz and 3G.

Args:

Parameter name

Value

Description

freq_hz

ACC_CONF_ODR_12_5
ACC_CONF_ODR_25
ACC_CONF_ODR_50
ACC_CONF_ODR_100
ACC_CONF_ODR_200
ACC_CONF_ODR_400
ACC_CONF_ODR_800
ACC_CONF_ODR_1600

Accelerometer output
data rate values in Hz

range_g

ACC_RANGE_3_G
ACC_RANGE_6_G
ACC_RANGE_12_G
ACC_RANGE_24_G

Accelerometer range in G

Example to change IMU accelerometers configuration to 200Hz and 6G:
>>> import sbc
>>> imu = sbc.Imu()
>>> imu.acc_config( imu.ACC_CONF_ODR_200, imu.ACC_RANGE_6_G )
gyro_config(freq_hz, range_deg_s)

Configures IMU gyroscopes frequency and range.
When the Imu class is instantiated, the gyroscopes default values are 100Hz and 125deg/s.

Args:

Parameter name

Value

Description

freq_hz

GYRO_ODR_100
GYRO_ODR_200
GYRO_ODR_400
GYRO_ODR_1000
GYRO_ODR_2000

Gyroscope output
data rate values in Hz

range_deg_s

GYRO_RANGE_125_DEG_S
GYRO_RANGE_250_DEG_S
GYRO_RANGE_500_DEG_S
GYRO_RANGE_1000_DEG_S
GYRO_RANGE_2000_DEG_S

Gyroscope range in deg/s

Example to change IMU gyroscopes configuration to 200Hz and 500deg/s:
>>> import sbc
>>> imu = sbc.Imu()
>>> imu.gyro_config( imu.GYRO_ODR_200, imu.GYRO_RANGE_500_DEG_S )