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

Set TF_CACHE_TIME with rospy

asked 2013-04-15 06:14:22 -0500

Miguel S. gravatar image

updated 2014-01-28 17:16:11 -0500

ngrennan gravatar image


I'm using a robotic (and ROSified!) wheelchair. One of the tasks I have to do is to transform a point from /base_link to /odom. Unsurprisingly, I use TF :)

However, when running the code below in Python:

tfListener.canTransform("/odom", base_link_point, rospy.Time(0) )

the function returns False quite often. I also transform from /base_link to /map (a longer chain) in another node and that works reliably.

I think the issue might be that tfListener doesn't have a big enough TF_CACHE_TIME, so I'd like to try and increase it. However the TF python documentation doesn't indicate how to do this.

I've also checked the source code and there's a call to override the argument in Transformer_init() but it's not clear to me how to do so or what are the other arguments for.

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-15 18:15:10 -0500

tfoote gravatar image

Sorry we haven't provided that level of customization into tf. But the default timeout is 10 seconds, I would not expect you to be having this problem with that timeout.

Can you verify that you are keeping the tfListener is scope such that the cache can build up? The most common reason for that sort of call to fail is not that data is too old, but that you are querying it before data has arrived.

edit flag offensive delete link more


tfListener was in scope. The issue seemed to be that /odom was published by another machine (without internet) whose clock was 16sec behind. ntpdate seems to have fixed it :)

Miguel S. gravatar image Miguel S.  ( 2013-04-17 02:25:00 -0500 )edit

Question Tools

1 follower


Asked: 2013-04-15 06:14:22 -0500

Seen: 183 times

Last updated: Apr 15 '13