imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

adi_imu

Repository Summary

Description A C++ ROS2 node that read sensor data from ADI IMU and publishes message to topic.
Checkout URI https://github.com/analogdevicesinc/imu-ros2.git
VCS Type git
VCS Version main
Last Updated 2025-04-08
Dev Status UNKNOWN
CI status No Continuous Integration
Released UNRELEASED
Tags No category tags.
Contributing Help Wanted (0)
Good First Issues (0)
Pull Requests to Review (0)

Packages

Name Version
adi_imu 0.0.1

README

adi_imu - ROS2 driver for for ADI's IMUs

::: {.contents depth=”2”} :::

Overview

Analog Devices offers a series of precision, miniature microelectromechanical system (MEMS) inertial measurement units (IMUs) that include a triaxial gyroscope and a triaxial accelerometer. Each inertial combines with signal conditioning that optimizes dynamic performance.

The factory calibration characterizes each sensor for sensitivity, bias, alignment, linear acceleration (gyroscope bias), and point of percussion (accelerometer location). As a result, each sensor has dynamic compensation formulas that provide accurate sensor measurements over a broad set of conditions.

Getting Started

To help you quickly get started with the adi_iio package, we have organized detailed documentation into several sections:

  • For information on prerequisites, repository setup, and building the package, please refer to the Using imu-ros2 repository section.
  • For information on running the adi_imu node with a local client or a remote client, please refer to the Run adi_imu node section.
  • For information on topics, parameters, and examples, please refer to the adi_imu node description section.
  • For example on how to use the adi_imu node, please refer to the Examples section.

Getting Help

  • Issue Tracker: Report bugs, request features, or submit technical queries via our Issue Tracker.
  • Further Guidance: For additional communication guidelines, refer to COMMUNICATION.

Contributing

Contributions are key to our project’s success. Before submitting changes:

  • Familiarize yourself with our code and testing conventions.
  • Consult the CONTRIBUTING.md for detailed instructions.
  • Ensure your code adheres to our design values and guidelines.

License

This project is licensed under the Apache License, Version 2.0 LICENSE.

Changelog

Refer to our CHANGELOG file for version history and release notes.

Supported Devices

Applications

  • Navigation, stabilization, and instrumentation
  • Unmanned and autonomous vehicles
  • Smart agriculture and construction machinery
  • Factory/industrial automation, robotics
  • Virtual/augmented reality
  • Internet of Moving Things

Using imu-ros2 repository

This repository implements a ROS2 node that reads data from ADI IMU devices and publishes the read data on various topics. The node is also able to configure the IMU devices.

Prerequisites

imu-ros2 can be used with ROS2 humble distribution. To install it you may follow the documentation available here: https://docs.ros.org/en/humble/Installation.html

imu-ros2 is using LibIIO v0.25. To install LibIIO you may follow the documentation available here: https://wiki.analog.com/resources/tools-software/linux-software/libiio

imu-ros2 is compatible with adis16475 Linux Kernel Driver which can be found here: https://github.com/torvalds/linux/blob/master/drivers/iio/imu/adis16475.c

Evaluation setup - Required hardware with remote client

The image below shows the information flow from the IMU up to the adi_imu node when using a remote client.

{.align-center width=”721px”}

Evaluation setup - Required hardware with local client

The image below shows the information flow from the IMU up to the adi_imu node when using a local client.

{.align-center width=”401px”}

Build adi_imu from sources

If you are not using this node in an existing project, create a new folder ros2_ws, then create the src folder in ros2_ws. Go to src folder (either in ros2_ws or in your project), and clone the adi_imu repository:

``` {.sourceCode .bash} git clone https://github.com/analogdevicesinc/imu-ros2.git


Go back to your main project folder or ros2\_ws folder and export the
following environment variable, based on the IMU chip:


``` {.sourceCode .bash}
export DEVICE_ID={IMU_chip}

IMU_chip available options are:
adis16465-1, adis16465-2, adis16465-3,
adis16467-1, adis16467-2, adis16467-3,
adis16470,
adis16475-1, adis16475-2, adis16475-3,
adis16477-1, adis16477-2, adis16477-3,
adis16500,
adis16501,
adis16505-1, adis16505-2, adis16505-3,
adis16507-1, adis16507-2, adis16507-3,
adis16545-1, adis16545-2, adis16545-3,
adis16547-1, adis16547-2, adis16547-3,
adis16575-2, adis16575-3,
adis16576-2, adis16576-3,
adis16577-2, adis16577-3.

In order select adis16505-2 IMU, run the following command:

``` {.sourceCode .bash} export DEVICE_ID=adis16505-2


After DEVICE\_ID variable is exported, run the following command:


``` {.sourceCode .bash}
colcon build

Check wether the build is successful.

Run adi_imu node

Run adi_imu node with local client

If the ROS2 environment is running on the same processing unit to which the IMU is connected to (e.g. on Raspberry Pi), run the following command to start the adi_imu node:

