How to visualise IMU data in Rviz?
OS: Pop!_OS 22.04 LTS
ROS Version: ROS2 Humble
I have my Intel Realsense d435i camera publishing the following topic:
/camera/accel/imu_info
/camera/accel/metadata
/camera/accel/sample
/camera/color/camera_info
/camera/color/image_raw
/camera/color/image_raw/compressed
/camera/color/image_raw/compressedDepth
/camera/color/metadata
/camera/depth/camera_info
/camera/depth/color/points
/camera/depth/image_rect_raw
/camera/depth/image_rect_raw/compressed
/camera/depth/image_rect_raw/compressedDepth
/camera/depth/metadata
/camera/extrinsics/depth_to_accel
/camera/extrinsics/depth_to_color
/camera/extrinsics/depth_to_depth
/camera/extrinsics/depth_to_gyro
/camera/gyro/imu_info
/camera/gyro/metadata
/camera/gyro/sample
/camera/imu
/parameter_events
/rosout
/tf_static
I want to visualise the /camera/imu
topic in RViz. When the camera moves I would like to see the movement in Rviz. Currently when I open Rviz while the realsense2_camera
this is the view that I get:
While the Imu Status: Warn Topic: No messages received shows up the ros2 topic echo /camera/imu
publishes the following (showing only one message): gist
The rivz terminal spams with this INFO message:
[INFO] [1669385796.444049080] [rviz]: Message Filter dropping message: frame 'camera_imu_optical_frame' at time 1669385796.101 for reason 'discarding message because the queue is full'
I have the following option in Fixed Frame drop down menu:
camera_accel_fram
camera_accel_optical_frame
camera_color_frame
camera_depth_frame
camera_depth_optical_frame
camera_gyro_frame
camera_gyro_optical_frame
camera_link
and none of them show the movement of my camera.
Do I need to create a statictransforpublisher? If I have to, I need to map the offset of base_link to minus of whatever the value published by /camera/imu
, right? Is this the way to go?
Asked by tsadarsh on 2022-11-25 09:19:36 UTC
Answers
have you tried changing the QoS in Rviz2?
it defaults to reliable and needs to be best effort for most sensor data.
Asked by RobotDreams on 2022-11-25 13:41:32 UTC
Comments
Setting the QoS to "Best Effort" doesn't change the error message that I receive. From the log message: [INFO] [1669524133.662615199] [rviz]: Message Filter dropping message: frame 'camera_imu_optical_frame' at time 1669524133.316 for reason 'discarding message because the queue is full'
it is apparent that Rviz is dropping the message. But why?
Asked by tsadarsh on 2022-11-26 23:43:02 UTC
rviz
is most likely waiting for missing transform tree info that you have not provided. Internally rviz
needs to transform the message sensor pose from the camera_imu_optical_frame
to the Fixed Frame (usually map
). rviz
is not reading that topic queue because it is aware that the only thing it can do is discard it (since the message is useless without the corresponding transform data.)
Asked by Mike Scheutzow on 2022-11-27 10:27:06 UTC
How do I provide the missing transform tree?
Asked by tsadarsh on 2022-11-28 05:15:05 UTC
I tried doing ros2 run tf2_ros static_transform_publisher --frame-id base_link --child-frame-id camera_imu_optical_frame
. Now when I set the Fixed frame to base_link
in Rviz and add the /camera/imu
topic, the console gives me this warning: rviz_imu_plugin got invalid quaternion (0,0,0,0will display neutral orientation instead
Asked by tsadarsh on 2022-11-28 05:33:44 UTC
Try change the Q.O.S, reliability policy tag and set to system default and also that of Durability Policy.
Asked by Davies Ogunsina on 2022-11-27 07:57:10 UTC
Comments
I changed everything to "System Default" and I do not see any changes in Rviz. The movement of my camera doesn't reflect in Rviz.
Asked by tsadarsh on 2022-11-28 04:10:12 UTC
Do you have a tf that connects your camera frame to the base of you robot?
Asked by Davies Ogunsina on 2022-11-28 16:43:08 UTC
Hi Davis. I want to use only the camera. I do not have a robot. Is it impossible to use the camera alone to visualise the IMU data it publishes?
Asked by tsadarsh on 2022-11-30 10:10:32 UTC
Comments
If I have to, I need to map the offset of base_link to minus of whatever the value published by /camera/imu, right?
No. The urdf (or static_transform_publisher) specifies the pose of the sensor (where it is mounted) relative to base_link. The data values output by the sensor have nothing to do with it.
Asked by Mike Scheutzow on 2022-11-27 10:14:49 UTC
@mike-scheutzow Doesn't the realsense2_camera publish the required tf? Am I supposed the setup the static transforms by myself?
Asked by tsadarsh on 2022-11-28 04:12:04 UTC
You are supposed to set the tf connecting the camera frame and the base of your robot .I belive if this isn't properly done ,an error will pop up on rviz .
Asked by Davies Ogunsina on 2022-11-28 16:47:03 UTC
I do not have a robot. I just want to see the IMU data published in
/camera/imu
in Rviz.Asked by tsadarsh on 2022-11-30 10:09:09 UTC