introlab / rtabmap

RTAB-Map library and standalone application
https://introlab.github.io/rtabmap
Other
2.61k stars 761 forks source link

Received IMU doesn't have orientation set! It is ignored #1239

Closed jenadzitsiuk closed 3 months ago

jenadzitsiuk commented 3 months ago

In rgbd_mapping I get warnings like "Received IMU doesn't have orientation set! It is ignored" This thread suggests that if the "Inter IMU" is off, then the warning goes away. And indeed, the main app (rtabmap) it works: with the box checked the warning is there. With the box unchecked it goes away.

The issue is I cannot get rid of the warning in rgbd_mapping code sample. I added this code right after the camera was created: ((CameraRealSense2*)camera)->publishInterIMU(false);

Seems that the other settings for the camera and Odometry is the same in the main rtabmap app and in "rgbd_mapping". How can I get rid of it and get the IMU orientation data?

This is what I see in the camera init log for rgbd_mapping. Its exactly same as output in the main rtabmap app

...
...
Sensor 2 "Motion Module"
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:708::init() profiles=4
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:714::init() MOTION_XYZ32F 0 0 250 0 Accel type=6
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:714::init() MOTION_XYZ32F 0 0 63 0 Accel type=6
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:714::init() MOTION_XYZ32F 0 0 400 0 Gyro type=5
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:714::init() MOTION_XYZ32F 0 0 200 0 Gyro type=5
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:970::init() imu local transform = xyz=-0.011740,-0.005520,0.005100 rpy=-1.570796,-0.000000,-1.570796
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:1072::init() Starting sensor 1 with 2 profiles
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:1076::init() Opening: Y8 848 480 60 1 Infrared 1 type=3
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:1076::init() Opening: Z16 848 480 60 0 Depth type=1
[ INFO] (2024-03-11 14:07:24.571) CameraRealSense2.cpp:1088::init() Set RS2_OPTION_GLOBAL_TIME_ENABLED=1 (was 1.000000) for sensor 1
[ INFO] (2024-03-11 14:07:24.574) CameraRealSense2.cpp:1096::init() Depth scale 0.001000 for sensor 1
[ INFO] (2024-03-11 14:07:24.574) CameraRealSense2.cpp:1072::init() Starting sensor 2 with 2 profiles
[ INFO] (2024-03-11 14:07:24.574) CameraRealSense2.cpp:1076::init() Opening: MOTION_XYZ32F 0 0 250 0 Accel type=6
[ INFO] (2024-03-11 14:07:24.574) CameraRealSense2.cpp:1076::init() Opening: MOTION_XYZ32F 0 0 200 0 Gyro type=5
[ INFO] (2024-03-11 14:07:24.574) CameraRealSense2.cpp:1088::init() Set RS2_OPTION_GLOBAL_TIME_ENABLED=1 (was 1.000000) for sensor 2
[ INFO] (2024-03-11 14:07:25.592) CameraRealSense2.cpp:1103::init() Enabling streams...done!
matlabbe commented 3 months ago

By default RealSense2 driver will publish IMU data if the camera has one. If you are using the events-based example, you can enable IMU filtering on CameraThread object to compute the quaternion:

cameraThread.enableIMUFiltering();

If you are using the no-events example, you can just reset the IMU data before sending it to the odometry for processing:

data.setIMU(IMU());
jenadzitsiuk commented 3 months ago

Thank you! The cameraThread.enableIMUFiltering() in events example solved the issue!