``` {.sourceCode .bash} source install/setup.sh ros2 run adi_imu adi_imu_node


::: {.warning}
::: {.admonition-title}
Warning
:::

Please make sure you are running the commands above with sudo. LibIIO is
using debugfs to retrieve some data from the adis16475 driver, which can
only be accessed by the root user.
:::

For executing system tests, run the following commands, after the
adi\_imu node has been started:


``` {.sourceCode .bash}
source install/setup.sh
cd install/adi_imu/lib/adi_imu_test

# set measured_data_topic_selection to 0 to test VelAngTempSubscriber (not available for adis1646x)
ros2 param set /adi_imu_node measured_data_topic_selection 0
./adi_imu_test_node --gtest_filter="VelAngTempSubscriberTest*"

# set measured_data_topic_selection to 1 to test AccelGyroTempSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 1
./adi_imu_test_node --gtest_filter="AccelGyroTempSubscriberTest*"

# set measured_data_topic_selection to 2 to test ImuSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 2
./adi_imu_test_node --gtest_filter="ImuSubscriberTest*"

# set measured_data_topic_selection to 3 to test ImuFullMeasuredDataSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 3
./adi_imu_test_node --gtest_filter="ImuFullMeasuredDataSubscriberTest*"

# test ImuIdentificationSubscriber
./adi_imu_test_node --gtest_filter="ImuIdentificationSubscriberTest*"

# test ImuDiagSubscriber
./adi_imu_test_node --gtest_filter="ImuDiagSubscriberTest*"

Run adi_imu node with remote client

If the ROS2 environment is running on a different processing unit (e.g. personal computer) than the one to which the IMU is connected to (e.g. Raspberry Pi), make sure the two processing units are connected to the same network, and find out the IP address of the processing unit to which the IMU is connected to (e.g. Raspberry Pi) then run the following command to start the adi_imu node:

``` {.sourceCode .bash} source install/setup.sh ros2 run adi_imu adi_imu_node –ros-args -p iio_context_string:=”ip:’processing_unit_IP_address’”


For executing system tests, run the following commands, after the
adi\_imu node has been started:


``` {.sourceCode .bash}
source install/setup.sh
cd install/adi_imu/lib/adi_imu_test

# set measured_data_topic_selection to 0 to test VelAngTempSubscriber (not available for adis1646x)
ros2 param set /adi_imu_node measured_data_topic_selection 0
./adi_imu_test_node --gtest_filter="VelAngTempSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

# set measured_data_topic_selection to 1 to test AccelGyroTempSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 1
./adi_imu_test_node --gtest_filter="AccelGyroTempSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

# set measured_data_topic_selection to 2 to test ImuSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 2
./adi_imu_test_node --gtest_filter="ImuSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

# set measured_data_topic_selection to 3 to test ImuFullMeasuredDataSubscriber
ros2 param set /adi_imu_node measured_data_topic_selection 3
./adi_imu_test_node --gtest_filter="ImuFullMeasuredDataSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

# test ImuIdentificationSubscriber
./adi_imu_test_node --gtest_filter="ImuIdentificationSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

# test ImuDiagSubscriber
./adi_imu_test_node --gtest_filter="ImuDiagSubscriberTest*" --ros-args -p iio_context_string:="ip:'processing_unit_IP_address'"

adi_imu node description

Published topics

imufullmeasureddata topic contains acceleration, gyroscope, delta velocity, delta angle and temperature data, acquired by polling the IMU device (data ready signal is ignored). Messages are published on this topic when the measured_data_topic_selection parameter is set to

  1. This topic has the following definition:

``` {.sourceCode .bash} std_msgs/Header header geometry_msgs/Vector3 linear_acceleration geometry_msgs/Vector3 angular_velocity geometry_msgs/Vector3 delta_velocity geometry_msgs/Vector3 delta_angle float64 temperature


**imu** topic it\'s the standard imu message type as described here:
<http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/Imu.html>.
Messages are published on this topic when the
**measured\_data\_topic\_selection** parameter is set to 2. This topic
has the following definition:


``` {.sourceCode .bash}
std_msgs/Header header
    geometry_msgs/Quaternion orientation
    float64[9] orientation_covariance
    geometry_msgs/Vector3 angular_velocity
    float64[9] angular_velocity_covariance
    geometry_msgs/Vector3 linear_acceleration
    float64[9] linear_acceleration_covariance

accelgyrotempdata topic contains acceleration, gyroscope and temperature data, acquired on each data ready impulse. Messages are published on this topic when the measured_data_topic_selection parameter is set to 1. This topic has the following definition:

