🧪 New tutorials are being published — build from robot arms to sensors step by step
Skip to content

RDK Series

Step 1 Connect devices

This tutorial takes the mirroring of the? version of the RDK X5 motherboard as an example.

Connect the IMU attitude sensor to the I2C interface of the RDK X5 as shown below.

Step 1 Connect devices – 1

Step 1 Connect devices – 2

2. Check device status

View I2C Devices

PowerShell
python3 /app/40pin_samples/test_i2c.py

2. Check device status – 1

3. Install the driver library

3.1** Install the Python libraries required for the code **

PowerShell
sudo apt update
sudo apt install -y python3-serial
sudo apt install -y python3-smbus2

3.2 Transfer Files

[IMU_ROS2.zip]

Friends who are not yet familiar with using MobaXterm to transfer files, please refer to the following webpage for detailed installation and operation methods of MobaXterm:文件远程传输

Drag the decompressed files onto Raspberry Pi 5 via MobaXterm software.

3. Install the driver library – 1

4. View IMU data

**Enter the ~/IMU_Library directory and run the IMU_Serial_Library.py file **

PowerShell
cd ~/imu_ros1/src/IMU_ROS1/IMU_Library
# 或
cd ~/imu_ros2/src/IMU_ROS2/IMU_Library

# 运行 IMU 数据打印文件
python3 -m IMU_Library.IMU_I2C_Library

4. View IMU data – 1

Attention: The above is the data reading of 10-axis IMU, 6-axis without magnetometer and barometer data, 9-axis without barometer data.

5. IMU Calibration

**Enter the ~/IMU_Library directory and run the imu_calibration_tool.py file **

PowerShell
cd ~/IMU_Library

# 运行 IMU 校准代码文件 --I2C通讯校准
# 执行所有校准(整体、磁力计、温度)
python3 -m IMU_Library.imu_calibration_tool --mode i2c --port 0

# 仅整体校准
python3-m IMU_Library.imu_calibration_tool --mode i2c --port 0 --calibrate imu

# 仅磁力计校准
python3-m IMU_Library.imu_calibration_tool --mode i2c --port 0 --calibrate mag

# 仅温度校准
python3-m IMU_Library.imu_calibration_tool --mode i2c --port 0 --calibrate temp

5. IMU Calibration – 1

6. Precautions

When using the RDK X5 main board, it is necessary to modify the serial number of the I2C bus according to the actual situation. The modification position is shown in the figure below. Usually, it is bus number 0.

6. Precautions – 1

6. Precautions – 2