ROS2 driver for wireless, rs232, and USB 3dmgx2 IMU from Lord Parker (formerly Microstrain)
In this version, the node has been updated to have the possibility of reading all the data (or the data that the user chooses) from the IMU. It is possible to utilize all three versions of the 3DM-GX2 which utilizes USB, RS232, or wireless methods of communication. The IMU data packet protocol that is used by the wireless IMU version has been implemented in this version. This protocol is also compatible with the USB and RS232 IMUs.
This work is based on the work of Jeremy Leibs and Blaise Gassend published in: https://github.com/ros-drivers/microstrain_3dmgx2_imu
To RUN this node it is necessary the Diagnostics package: https://github.com/jage92/diagnostics/tree/galactic-microstrain. It is recommeded to use that version.
The read sensor measures are published on different topic:
- imu/data_raw: publishes the raw sensor measures of the acceleration and angular velocity of the IMU.
- imu/data: publishes the scaled sensor measures of the acceleration, angular velocity, and orientation.
- mag: publishes the scaled sensor measures of the magnetic field
- imu/data_no_grab: publishes the scaled sensor measures of the acceleration without gravity component, angular velocity, and orientation.
- delta_velocity: publishes the increment of the time integral of the acceleration.
- delta_angle: publishes the increment of the time integral of the angular velocity.
- orientation: publishes the quaternion that represents the orientation of in the ENU/NED reference frame.
- euler: publishes the instantaneous euler angles (roll, pitch and yaw) in degrees
- imu/stab_data: publishes the acceleration and angular velocity stabilised with the internal complementary filter of the IMU.
- stab_mag: publishes the magnetic field stabilised with the internal complementary filter of the IMU.
IMU DATA follows the REP 103 ROS Covection (at rest gravity is +g when +z is upwards). Angles are right handled. Linear acceleration (without gravity) follows ROS convection REP 105, positive when when direcction is positive.
There are three services:
- add_offset: to update time offset with the IMU time.
- calibrate: to calibrate de IMU gyro and capture the bias. When the node starts it does a calibration process.
- publish_tf: activate or deactivate the publisher of the IMU TF WRT an ENU/NED reference frame called world.
- poll: activate poll mode and polls the imu.
- continuous: activate continous mode.
The node can be configured with different parameters that allow users to use the sensor as they need.
-
time_offset: defines the time offset with respect to the sensor clock
-
port: serial port to read IMU data. Although there are three versions of the 3DMGX2 (wireless, RS232, and USB) all of then use the serial port from the point of view of this node.
-
frame_id: name of the local reference frame of the IMU.
-
autocalibrate: if true the imu calibrates the gyros and obtains the bias when the node started.
-
publish_tf: if true the node publishes the IMU TF with respect to the ENU frame called world.
-
wireless_imu: if true the node uses the data packet protocol necessary to communicate with the wireless version. This protocol works with the other versions but uses more data, therefore is less efficient.
-
use_enu_frame: if true the IMU data is published with respect ENU reference frame. The IMU printed frame not corresponds in this case. If false the NED reference frame is used and corresponds with the IMU printed frame.
-
data_rate: integer value between 1 and 300 that indicates the frequency of operation of the IMU. When the frequency is high and the data read is also high the data can be corrupted and can occur delays. This behavior is more noticeable in the wireless version.
-
poll_mode: if true starts the imu in poll mode. If false starts the node in continous mode.
-
cmd_raw: if true the node publish in the topic .../imu/data_raw the accelerometer and angular velocity raw data
-
cmd_accel_angrate: if true the node publishes in the topic .../imu/data the acceleration and angular velocity
-
cmd_delvel_delang: if true the node publish in the topics .../delta_velocity and .../delta_angle the incremental data of the linear velocity and angles
-
cmd_accel_angrate_orient: if true the node publishes in the topic .../imu/data acceleration, angular velocity, and orientation
-
cmd_accel_angrate_mag_orient: if true the node publishes in the topics .../imu/data and .../mag the acceleration, angular velocity, orientation, and magnetic field
-
cmd_euler: if true the node publishes in the topic .../orientation the quaternion that represents the IMU orientation in the ENU reference system
-
cmd_gyrostab_angrate_mag: if true the node publishes in the topic .../imu/stab_data and .../stab_mag the IMU acceleration, angular velocity, and magnetic field established with its internal complementary filter
-
cmd_mag_vec: if true the node publishes in the topic .../mag the magnetic field data
NOTE: If the user activates params that generate the same data the params that generate redundant data are deactivated.
The file params_.yaml contains different interesting matrices. The covariance matrices are calculated by obtaining data with the IMU inmobile.
- tf_translation: translation vector of the IMU reference frame with respect to the ENU frame called world
- orientation_cov: covariance matrix of the covariance of the Euler angles obtained from the IMU
- ang_vel_cov: covariance matrix of the scaled angular velocity
- lin_acc_cov: covariance matrix of the scaled linear acceleration
- lin_acc_cov_no_grab: covariance matrix of the scaled linear acceleration without the gravity component
- mag_cov: covariance matrix of the scaled magnetic field vector
- stab_ang_vel_cov: covariance matrix of the stabilized angular velocity of the IMU
- stab_lin_acc_cov: covariance matrix of the stabilized linear acceleration of the IMU
- stab_mag_cov: covariance matrix of the stabilized magnetic field of the IMU
To check the working rate of the IMU it is possible to use the ../diagnostics topic.
To make a node test use:
ros2 run self_test run_selftest /self_test
or
ros2 service call /self_test diagnostic_msgs/srv/SelfTest
with the node runnig.
NOTE: The wireless IMUs can saturate if the work rate is high. It possible to receive wrong data or to experiment delays.