Rosanswers logo

As per the ROS conventions: https://www.ros.org/reps/rep-0105.html#relationship-between-frames, the 'odom' frame should be the parent of 'base_link' frame. This means the transform between these two frames is 'odom->base_link'

However, while I was going through some of the existing code (that is developed using ROS) on GitHub, I came across a couple of instances in which the transform being published has the reversed frame order: 'base_link->odom', where <>.header.frame_id is 'base_link and <>.child_frame_id is 'odom'.

The two examples are:

So, I have a couple of questions:

  1. Is the transform in the above examples correct (or acceptable)?

  2. How important is it to follow the frame order suggested by the REP 105 in the tf tree? Should it always be followed? If yes, why? If no, why?

Would really appreciate if someone could help me to understand the tf tree order.

Thank you!

Originally posted by skros on ROS Answers with karma: 3 on 2020-04-17

Post score: 0

Original comments

Comment by gvdhoorn on 2020-04-18:
Just a comment:

while I was going through some of the existing code (that is developed using ROS) on GitHub

the wording here makes it sound like you have analysed the TF/TF2 implementation (ie: the libraries themselves) or some other piece of code part of the code (which would imply it's part of some official distribution and has been specially vetted).

From the rest of your question text it appears that's not the case; you've come across two community contributed packages where the authors seem to have made a mistake (and also note: the first package hasn't been touched since 2013 and the second is from 2015).

I realise these are still valid examples of where authors of nodes may have implemented this transform incorrectly, so valid examples of what you'd be interested in when applying static analysis to this sort of code. But it would be good to acknowledge the fact those pieces of code are "from the stone-ages" though.


1 Answer 1


Rosanswers logo

Those two examples are wrong with reference to REP-105.

Does it matter to the authors of those packages? Possibly not. However, if you want to use things like Navigation2 or robot_localization, it matters a great deal. Basically, while you can go against the REPs, your code won't interact properly with other portions of the ROS ecosystem that followed the REPs (which is most of the bigger and well maintained packages).

Originally posted by fergs with karma: 13902 on 2020-06-12

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.