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

Is there a max number of edges allowed between two frames in a TF tree?

asked 2016-03-22 19:52:39 -0600

jacobperron gravatar image

I have a pose graph of about 2000 nodes published as static transforms with tf2_ros::StaticTransformBroadcaster.

Currently, the poses are chained together as a path, meaning I publish transforms from:
_node_0_ to _node_1_,
_node_1_ to _node_2_,
...,
_node_n-1_ to _node_n_.

I then want to lookup transforms from between various nodes, but tf::TransformListener fails when nodes are more than 1000 edges apart in the TF tree:

The tf tree is invalid because it contains a loop.
_Followed by a list of all transforms that exist between frames._

I'm almost certain there are no loops as the listed transforms after the error appear sane and include all 2000 nodes. Also, the same code works fine when there are less than 1000 nodes.

With the tool tf_echo I can successfully get the transform between any two nodes that are within 1000 edges. For example:
_node_0_ to _node_1000_ (success)
_node_0_ to _node_1_ (success)
_node_1_ to _node_1001_ (success)
_node_0_ to _node_1001_ (failure The tf tree is invalid because it contains a loop.)

Could this be something to do with the subscriber's queue size in TransfromListener?

Thanks for the help :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-03-23 00:33:42 -0600

tfoote gravatar image

The maximum depth for a search is 1000UL

It assumes if you're more that 1000 deep into the tree that it's encountered a loop.

It sounds like you're using tf in an unusual manner. You could open a ticket to discuss extending the search depth or improve loop detection. However it's a performance critical code path so it might be better to allow overriding the search depth but not change the default.

edit flag offensive delete link more

Comments

Thanks for the prompt reply! I will consider alternate solutions before overriding the search depth.

jacobperron gravatar image jacobperron  ( 2016-03-23 01:03:25 -0600 )edit

Note I don't know of a limit on the width of the graph.

tfoote gravatar image tfoote  ( 2016-03-23 01:52:53 -0600 )edit

I think the best solution to my problem is to publish transforms from node_0 to all other nodes, rather than the current 'list' structure. This way there will only ever be two edges between any two nodes making lookups a lot cheaper in large trees. I will let you know if I run into width issues.

jacobperron gravatar image jacobperron  ( 2016-03-24 14:31:58 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-22 19:52:39 -0600

Seen: 235 times

Last updated: Mar 23 '16