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

tf namespace resolution

asked 2012-09-05 19:16:24 -0500

updated 2012-09-05 20:04:26 -0500

In my tf tree, I accidentally forgot the root forward slash in a single link inside the tree. For example, in the tree in the view_frames output here, the following link:

/map -> /ens1/map

was accidentally being transmitted by a python node as:

map -> ens1/map

Now, view_frames clearly ignored this error and formed up everything as a single tree (a full tree was formed - as shown in image above). Similarly tf_echo successfully produced the following transformation:

rosrun tf tf_echo /segbot1/base_footprint /segbot1/ens1/map


At time 459.605
- Translation: [-5.000, -5.000, 0.001]
- Rotation: in Quaternion [0.000, 0.000, -0.000, 1.000]
            in RPY [0.000, 0.000, -0.000]
At time 460.600
- Translation: [-5.000, -5.000, 0.001]
- Rotation: in Quaternion [0.000, 0.000, -0.000, 1.000]
            in RPY [0.000, 0.000, -0.000]

However the navigation stack kept complaining (correctly?) about there being 2 separate trees:

Waiting on transform from /segbot1/base_footprint to /segbot1/ens1/map to become available before running costmap, tf error: Could not find a connection between '/segbot1/ens1/map' and '/segbot1/base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.

After (quite) a bit of debugging, I found that the tf information was being interpreted as 2 different trees by the move_base node (i.e. Costmap2DRos) in the navigation stack, but as a single tree by view_frames and tf_echo. Although the error has been fixed:

  1. Did this happen because because the move_base node was launched in the /segbot1 namespace and/or /segbot1/tf_prefix was set. The TransformListener applied standard name resolution rules and resolved the tf link as /segbot1/map -> /segbot1/ens1/map
  2. If 1 did indeed happen, does it make sense for the TransformListener to do this sort of name resolution, as essentially nodes in different namespace see different trees.
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-09-05 20:26:42 -0500

Mani gravatar image

As far as I understood, tf does not take into account any namespaces. Instead, every node that uses tf will accept a tf_prefix rosparam which will act similar to namespace in tf tree (this is done somehow by magic!). However, if you explicitly put a slash in front of a frame_id in any tf function, the tf_prefix will be ignored.

When using view_frame or tf_echo both /ens1/map and ens1/map are the same (no tf_prefix), however if a tf_prefix is set, the second one will become prefix/ens1/map while the first one will be the same.

I am not completely sure, but I think robot-specific frames should never be referenced in your code with a forward slash prefix.

edit flag offensive delete link more



This make a lot of sense. I had an incorrect understanding of tf_prefix. This faq questions is also helpful to this discussion:

piyushk gravatar image piyushk  ( 2012-09-06 05:12:31 -0500 )edit

Question Tools


Asked: 2012-09-05 19:16:24 -0500

Seen: 3,654 times

Last updated: Sep 05 '12