Universal ROS2 Driver for the IMUs
- Crossbow AHRS 400
- Microstrain GX1
- Microstrain GX2 USB
- Microstrain GX2 Wireless
- Microstrain GX5 25
- Microstrain GX5 45
- Sparkfun Razor M0: Modified firmware: https://github.com/jage92/9DOF_Razor_IMU
This driver has been developed using a universal architecture to acquire and publish sensory data. In this instance, its implementation is oriented towards inertial measurement units (IMU), although this architecture can be applied to other types of devices, whether unisensory or multisensory. The objective is to establish a typical architecture for acquiring data from sensory devices. It has been implemented through ROS2, but it is designed to be compatible with any other framework. The architecture follows the above REPs:
The read sensor measures are published on different topics:
- imu/data_raw: publishes the raw sensor measures of the acceleration and angular velocity of the IMU.
- imu/mag_raw: publishes the raw magnetometer measures of the magnetic field.
- imu/data_scaled: publishes the scaled sensor measures of the acceleration, angular velocity, and orientation.
- imu/mag_scaled: publishes the scaled sensor measures of the magnetic field.
- imu/data_no_gravity: publishes the best quality sensor measures of the acceleration without gravity component, angular velocity, and orientation.
- imu/data_stabilized: publishes the stabilized sensor measures of the acceleration, angular velocity, and orientation.
- imu/mag_scaled: publishes the stabilized sensor measures of the magnetic field.
- imu/data_filtered: publishes the filtered sensor measures of the acceleration, angular velocity, and orientation.
- imu/mag_filtered: publishes the filtered sensor measures of the magnetic field.
- imu/delta_vel: publishes the increment of the time integral of the acceleration.
- imu/delta_ang: publishes the increment of the time integral of the angular velocity.
- imu/data_madgwick: publishes the best quality sensor measures of the acceleration, angular velocity, and orientation obtained with the madgwick filter implemented in this project.
- imu/data_kalman: publishes the best quality sensor measures of the acceleration, angular velocity, and orientation obtained with the Kalman Filter implemented in this project.
- imu/mag_calibrated: publishes the calibrated sensor measures of the magnetic field. The calibration algorithm is implemented in this repository.
- gps/fix: publishes latitude, logitude and altitude data.
- gps/ecef: published the devide global position in ECEF reference system.
- gps/vel_ned: publishes the device linear velocity in the NED reference frame.
- gps/vel_ecef: publishes the device linear velocity in the ECEF reference frame.
- gps/fix_filtered: publishes the filtered device latitude, longitude and altitude.
- gps/vel_ned_filtered: publishes the filtered device linear velocity in the NED reference frame.
** The activation of these topics depends on the parameters and the capacities of the IMU devices.
There are three services:
- captureBias: captures the gyros bias. The device must be static. The bias is always captured when the sensor starts up.
- publish_tf: activate or deactivate the publisher of the IMU TF WRT, which is an ENU/NED reference frame called the world.
- poll: activate the poll mode and poll the imu.
- continuous: activate continuous mode.
- start_internal_calibrate: starts the magnetometer calibration using the device's internal algorithm, if it has. When active, the device captures data up to the calibration is stopped.
- stop_internal_calibrate: stops the magnetometer internal calibration, and the driver returns to work as when the calibration was started.
- start_custom_calibrate: starts the magnetometer calibration using the driver calibration algorithm. When active, the driver captures data up to the calibration is stopped.
- stop_custom_calibrate: stops the magnetometer driver calibration, and it returns to work as when the calibration was started.
The driver can be configured with different parameters that allow users to use it as they need.
- comm_strategy: allows the selection of the communication strategy of the used device. The communication strategies are:
- 0: UART
- 1: TCP/IP
- 2: SDK
- serial_port: serial port to read IMU data. It is only used when the communication strategy is 0.
- baudrate: the speed at which data is transmitted using the UART communication strategy.
- ip: IP address used in TCP/IP communication strategy.
- network_port: port used in the network communication strategy.
- ahrs_frequency: AHRS data poll frequency in Herzs. It is the frequency of the timer that polls AHRS data.
- gnss_frequency: GNSS data poll frequency in Herzs. It is the frequency of the timer that polls GNSS data.
- imu_time: if True driver uses the internal device clock to get the data timestamp. If False driver uses the ROS2 time.
- poll_mode: if True, the driver works in poll mode. The data is requested with the
pollservice. If False, the driver works in continuous mode atgnss_frequencyandahrs_frequency. - broadcast_tf: if True, the node publishes the IMU TF with respect to the ENU frame called
base_frame. - frame_id: name of the device's local frame.
- base_frame: name of the device base frame.
- use_enu_frame: if true, the IMU data is published with respect to the ENU reference frame. The IMU printed frame does not correspond in this case. If false, the NED reference frame is used and corresponds with the IMU printed frame.
- tf_translation: translation point with respect to the
base_frame. - scaled_lin_acc_cov: covariance matrix of the scaled linear acceleration.
- scaled_ang_vel_cov: covariance matrix of the scaled angular velocity.
- stabilized_lin_acc_cov: Covariance matrix of the stabilized linear acceleration.
- stabilized_ang_vel_cov: Covariance matrix of the stabilized angular velocity.
- filtered_lin_acc_cov: Covariance matrix of the filtered linear acceleration.
- filtered_ang_vel_cov: Covariance matrix of the filtered angular velocity.
- scaled_mag_cov: Covariance matrix of the scaled magnetic field.
- stabilized_mag_cov: Covariance matrix of the stabilized magnetic field.
- filtered_mag_cov: Covariance matrix of the filtered magnetic field.
- stabilized_orientation_cov: Covariance matrix of the stabilized orientation.
- scaled_orientation_cov: Covariance matrix of the scaled orientation.
- filtered_orientation_cov: Covariance matrix of the filtered orientation.
- madgwick_ang_vel_cov: Covariance matrix of the best quality angular velocity data.
- madgwick_lin_acc_cov: Covariance matrix of the best quality linear acceleration data.
- madgwick_orient_cov: Covariance matrix of the orientation using the Madgwick filter.
- kalman_ang_vel_cov: Covariance matrix of the best quality angular velocity data.
- kalman_lin_acc_cov: Covariance matrix of the best quality linear acceleration data.
- kalman_orient_cov: Covariance matrix of the orientation using the Kalman filter.
- kalman_mag_cov: Covariance matrix of the calibrated magnetic field.
- calibrated_mag_cov: Covariance matrix of the calibrated magnetic field.
- lin_acc_cov_no_grav: Covariance matrix of the linear acceleration with the gravitational component removed.
- ang_vel_cov_no_grav: Covariance matrix of the angular velocity with the gravitational component removed.
- orientation_cov_no_grav: Covariance matrix of the orientation with the gravitational component removed.
- raw_imu_data: if true, the node publishes in the topic
imu/data_rawthe accelerometer and angular velocity raw data - raw_mag_data: If true, the node publishes the raw magnetic field data in the topic
imu/mag_raw. - scaled_imu_data: If true, the node publishes the scaled accelerometer and angular velocity data in the topic
imu/data_scaled. - stabilized_imu_data: If true, the node publishes the stabilized accelerometer and angular velocity data in the topic
imu/data_stabilized. - filtered_imu_data: If true, the node publishes the filtered accelerometer and angular velocity data in the topic
imu/data_filtered. - scaled_mag_data: If true, the node publishes the scaled magnetic field data in the topic
imu/mag_scaled. - stabilized_mag_data: If true, the node publishes the stabilized magnetic field data on the topic
imu/mag_stabilized. - filtered_imu_data: If true, the node publishes the filtered accelerometer and angular velocity data in the topic
imu/data_filtered. - scaled_orient_data: If true, the node publishes the scaled orientation data in the topic
imu/data_scaled. - stabilized_orient_data: If true, the node publishes the stabilized orientation data in the topic
imu/data_stabilized. - filtered_orient_data: If true, the node publishes the filtered orientation data in the topic
imu/data_filtered. - madgwick_data: If true, the node publishes the topic
imu/data_madgwick, which is processed using the Madgwick filter. - kalman_data: If true, the node publishes the topic
imu/data_kalman, which is processed using the Kalman filter. - calibrated_mag_data: If true, the node publishes the calibrated magnetic field data in the topic
imu/mag_calibrated. - no_gravity_data: If true, the node publishes the accelerometer and angular velocity data on the topic
imu/data_no_gravitywith the gravitational component removed. - delta_data: If true, the node publishes the delta data on topics
imu/delta_velandimu/delta_ang. - positionLLH: If true, the node publishes in the topic
gps/fixthe position data in Latitude, Longitude, and Height coordinates. - positionECEF: If true, the node publishes the position data in Earth-Centered, Earth-Fixed coordinates in the topic
gps/ecef. - NEDVelocity: If true, the node publishes in the topic
gps/vel_nedthe velocity data in North, East, and Down coordinates. - ECEFVelocity: If true, the node publishes in the topic
gps/vel_ecefthe velocity data in ECEF reference system. - filtered_positionLLH: If true, the node publishes in the topic
gps/fix_filteredthe filtered position data in Latitude, Longitude, and Height coordinates. - filtered_NEDVelocity: If true, the node publishes in the topic
gps/vel_ned_filteredthe filtered position data in Earth-Centered, Earth-Fixed coordinates. - offset_file: path to the autogenerated file when the driver magnetometer calibration is executed. The file contains the hard and soft iron offsets.
- gain: This parameter, also called β, is the gain parameter and is crucial for adjusting the speed and stability of the Madgwick filter.
- zeta: This parameter, also called ζ, is a correction term used to compensate for drift errors in the angular velocity, that is, errors that accumulate over time due to the integration of the gyroscope's rotation rate. This parameter is particularly useful for applications where the gyroscopes have a bias that can accumulate and degrade the accuracy of the orientation estimation.
- mag_reference: Three-element vector representing the reference magnetic field values (once calibrated) when the X-axis of the device points to magnetic north, with pitch and roll 0.
Devices can have specific configurations. To do this, the driver has sensor parameters organized by data types. The data types are boolean, integer, double, string, double list, and string list. Each type has a param list with the name of the above params. See config YAML files as reference.
To check the working rate of the IMU it is possible to use the /diagnostics topic.
The driver has diagnostics and self-test methods implemented.
To make a node test, use:
or
ros2 service call /self_test diagnostic_msgs/srv/SelfTest
With the node running.
Note: The wireless IMUs can saturate if the work rate is high. It possible to receive wrong data or to experiment delays.