yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
10-axis IMU Navigation Module📖
1.Preparation
  • 1.1 Introduction to the IMU module
  • 1.2 Install the IMU module
  • 1.3 Precautions for use
2.PC Software tutorial
  • 2.1 Install serial driver
  • 2.2 Connect to the PC software
  • 2.3 Configuration parameters
  • 2.4 Calibrate the IMU module
  • 2.5 Graphically display data
  • 2.6 Connected to the GPS module
3.Basic application
  • 3.1 Raspberry Pi-USB application
  • 3.2 JetsonNano-USB application
4.ROS application
  • ROS1 application case tutorial
  • ROS2 application case tutorial
5.Communication protocol
  • Communication protocol
6.STM32 tutorial
  • 1. serial port application routine
  • 2. IIC application routine
7.RDK X3 tutorial
  • RDK X3 tutorial
8.MSPM0 tutorial
  • MSPM0G3507 serial port application
  • MSPM0G3519 serial port applicationnew
Download
  • Code
  • 3D_Model_File
  • Annex
Download ZIP

Welcome to 10-axis IMU Navigation Module repository

ROS2 application case tutorial

Environment build

This course explains how to build a ten-axis IMU module environment in ros2, including compiling function packages, binding serial ports, running programs and viewing data. This section takes ubuntu20.04+ros-foxy, the function package space name is WitImu_ws as an example, and the default baud rate is 9600.

1、Compile feature pack

Create a workspace WitImu_ws and create a new src folder in this directory to store the function package. Terminal input,

mkdir WitImu_ws
cd WitImu_ws
mkdir src

Then unzip the file to get the wit_ros2_imu folder, copy it to the src directory just created. Next go back to the workspace directory, use the colcon build command to compile, and enter in the terminal,

xxxxxxxxxx
cd ~/WitImu_ws
colcon build

Finally, add the path of the workspace to .bashrc. Terminal input,

xxxxxxxxxx
sudo vim ~/.bashrc
source ~/WitImu_ws/install/setup.bash #Add this sentence at the end, here my workspace is in the ~ directory, modify it according to your own workspace directory

2、Bind serial port

In order to prevent the system from identifying errors when multiple usb devices are plugged in at the same time, we bind the serial port name of the module to /dev/imu_usb. Enter the terminal,

xxxxxxxxxx
cd ~/WitImu_ws/src/wit_ros_imu
sudo chmod 777 bind_usb.sh
sudo sh bind_usb.sh

Plug and unplug the USB data cable connected to the IMU module again. To effectively bind the port, enter the following command to check whether the binding port is successful,

xxxxxxxxxx
ll /dev/imu_usb

image-20230315154057873

Note: It does not have to be ttyUSB0, as long as it is displayed as a USB device.

3、run test

Terminal input,

xxxxxxxxxx
ros2 launch wit_ros2_imu rviz_and_imu.launch.py 

image-20230315155139608

Use the “ros2 topic echo” tool to see the specific content of the published data. Terminal input,

xxxxxxxxxx
ros2 topic echo /imu/data

image-20230315155054722

4、Modify the baud rate

By default, the program uses a baud rate of 9600. If the baud rate is modified on the host computer, then the baud rate in the source code needs to be modified. The location of the source code to modify the baud rate is ~/WitImu_ws/src/wit_ros2_imu/wit_ros2_imu/ wit_ros2_imu.py

xxxxxxxxxx
#line 149
def driver_loop(self, port_name):
# open serial port
    try:
        wt_imu = serial.Serial(port="/dev/imu_usb", baudrate=9600, timeout=0.5)

Change 9600 to the baud rate modified on the host computer, then save and exit, and finally return to the workspace directory to compile.

ROS1 application case tutorial
Communication protocol

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文