``` {.sourceCode .bash} std_msgs/Header header geometry_msgs/Vector3 linear_acceleration geometry_msgs/Vector3 angular_velocity float64 temperature


**velangtempdata** topic contains delta velocity, delta angle and
temperature data, acquired on each data ready impulse. Messages are
published on this topic when the **measured\_data\_topic\_selection**
parameter is set to 0. Some devices do not support publishing messages
with this type. This topic has the following definition:


``` {.sourceCode .bash}
std_msgs/Header header
    geometry_msgs/Vector3 delta_velocity
    geometry_msgs/Vector3 delta_angle
    float64 temperature

imudiagdata topic contains various diagnosis flags, Messages are published on this topic continuously.

imuidentificationdata topic contains device specific identification data. Messages are published on this topic continuously. This topic has the following definition:

``` {.sourceCode .bash} std_msgs/Header header string firmware_revision string firmware_date uint32 product_id uint32 serial_number string gyroscope_measurement_range


### Node parameters

The adi\_imu driver is using LibIIO and thus a LibIIO context should be
given when starting the node, using **iio\_context\_string** parameter.
If the parameter is not set, the default value will be used, which is
\'local:\', suitable for running the adi\_imu node on the Raspberry Pi.
If the adi\_imu node is not running on the Raspberry Pi, the parameter
should be given when starting the adi\_imu node and it should have the
following format: \'ip:rpi\_ip\_address\', where rpi\_ip\_address is the
IP address of the Raspberry Pi.

The adi\_imu driver can publish the measured data in various mode, based
on **measured\_data\_topic\_selection** parameter value, as shown below:

-   0: measured data is published on /velangtempdata topic - not
    available for adis1646x; sampling is performed on each data ready
    impulse
-   1: measured data is published on /accelgyrotempdata topic; sampling
    is performed on each data ready impulse
-   2: measured data is published on /imu topic; sampling performed on
    each data ready impulse
-   3: measured data is published on /imufullmeasureddata topic
    (default); sampling is performed by polling the data registers
    without taking into consideration the data ready impulse

### IMU parameters

The adi\_imu driver allows for IMU configuration. Not all parameters are
available for a device. See
<https://github.com/analogdevicesinc/imu-ros2/tree/main/config> for chip
specific configuration.

  -------------------------------------------------- ---------------- ----------- -------------------------------- ----------- ----------- -------------------------- --------------------- -----------
  Parameter Name                                     Parameter        Parameter   Parameter Range                  ADIS1646X   ADIS1647X   ADIS1650X                  ADIS1654X             ADIS1657X
                                                     Description      type                                                                                                                  

  accel\_calibbias\_x                                x-axis           integer     -2147483648 up to 2147483647,    Supported   Supported   Supported                  Supported             Supported
                                                     acceleration                 step 1                                                                                                    
                                                     offset                                                                                                                                 
                                                     correction                                                                                                                             

  accel\_calibbias\_y                                y-axis           integer     -2147483648 up to 2147483647,    Supported   Supported   Supported                  Supported             Supported
                                                     acceleration                 step 1                                                                                                    
                                                     offset                                                                                                                                 
                                                     correction                                                                                                                             

  accel\_calibbias\_z                                z-axis           integer     -2147483648 up to 2147483647,    Supported   Supported   Supported                  Supported             Supported
                                                     acceleration                 step 1                                                                                                    
                                                     offset                                                                                                                                 
                                                     correction                                                                                                                             

  anglvel\_calibbias\_x                              x-axis angular   integer     -2147483648 up to 2147483647,    Supported   Supported   Supported                  Supported             Supported
                                                     velocity offset              step 1                                                                                                    
                                                     correction                                                                                                                             

  anglvel\_calibbias\_y                              y-axis angular   integer     -2147483648 up to 2147483647,    Supported   Supported   Supported                  Supported             Supported
                                                     velocity offset              step 1                                                                                                    
                                                     correction                                                                                                                             

  filter\_low\_pass\_3db\_frequency                  Low pass 3db     integer     10, 20, 70, 80, 164, 360, 720    Supported   Supported   Supported                  Possible values: 100  Supported
                                                     frequency                                                                                                        or 300                

  sampling\_frequency                                Device sampling  double      1.0 up to max                    max =       max =       max = 2000.0               max = 4250.0          max =
                                                     frequency                                                     2000.0      2000.0                                                       4000.0

  linear\_acceleration\_compensation                 Linear           integer     0 up to 1, step 1                Supported   Supported   Supported                  Not Supported         Supported
                                                     acceleration                                                                                                                           
                                                     compensation                                                                                                                           
                                                     enable/disable                                                                                                                         

  point\_of\_percussion\_alignment                   Point of         integer     0 up to 1, step 1                Supported   Supported   Supported                  Supported             Supported
                                                     percussion                                                                                                                             
                                                     alignment                                                                                                                              
                                                     enable/disable                                                                                                                         

  bias\_correction\_time\_base\_control              Time base        integer     0 up to 12, step 1               Supported   Supported   Not Supported              Supported             Supported
                                                     control                                                                                                                                

  x\_axis\_accelerometer\_bias\_correction\_enable   x-axis           integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     accelerometer                                                                                                                          
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  y\_axis\_accelerometer\_bias\_correction\_enable   y-axis           integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     accelerometer                                                                                                                          
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  z\_axis\_accelerometer\_bias\_correction\_enable   z-axis           integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     accelerometer                                                                                                                          
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  x\_axis\_gyroscope\_bias\_correction\_enable       x-axis gyroscope integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  y\_axis\_gyroscope\_bias\_correction\_enable       y-axis gyroscope integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  z\_axis\_gyroscope\_bias\_correction\_enable       z-axis gyroscope integer     0 up to 1, step 1                Supported   Supported   Not Supported              Supported             Supported
                                                     bias correction                                                                                                                        
                                                     enable/disable                                                                                                                         

  command\_to\_execute                               list of          string      software\_reset,                 All         All         All commands supported,    All commands          All
                                                     available                    flash\_memory\_test,             commands    commands    except                     supported, except     commands
                                                     commands to be               flash\_memory\_update,           supported   supported   bias\_correction\_update   flash\_memory\_test   supported
                                                     executed, device             sensor\_self\_test,                                                                                       
                                                     specific                     factory\_calibration\_restore,                                                                            
                                                                                  bias\_correction\_update                                                                                  

  internal\_sensor\_bandwidth                        Internal sensor  integer     0 for wide bandwidth, 1 for 370  Not         Not         Supported                  Not Supported         Supported
                                                     bandwidth                    Hz                               Supported   Supported                                                    
  -------------------------------------------------- ---------------- ----------- -------------------------------- ----------- ----------- -------------------------- --------------------- -----------

Examples
--------

### adis1646x

**Setup**

adis1646x ROS2 driver with adis16467-1 connected to Raspberry Pi 4 Used
device-tree for adis16475 Linux driver:
<https://github.com/analogdevicesinc/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/adis16475-overlay.dts>
config.txt entries for device-tree overlay:


``` {.sourceCode .bash}
dtoverlay=adis16475
dtparam=device="adi,adis16467-1"
dtparam=drdy_gpio25

