# QRB-ROS-IMU
The QRB-ROS-IMU sample creates the `/imu` topic to publish the inertial measurement unit (IMU) data.
The figure shows the pipeline, which captures IMU data from the IMU hardware and publishes the ROS topic messages.

**Figure : QRB-ROS-IMU pipeline**
For information on the ROS nodes and topics used in the pipeline flow, see [Pipeline flow for QRB-ROS-IMU](https://docs.qualcomm.com/doc/80-70017-265/topic/qrb-ros-system-monitor_5_2_6.html#section-err-vxg-vbc).
## Use cases
**Prerequisites:**
- The QIRP SDK and dependencies are installed, see [Build the software](https://docs.qualcomm.com/doc/80-70017-265/topic/build-the-software_4_1.html#build-the-software-4-1) and [Flash and install](https://docs.qualcomm.com/doc/80-70017-265/topic/flash-and-install_4_3.html#flash-and-install-4-3).
- `SSH` is enabled in ‘Permissive’ mode with the steps mentioned in [Log in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh).
**Case 1: Run out-of-the-box qrb-ros-imu**
**Steps:**
1. Start two terminals, and run the following commands in each terminal to set up QIRP SDK and ROS2 environment on the device.
Value range of `ROS_DOMAIN_ID`: [0, 232]
ssh root@[ip-addr]
(ssh) mount -o remount,rw /usr
(ssh) export HOME=/home
(ssh) source /usr/share/qirp-setup.sh
(ssh) export ROS_DOMAIN_ID=xx
(ssh) source /usr/bin/ros_setup.bash
Copy to clipboard
2. In terminal 1, run the IMU ROS Node.
(ssh) ros2 run qrb_ros_imu imu_node
Copy to clipboard
3. In terminal 2, get the IMU data.
(ssh) ros2 topic echo /imu
Copy to clipboard
**Case 2: Build and run qrb-ros-imu**
**Steps:**
1. Build `qrb_ros_imu` provided by the QIRP SDK on the host.
cd [QIRP SDK path]
source setup.sh
cd qirp-samples/nodes/platform/qrb_ros_imu
export AMENT_PREFIX_PATH="${OECORE_TARGET_SYSROOT}/usr;${OECORE_NATIVE_SYSROOT}/usr"
export PYTHONPATH=${PYTHONPATH}:${OECORE_TARGET_SYSROOT}/usr/lib/python3.10/site-packages
colcon build --continue-on-error --cmake-args \
-DCMAKE_TOOLCHAIN_FILE=${OE_CMAKE_TOOLCHAIN_FILE} \
-DPYTHON_EXECUTABLE=${OECORE_NATIVE_SYSROOT}/usr/bin/python3 \
-DPython3_NumPy_INCLUDE_DIR=${OECORE_NATIVE_SYSROOT}/usr/lib/python3.10/site-packages/numpy/core/include \
-DCMAKE_MAKE_PROGRAM=/usr/bin/make \
-DBUILD_TESTING=OFF
Copy to clipboard
2. Push `qrb_ros_imu` to the device.
Note
Ensure that the QIRP SDK is installed on the device.
cd qirp-samples/nodes/platform/qrb_ros_imu/install/qrb_ros_imu
tar czvf qrb_ros_imu.tar.gz include lib share
scp qrb_ros_imu.tar.gz root@[ip-addr]:/opt
ssh root@[ip-addr]
(ssh) mount -o remount,rw /usr
(ssh) tar -zxf /opt/qrb_ros_imu.tar.gz -C /usr/
Copy to clipboard
3. Run `qrb_ros_imu` on the device by referring to [Case 1: Run out-of-the-box qrb-ros-imu](https://docs.qualcomm.com/doc/80-70017-265/topic/qrb-ros-imu_5_2_4.html#case1-ros-imu).
## Pipeline flow for QRB-ROS-IMU
Table : ROS node used in qrb-ros-imu pipeline
| ROS node | Description |
| --- | --- |
| IMU
Copy to clipboard | Publishes the `/imu` ROS topic. |
Table : ROS topic used in qrb-ros-imu pipeline
| ROS topic | Type | Published by |
| --- | --- | --- |
| /ros
Copy to clipboard |
Copy to clipboard | `IMU` node |
## Limitation
The frame rate can only be fixed values as it is limited by hardware. Custom settings are not supported.
Last Published: Dec 30, 2024
[Previous Topic
Rplidar-ros2](https://docs.qualcomm.com/bundle/publicresource/80-70017-265/topics/rplidar-ros2_5_2_3.md) [Next Topic
QRB-ROS-CAMERA](https://docs.qualcomm.com/bundle/publicresource/80-70017-265/topics/qrb-ros-camera_5_2_5.md)