ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Can't visualize in rviz2 with 'odom' as 'Fixed Frame'

asked 2022-07-25 16:32:42 -0600

dvy gravatar image

I am using ROS2 foxy on Ubuntu 20.04 on amd64 architecture. I have a topic /velodyne_points of type sensor_msgs/msg/PointCloud2 which is published w.r.t frame velodyne which I came to know through its header information.

header:
  stamp:
    sec: 4103
    nanosec: 308000000
  frame_id: velodyne

This is how my tf tree looks like. In rviz, I can visualize this topic with every other frame set as Fixed Frame except odom.

On terminal, I see many messages when odom is set as Fixed Frame . [INFO] [1658783478.987451404] [rviz]: Message Filter dropping message: frame 'velodyne' at time 4332.314 for reason 'Unknown' . They disappear when any other frame is set.

I tried to confirm that tf between odom and velodyne exists using below command which sounds OK to me. I checked some related questions (357762 which suggests that timing is missing from odom to the required frame TF (in my case, it is velodyne). But from the output of below message, I see At time .... line which I think consists the required tf time. Another related question is (367138 which redirects to 357762 and also suggests to setup a static tf but why?

If anyone gets this issue, it's saying that rviz2 cannot render the data because it's not attached to the main tf tree. Even view_frames won't see it. You'll need to setup a static transform between it and the map, such as

ros2 run tf2_ros static_transform_publisher "0" "0" "0" "0" "0" "0" "map" "frame"

dev@dev-Dell-G15-5511:~$ ros2 run tf2_ros tf2_echo odom velodyne
[INFO] [1658783641.648389985] [tf2_echo]: Waiting for transform odom ->  velodyne: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
At time 1658783642.633743699
- Translation: [0.001, 0.053, 0.783]
- Rotation: in Quaternion [0.000, 0.000, 0.568, 0.823]

I don't understand two things over here.

1) What's so special about the odom frame over here? 2) From where did the mapframe come into picture? ros2 run tf2_tools view_frames.pydoes not show it in the tree (neither as linked, nor as isolated) but rviz2 shows it in TF.

Please help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-07-26 05:49:27 -0600

Per Edwardsson gravatar image

The time in the Velodyne message looks a little odd to me. Make sure that's working correctly. RViz will look at that timestamp, then ask the transform tree where the sensor was located at that time, then render the sensor message at that position based in the fixed frame you are currently in. Since the earliest timestamp available for the odom->base_link is at 1658783002 seconds, and the lidar reports the current time as 4103 seconds, RViz concludes that it has no idea where the sensor was at that time and aborts. However, all other transforms are static, so standing in any other frame allows RViz to pick a transform from any time it can find instead. The proposed solution which you link to suggests making map->any_frame be static too, which would essentially be the same as changing the fixed frame in RVIz to any_frame.

A small primer on transforms in ROS:

Transforms are how you keep track of where things are in the world. This is typically critically important for many use cases, whereby old information can be useless at best or dangerous at worst. There is a REP which explains the standard for coordinate systems used in ROS. You will find that odom->base_link represents the movement that the robot thinks it has done, and map->odom being the correction which makes map->odom->base_link make sense in our world. I think RViz might default to looking for the map frame, which might be why you see it even though nothing is connected to it.

edit flag offensive delete link more

Comments

Thanks Per! I implemented parameter use_sim_time and set it to true for all the nodes which were running and after that, visualization is possible in rviz w.r.t. odom frame.

dvy gravatar image dvy  ( 2022-07-28 13:24:35 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2022-07-25 16:32:42 -0600

Seen: 2,706 times

Last updated: Jul 26 '22