The image below shows how the adis16467-1 device is connected to Raspberry Pi 4 using EVAL-ADISIMU1-RPIZ using Mounting Slot I with P7 Connector:

ADIS16467-1 with RPI4{.align-center}

Topic list

``` {.sourceCode .bash} ➜ ros2 topic list /accelgyrotempdata /imu /imudiagdata /imufullmeasureddata /imuidentificationdata


**Parameter list**


``` {.sourceCode .bash}
➜ ros2 param list adi_imu_node
accel_calibbias_x
accel_calibbias_y
accel_calibbias_z
anglvel_calibbias_x
anglvel_calibbias_y
anglvel_calibbias_z
bias_correction_time_base_control
command_to_execute
filter_low_pass_3db_frequency
iio_context_string
linear_acceleration_compensation
measured_data_topic_selection
point_of_percussion_alignment
sampling_frequency
x_axis_accelerometer_bias_correction_enable
x_axis_gyroscope_bias_correction_enable
y_axis_accelerometer_bias_correction_enable
y_axis_gyroscope_bias_correction_enable
z_axis_accelerometer_bias_correction_enable
z_axis_gyroscope_bias_correction_enable

Parameter dump

``` {.sourceCode .bash} ➜ ros2 param dump /adi_imu_node /adi_imu_node: ros__parameters: accel_calibbias_x: 0 accel_calibbias_y: 0 accel_calibbias_z: 0 anglvel_calibbias_x: 0 anglvel_calibbias_y: 0 anglvel_calibbias_z: 0 bias_correction_time_base_control: 10 command_to_execute: no_command filter_low_pass_3db_frequency: 720 iio_context_string: ip:192.168.0.1 linear_acceleration_compensation: 1 measured_data_topic_selection: 3 point_of_percussion_alignment: 1 sampling_frequency: 2000.0 x_axis_accelerometer_bias_correction_enable: 0 x_axis_gyroscope_bias_correction_enable: 1 y_axis_accelerometer_bias_correction_enable: 0 y_axis_gyroscope_bias_correction_enable: 1 z_axis_accelerometer_bias_correction_enable: 0 z_axis_gyroscope_bias_correction_enable: 1


**Topic echo accelgyrotempdata**


``` {.sourceCode .bash}
➜ ros2 param set /adi_imu_node measured_data_topic_selection 1
Set parameter successful
➜ ros2 topic echo accelgyrotempdata
header:
        stamp:
                sec: 1698751163
                nanosec: 610640655
        frame_id: accelgyrotempdata
linear_acceleration:
        x: -0.12255231999999999
        y: 0.49020927999999997
        z: 10.245373952
angular_velocity:
        x: 0.0077987840000000004
        y: -0.008912896
        z: 0.0023592960000000003
