Make RViz use the latest transform/extrapolate into the future

asked 2020-09-22 09:29:18 -0500

nnmm gravatar image

I'm on ROS2/Ubuntu 18.04 and I have

  • A node that publishes lidar data in the base_link frame.
  • A node that localizes the robot using that lidar data. It takes some time to do that processing, and then it publishes the map->base_link transform on /tf with the lidar scan's timestamp.
  • RViz.

The code is here. I can't visualize the lidar data in the map frame since RViz complains that the lidar data is newer than the newest transform, which is of course true. Since this seems like it would be a very common use case, what is the recommended way to visualize lidar data (and lidar-derived data) in the map when computing the current pose takes some time?

For instance, here are two behaviors that would count as a solution for me:

  • Every time either the lidar data or the transform are updated, the display gets updated (using the latest message on the other topic).
  • Every time the transform is updated, display the latest lidar scan with that transform, but do not update the display when a lidar scan arrives (i.e. wait for the transform to also arrive).

Is there a way to make RViz do one of those things?

edit retag flag offensive close merge delete