tf2 TF error: [, when looking up transform

asked 2021-02-18 11:35:09 -0500

ia gravatar image

updated 2022-03-01 08:22:21 -0500

lucasw gravatar image

I am getting a blank error when using TF2 for a command that otherwise works great for TF.

Per this answer, my rosbag needs a TF authority, so using TF I create a trivial transform with a period of 1 and rviz is able to display the pointcloud afterwards:

rosparam set /use_sim_time true
rosrun rviz rviz
rosbag play my.bag --loop --clock
rosrun tf static_transform_publisher 0 0 0 0 0 0 p multisense/left_camera_optical_frame 1

Migrating to TF2, this same command would be:

rosrun tf2_ros static_transform_publisher 0 0 0 0 0 0 1 p multisense/left_camera_optical_frame

But when I set the rviz map to the same "p" from before when using TF, it complains this time:

For frame [multisense/left_camera_optical_frame]: No transform to fixed frame [p].  TF error: [, when looking up transform from frame [multisense/left_camera_optical_frame] to frame [p]]

Why does TF work but not tf2_ros in this case?

edit retag flag offensive close merge delete


I'm not using sim time but I don't see the same error when running just the transform commands. The tf2 static transform actually publishes onto /tf_static and latches, tf1 static_transform_publisher publishes onto /tf at a certain rate, it is using the 1 at the end of your command to attempt to republish every millisecond (on my system only gets up to ~900 Hz)- maybe that high rate in combination with other traffic on tf is fouling up rviz so that it can't generate a full error message?

I found this because of a MarkerArray generating the same error out of rviz, it must be for a similar reason- running rviz with debug logs on or tracking down the code that generates that error is the next step.

lucasw gravatar image lucasw  ( 2022-03-01 08:51:18 -0500 )edit

This #q359128 is another occurrence of the same error

lucasw gravatar image lucasw  ( 2022-03-01 08:55:05 -0500 )edit