Skip to main content

IMU Usage

The IMU model equipped on the device is ICM-42670-P, a 6-axis sensor integrating a 3-axis accelerometer and a 3-axis gyroscope. The gyroscope of ICM-42670-P supports measurement ranges of ±250 / ±500 / ±1000 / ±2000 dps, while the accelerometer supports ranges of ±2 / ±4 / ±8 / ±16 g. Its internal data is output in 16-bit two's complement format.

Data Path

reCamera PRO uses the standard IIO driver for the IMU, so raw data can be directly retrieved via IIO interfaces. Raw data files can be found under the directory /sys/bus/iio/devices/iio:device1/. IMU_DATA_SAMPLE

Read Data

Run the following command to read corresponding raw data. The example below demonstrates reading the X-axis acceleration data:

cat /sys/bus/iio/devices/iio:device1/in_accel_x_raw

Retrieve Data with Python

Python can be used to easily obtain IMU data. Below is a simple example:

#!/usr/bin/env python3
DEVICE = "/sys/bus/iio/devices/iio:device1"
with open(f"{DEVICE}/in_anglvel_scale", "r") as f:
scale = float(f.read().strip())
with open(f"{DEVICE}/in_anglvel_x_raw", "r") as f:
raw = int(f.read().strip())
gyro_x = raw * scale
print(f"Gyroscope X: {gyro_x:.6f} rad/s")

Technical Support and Product Discussion

Thank you for choosing our products! We are here to provide you with various support to ensure your experience with our products is as smooth as possible. We offer multiple communication channels to meet different preferences and needs.

Loading Comments...