temperature: 37.9
---
header:
        stamp:
                sec: 1698751163
                nanosec: 611141470
        frame_id: accelgyrotempdata
linear_acceleration:
        x: 0.036765696
        y: 0.47795404799999996
        z: 10.147332096
angular_velocity:
        x: 0.0057671680000000005
        y: -0.006553600000000001
        z: 0.0
temperature: 37.9

Topic echo imu

``` {.sourceCode .bash} ➜ ros2 param set /adi_imu_node measured_data_topic_selection 2 Set parameter successful ➜ ros2 topic echo imu header: stamp: sec: 1698746841 nanosec: 951239970 frame_id: imu orientation: x: 0.0 y: 0.0 z: 0.0 w: 1.0 orientation_covariance: -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 angular_velocity: x: -0.0021626880000000003 y: -0.005046272 z: -0.0015728640000000002 angular_velocity_covariance: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 linear_acceleration: x: -0.073531392 y: 0.0 z: 9.98801408 linear_acceleration_covariance: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0


**Topic echo imufullmeasureddata**


``` {.sourceCode .bash}
➜ ros2 param set /adi_imu_node measured_data_topic_selection 3
Set parameter successful
➜ ros2 topic echo imufullmeasureddata
header:
        stamp:
                sec: 1698747556
                nanosec: 755176752
        frame_id: imufullmeasureddata
linear_acceleration:
        x: 0.06316448599999999
        y: 0.04266031
        z: 9.86933827
angular_velocity:
        x: -0.000793858
        y: -0.001786835
        z: -0.0019665010000000003
delta_velocity:
        x: 2.3436e-05
        y: 8.184e-06
        z: 0.004929186
delta_angle:
        x: 2.7e-07
        y: -1.28e-06
        z: -5.96e-07
temperature: 41.0
---
header:
        stamp:
                sec: 1698747556
                nanosec: 760426222
        frame_id: imufullmeasureddata
linear_acceleration:
        x: 0.003555244
        y: 0.008432765
        z: 9.839817141
angular_velocity:
        x: 4.0902e-05
        y: -0.003819203
        z: -0.0019095020000000002
delta_velocity:
        x: 1.6926e-05
        y: -3.348e-06
        z: 0.004927512
delta_angle:
        x: 1.98e-07
        y: -1.356e-06
        z: -1.092e-06
temperature: 41.0

Topic echo imuidentificationdata

``` {.sourceCode .bash} ➜ ros2 topic echo /imuidentificationdata header: stamp: sec: 1698747693 nanosec: 960557599 frame_id: imuidentificationdata firmware_revision: ‘1.6’ firmware_date: 08-29-2017 product_id: 16467 serial_number: 107 gyroscope_measurement_range: +/-125_degrees_per_sec


**Topic echo imudiagdata**


``` {.sourceCode .bash}
➜ ros2 topic echo /imudiagdata
header:
        stamp:
                sec: 1698747757
                nanosec: 309115737
        frame_id: imudiagdata
diag_data_path_overrun: false
diag_flash_memory_update_error: false
diag_spi_communication_error: false
diag_standby_mode: false
diag_sensor_self_test_error: false
diag_flash_memory_test_error: false
diag_clock_error: false
diag_flash_memory_write_count_exceeded_error: false
flash_counter: 14

adis1650x

Setup

adis1650x ROS2 driver with adis16505-2 connected to Raspberry Pi 4 using a ribbon cable Used device-tree for adis16475 Linux driver: https://github.com/analogdevicesinc/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/adis16475-overlay.dts config.txt entries for device-tree overlay:

``` {.sourceCode .bash} dtoverlay=adis16475 dtparam=device=”adi,adis16505-2”


The image below shows how the adis16467-1 device is connected to
Raspberry Pi 4 using EVAL-ADISIMU1-RPIZ using Mounting Slot I with P7
Connector:

![ADIS16505-2 with RPI4](doc/images/adis16505_2_rpi.jpg){.align-center}

**Topic list**


``` {.sourceCode .bash}
➜ ros2 topic list
/accelgyrotempdata
/imu
/imudiagdata
/imufullmeasureddata
/imuidentificationdata
/velangtempdata

Parameter list

``` {.sourceCode .bash} ➜ ros2 param list adi_imu_node accel_calibbias_x accel_calibbias_y accel_calibbias_z anglvel_calibbias_x anglvel_calibbias_y anglvel_calibbias_z command_to_execute filter_low_pass_3db_frequency iio_context_string internal_sensor_bandwidth linear_acceleration_compensation measured_data_topic_selection point_of_percussion_alignment sampling_frequency


**Parameter dump**


``` {.sourceCode .bash}
➜ ros2 param dump /adi_imu_node
/adi_imu_node:
        ros__parameters:
                accel_calibbias_x: 0
                accel_calibbias_y: 0
                accel_calibbias_z: 0
                anglvel_calibbias_x: 0
                anglvel_calibbias_y: 0
                anglvel_calibbias_z: 0
                command_to_execute: no_command
                filter_low_pass_3db_frequency: 720
                iio_context_string: ip:192.168.0.1
                internal_sensor_bandwidth: 0
                linear_acceleration_compensation: 1
                measured_data_topic_selection: 3
                point_of_percussion_alignment: 1
                sampling_frequency: 2000.0

