Ask Your Question

robot_state_publisher fixed frames 0.5s ahead

asked 2014-08-12 07:34:24 -0600

arennuit gravatar image

updated 2014-08-12 07:36:09 -0600

Hi guys,

The robot_state_publisher has 2 different mechanisms for publishing moving and fixed frames. Moving frames are published on joint_states callback.

Does anyone know why robot_state_publisher publishes the fixed frames using a timer independent from the joint_states subscriber and ahead of 0.5 seconds?

Could not find any valid reason whether from the internet or the code...

Thanks ;)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-08-12 11:30:59 -0600

dornhege gravatar image

updated 2014-08-12 11:32:24 -0600

Note: This is a conjecture on my part.

  1. When you use TF, usually you query a transform for your data's time. Often this is current data, e.g. from now. If you query the transform for current data it is likely to fail, as the TF data has not arrived, yet. (It will under the hood in a short time, though)
  2. Usually this makes some waitForTransform constructs necessary, even for fixed transforms, which do not change (TF didn't know this difference at first)
  3. Fixed frames are fixed. Therefore they do not change. Hence it is correct to assign any time (e.g. +0.5s) to them.
  4. When querying transform data for fixed frames for current data, the TF listener already has data from now + 0.5s and before (because it was send with time stamps 0.5s in the future). Therefore it can interpolate between the transforms and immediately give an answer without waiting.
edit flag offensive delete link more


Wow, if it is that it is super fiddly! As you would never be in a position to really tell which sample you interpolate from... Keep in mind that fixed frames are fixed with respect to their parent, not with respect to the world, hence if their parent move over time (wrt the world), they also do.

arennuit gravatar image arennuit  ( 2014-08-13 00:27:37 -0600 )edit

This is not a problem. Only the fixed transform would be send predated this way.

dornhege gravatar image dornhege  ( 2014-08-13 03:53:53 -0600 )edit

In this case, the following will happen: 1. moving frames are sent at t1, 2. fixed frames are sent at t2 + 0.5 (computed by composing with moving frames at t1), 3. moving frames are sent at t3 < t2 + 0.5, 4. now frames are read. Then when the reading is performed, the fixed position wrt to

arennuit gravatar image arennuit  ( 2014-08-13 04:22:58 -0600 )edit

the world are computed out of the composition of parent moving frames at t1. Hence they are wrong.

arennuit gravatar image arennuit  ( 2014-08-13 04:23:01 -0600 )edit

I don't understand what you are doing there, but this doesn't seem correct. Can you give a concrete example, e.g. with /odom -> /base_link -> /laser, where you think something goes wrong?

dornhege gravatar image dornhege  ( 2014-08-13 04:28:46 -0600 )edit

Ok I update the question in a few minutes

arennuit gravatar image arennuit  ( 2014-08-13 04:35:10 -0600 )edit

While writing an edit for further explanations I realized that you are actually right: at step 4 the computation of the position of the fixed frames wrt to the world uses moving frames at t2 and not t1 and interpolates the fixed frames (which does not do anything as they are constant).

arennuit gravatar image arennuit  ( 2014-08-13 04:50:37 -0600 )edit

Thanks for provoking these thoughts ;)

arennuit gravatar image arennuit  ( 2014-08-13 04:50:42 -0600 )edit

answered 2014-08-12 10:11:37 -0600

Wolf gravatar image

Just an idea, answer not based on knowledge: sensor_msgs/JointState contains header with stamp, might be that the tf of the moving frames uses the time stamp from the sensor_msgs/JointState it receives in the callback..??

edit flag offensive delete link more


I believe you are right about the moving frames inheriting their time stamp from sensor_msgs/JointState. But how does that help?

arennuit gravatar image arennuit  ( 2014-08-13 00:30:07 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-08-12 07:34:24 -0600

Seen: 88 times

Last updated: Aug 12 '14