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

tf canTransform doesn't update return

asked 2015-10-21 12:50:49 -0600

amasiero gravatar image

I have this code:

        dist.is_calibrated = listener.canTransform('/openni', '/torso_1', rospy.Time(0))
        if dist.is_calibrated:
            (trans, rot) = listener.lookupTransform('/openni', '/torso_1', rospy.Time(0))

When canTransform function returns True, it never come False again even if /torso_1 doesn't exists anymore.

Anyone knows why it happen?

Best Wishes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-21 14:36:02 -0600

tfoote gravatar image

If you use Time(0) construction it asks for the "latest valid time". If you stop publishing a transform the transform still exists at the older time and tf will return it.

It is good practice to bounds check the timestamp of the returned transform if there is some expected valid range. You can see it through listener.getLatestCommonTime

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-10-21 12:50:49 -0600

Seen: 363 times

Last updated: Oct 21 '15