Topic echo velangtempdata

``` {.sourceCode .bash} ➜ ros2 param set /adi_imu_node measured_data_topic_selection 0 Set parameter successful ➜ ros2 topic echo velangtempdata header: stamp: sec: 1698753051 nanosec: 211437438 frame_id: velangtempdata delta_velocity: x: 0.0 y: 0.0 z: 0.003014656 delta_angle: x: -0.000393216 y: 0.0 z: 0.0 temperature: 32.7 — header: stamp: sec: 1698753051 nanosec: 212438253 frame_id: velangtempdata delta_velocity: x: 0.0 y: 0.0 z: 0.003014656 delta_angle: x: -0.000393216 y: 0.0 z: -0.000393216 temperature: 32.7


**Topic echo accelgyrotempdata**


``` {.sourceCode .bash}
➜ ros2 param set /adi_imu_node measured_data_topic_selection 1
Set parameter successful
➜ ros2 topic echo accelgyrotempdata
header:
        stamp:
                sec: 1698752813
                nanosec: 865099477
        frame_id: accelgyrotempdata
linear_acceleration:
        x: 1.513095168
        y: 6.326386688
        z: 7.5776
angular_velocity:
        x: -0.012189696
        y: 0.009437184
        z: 0.001572864
temperature: 32.6
---
header:
        stamp:
                sec: 1698752813
                nanosec: 865597207
        frame_id: accelgyrotempdata
linear_acceleration:
        x: 1.522794496
        y: 6.1833216
        z: 7.616397312
angular_velocity:
        x: -0.017301504
        y: 0.009437184
        z: 0.001179648
temperature: 32.6

Topic echo imu

``` {.sourceCode .bash} ➜ ros2 param set /adi_imu_node measured_data_topic_selection 2 Set parameter successful ➜ ros2 topic echo imu


> header:
>
> :   
>
>     stamp:
>
>     :   sec: 1698752385 nanosec: 697059208
>
>     frame\_id: imu
>
> orientation:
>
> :   x: 0.0 y: 0.0 z: 0.0 w: 1.0
>
> orientation\_covariance:
>
> :   -1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
>
> angular\_velocity:
>
> :   x: -0.022413312 y: 0.005111808 z: 0.003538944
>
> angular\_velocity\_covariance:
>
> :   0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
>
> linear\_acceleration:
>
> :   x: 1.52764416 y: 4.917559296 z: 7.866155008
>
> linear\_acceleration\_covariance:
>
> :   0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
>
**Topic echo imufullmeasureddata**


``` {.sourceCode .bash}
➜ ros2 param set /adi_imu_node measured_data_topic_selection 3
Set parameter successful
➜ ros2 topic echo imufullmeasureddata
header:
        stamp:
                sec: 1698752480
                nanosec: 32117474
        frame_id: imufullmeasureddata
linear_acceleration:
        x: 1.498841658
        y: 5.758833587
        z: 7.699544637
angular_velocity:
        x: 0.0180183
        y: 0.006585252
        z: -0.003338532
delta_velocity:
        x: 0.000749064
        y: 0.002869894
        z: 0.003841414
delta_angle:
        x: 1.1514e-05
        y: 4.05e-06
        z: -2.0039999999999998e-06
temperature: 32.1
---
header:
        stamp:
                sec: 1698752480
                nanosec: 47051862
        frame_id: imufullmeasureddata
linear_acceleration:
        x: 1.500955246
        y: 5.752098773
        z: 7.669287517
angular_velocity:
        x: 0.014685954
        y: 0.008353032
        z: 0.000134526
delta_velocity:
        x: 0.000747822
        y: 0.002868008
        z: 0.003832168
delta_angle:
        x: 7.824e-06
        y: 4.956e-06
        z: -1.488e-06
temperature: 32.2

Topic echo imuidentificationdata

``` {.sourceCode .bash} ➜ ros2 topic echo /imuidentificationdata header: stamp: sec: 1698752760 nanosec: 145522368 frame_id: imuidentificationdata firmware_revision: ‘1.6’ firmware_date: 06-27-2019 product_id: 16505 serial_number: 1208 gyroscope_measurement_range: +/-500_degrees_per_sec


**Topic echo imudiagdata**


``` {.sourceCode .bash}
➜ ros2 topic echo /imudiagdata
header:
        stamp:
                sec: 1698752709
                nanosec: 500543873
        frame_id: imudiagdata
