Robotics StackExchange | Archived questions

tf canTransform doesn't update return

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.

Asked by amasiero on 2015-10-21 12:50:49 UTC

Comments

Answers

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

Asked by tfoote on 2015-10-21 14:36:02 UTC

Comments