diag_data_path_overrun: false
diag_flash_memory_update_error: false
diag_spi_communication_error: false
diag_standby_mode: false
diag_sensor_self_test_error: false
diag_flash_memory_test_error: false
diag_clock_error: false
diag_acceleration_self_test_error: false
diag_gyroscope1_self_test_error: false
diag_gyroscope2_self_test_error: false
diag_flash_memory_write_count_exceeded_error: false
flash_counter: 22

Using adi_imu node with imu-tools

imu-ros2 repository offers a launch file which can be used to visualize in rviz the imu filtered data, using a Madgwick filter implemented in imu-tools ros package. Below you may find the steps to achieve this, assuming imu-ros2 sources and dependencies are already available.

First install imu-tools and rviz2 packages:

``` {.sourceCode .bash} ➜ sudo apt-get install ros-humble-imu-tools ros-humble-rviz2


Identify the IP address of the processing unit to which the IMU is
connected to (e.g. Raspberry Pi) then update the iio\_context\_string in
launch/imu\_with\_madgwick\_filter\_rviz.launch.py:


``` {.sourceCode .bash}
adi_imu_node = launch_ros.actions.Node(
        package='adi_imu',
        executable='adi_imu_node',
        parameters=[{'measured_data_topic_selection': 2},
                # the IP address of the processing unit to which the IMU is connected to
                {'iio_context_string': "ip:192.168.0.1"},],
        remappings=[('/imu','/imu/data_raw')],
        output='screen'
        )

Rebuild imu-ros2 package:

``` {.sourceCode .bash} colcon build


Then launch the imu\_with\_madgwick\_filter\_rviz.launch file:


``` {.sourceCode .bash}
source install/setup.sh
ros2 launch adi_imu imu_with_madgwick_filter_rviz.launch.py

IMU and TOF sensor fusion

imu-ros2 repository offers a launch file which can be used to visualize in rviz the ToF point cloud fused with imu filtered data. Below you may find the steps to achieve this, assuming imu-ros2 sources and dependencies are already available.

First install imu-tools and rviz2 packages:

``` {.sourceCode .bash} ➜ sudo apt-get install ros-humble-imu-tools ros-humble-rviz2


Secondly install tof-ros2 package by following the steps from:
<https://github.com/analogdevicesinc/tof-ros2#readme>

Identify the IP address of the processing unit to which the IMU is
connected to (e.g. Raspberry Pi) then update the iio\_context\_string in
launch/imu\_tof\_fusion.launch.py:


``` {.sourceCode .bash}
adi_imu_node = launch_ros.actions.Node(
        package='adi_imu',
        executable='adi_imu_node',
        parameters=[{'measured_data_topic_selection': 2},
                # the IP address of the processing unit to which the IMU is connected to
                {'iio_context_string': "ip:192.168.0.1"},],
        remappings=[('/imu','/imu/data_raw')],
        output='screen'
        )

Rebuild imu-ros2 package:

``` {.sourceCode .bash} colcon build


Then launch the imu\_tof\_fusion.launch file:


``` {.sourceCode .bash}
source install/setup.sh
ros2 launch adi_imu imu_tof_fusion.launch.py

CONTRIBUTING

Contributing Guidelines

Thank you for your interest in contributing to imu-ros2. Whether it’s a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community.

Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.

Table of Contents:

How to Contribute

Contributing source code

We follow a development process designed to reduce errors, encourage collaboration, and make high quality code. Review the following to get acquainted with this development process.

How to Contribute Source Code

  • Create a fork of this repository. This will create your own personal copy of the package. All of your development should take place in your fork. If you are not sure how to do this, check out GitHub help

    • Create a create a remote pointing to the upstream remote repository.

    • Work out of a new branch, one that is not a release main branch, ideally a develop branch targeted for the currently supported ROS distribution, such as humble-develop. Remember to periodically rebase to have the latest code available.

  • Write your code and remember to:
    • Always keep your branch updated with the original upstream.
    • Always sign-off you commits.
    • Look at the existing code and try to maintain the existing style and pattern as much as possible.
  • Resolve compiler warnings or at least make sure you code does not add new ones.

  • Submit a pull request to the upstream repository following the PR rules.

  • Check Continuous Integration (CI): the moment you submit a pul request, a few jobs will be started which try to compile the code and run automated tests. Pay attention to any CI failures reported in the pull request, and stay involved in the conversation. On the Github UI, checks can be:
    • ✅: Passed, all good!
    • 🟡: Pending, results haven’t been received yet.
    • ❌: Failed, something is wrong.

Pull Request Rules

  • Commit message includes a Signed-off-by: [name] < email > to the commit message. This ensures you have the rights to submit your code, by agreeing to the Developer Certificate of Origin. If you can not agree to the DCO, don’t submit a pull request, as we can not accept it.
    • DCO is a declaration of ownership, basically saying that you created the contribution and that it is suitable to be covered under an open source license (not proprietary).

    • If your user.name and user.email configurations are set up in git, then you can simply run git commit -signoff to have your signature automatically appended.

  • Commit should be atomic, meaning it should do one thing only. A pull request may contain multiple commits if necessary to fix a bug or implement a feature.
  • Commits should have good commit messages. Check out The git book for some pointers and tools to use.
  • Typically, the title of the commit should have the path to the changed dir/[file], and then explaining in a few words what has been done, like: ci: add style check workflow for cpp files
  • Write a concise PR description, containing all the needed details.
  • Pull requests will be merged only after they have been reviewed, tested and approved by the code owners.

Bug reports

Before Submitting a Bug Report

Before creating a new issue, please search the repository’s open and recently closed issues to see if the same or a similar problem has already been reported. If the issue exists and is still open, add a comment to that issue. Otherwise, feel free to create a new one.

How to Submit a Good Bug Report

To help us resolve issues effectively, follow these guidelines when creating a bug report:

  1. Use a clear and descriptive title to summarize the problem.
  2. Describe the exact steps to reproduce the issue in detail. Provide enough information for someone to follow your steps exactly.
  3. Include specific examples such as links to files, projects, or copy-pasteable snippets that demonstrate the issue.
  4. Describe the observed behavior after performing the steps and explain what the problem is with that behavior.
  5. Explain the expected behavior and why it differs from the observed behavior.
  6. Attach screenshots or GIFs to visually demonstrate the issue whenever possible.
  7. If the issue wasn’t triggered by a specific action, describe what you were doing before the problem occurred and include relevant details.

Provide more background by answering the following questions:

  • Did the issue start recently (e.g., after updating to a new version) or has it always been present?
  • If recent, can you reproduce the issue in an older version? Specify the most recent version where the issue does not occur.
  • Is the issue consistently reproducible? If not, describe the frequency and conditions under which it happens.

Configuration and environment details: include the following information in your report:

  • Version of adi_imu you’re using.
  • Operating system name and version.
  • Details about system-level dependencies and their compatibility.

By providing this information, you’ll help us understand and address the issue more efficiently.

Feature Requests

This guide will help you submit enhancement suggestions, including new features or improvements to existing functionality. Following these guidelines ensures maintainers and the community can understand your suggestion and identify related ideas.

Before Submitting an Enhancement Suggestion

  • Ensure you’re using the latest software version; newer versions may already include your desired feature.
  • Check if an existing library provides the functionality you’re requesting.

How to Submit a Good Enhancement Suggestion

Enhancement suggestions are tracked as GitHub issues. After determining the relevant repository, create an issue and include the following details:

  1. Use a clear and descriptive title to summarize the suggestion.
  2. Describe the suggested enhancement in detail, providing a step-by-step explanation of how it should work.
  3. Provide specific examples to illustrate your suggestion, including code snippets as Markdown code blocks.
  4. Describe the current behavior and explain the desired behavior, including why the change would be beneficial.
  5. Attach screenshots or GIFs to visually explain your suggestion, if applicable.
  6. Justify why this enhancement would benefit most users and explain why it shouldn’t be implemented as a separate application.
  7. Include version details:
    • Version of the repository you’re using.
    • Name and version of your operating system.

By following these steps, you’ll help ensure your suggestion is well-understood and can be considered effectively.

Contributing documentation

Thank you for your interest in contributing to the project’s documentation! For an in-depth understanding of the documentation system’s design and structure, refer to the Documentation Guidelines

Documentation Best Practices

We follow the documentation guidelines outlined in Analog Devices Documentation Guidelines. Please review these guidelines to ensure consistency and quality in your contributions.

Becoming a Trusted Committers

Becoming a Trusted Committer is about consistently contributing value to the project and supporting its community. Here are some suggestions to help you grow into this role:

  1. Contribute Regularly: Submit high-quality contributions, including code, documentation, and reviews, that align with the project’s standards and best practices.

  2. Collaborate Actively: Engage positively with maintainers and contributors by participating in discussions, offering constructive feedback, and fostering a collaborative environment.

  3. Follow Best Practices: Adhere to the project’s coding, documentation, and contribution guidelines to set a strong example for others.

  4. Be Responsive: Actively review pull requests, respond to issues, and assist other contributors in a timely and respectful manner.

  5. Take Ownership: Show initiative by taking responsibility for specific areas of the project, ensuring their quality, maintenance, and alignment with project goals.

Licensing

Any contribution that you make to this repository will be under the Apache 2 License, as dictated by that license:

5. Submission of Contributions. Unless You explicitly state otherwise,
   any Contribution intentionally submitted for inclusion in the Work
   by You to the Licensor shall be under the terms and conditions of
   this License, without any additional terms or conditions.
   Notwithstanding the above, nothing herein shall supersede or modify
   the terms of any separate license agreement you may have executed
   with Licensor regarding such Contributions.

Resources:


imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository

imu-ros2 repository