Ask Your Question
0

why the tf.transformPoint is giving tf exception?

asked 2016-06-16 15:02:11 -0500

anilmullapudi gravatar image

updated 2016-06-17 01:19:09 -0500

I am trying to transform a point from a base_link frame to camera frame. When run the below code getting error message "Exception: Lookup would require extrapolation into the future. canTransform returned after 4.003 timeout was 4.Requested time 1466110388.818536997 but the latest data is at time 3101.240000000, when looking up transform from frame [base_link] to frame [wide_stereo_optical_frame]. target = "wide_stereo_optical_frame";
point = PointStamped()
point.point.x =2;
point.point.y = 1;
point.point.z = 1;
point.header.frame_id = "base_link";
point.header.stamp = rospy.Time.now();
tl_ = tf.TransformListener();
tl_.waitForTransform(target, point.header.frame_id, rospy.Time.now(), rospy.Duration(5.0));
camera_target = tf.transformPoint(target, point)

botf base_link and wide_stereo_optical_frame frames are available in tf database. I verified the in the terminal like this
rosrun tf tf_echo /base_link /wide_stereo_optical_frame

edit retag flag offensive close merge delete

Comments

Is this still a problem after you resolved: http://answers.ros.org/question/23724...

tfoote gravatar image tfoote  ( 2016-06-16 15:22:30 -0500 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2016-06-17 22:45:08 -0500

anilmullapudi gravatar image

updated 2016-06-17 23:10:54 -0500

The problem is solved after referring to this link. The workaround is, I used a sleep function after tfObject creation.

tl_ = tf.TransformListener();
rospy.sleep(10.)
# The above sleep function gives the sufficient time to load frames from /tf topic

edit flag offensive delete link more

Comments

Did you have to wait 10 second to catch your tf transform? That is weird in most of the applications, but ok..

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-20 03:02:57 -0500 )edit

I tried running my node in a faster computer. It's working fine now without sleep()

anilmullapudi gravatar image anilmullapudi  ( 2016-06-29 13:42:39 -0500 )edit

I'm having the exact same problem, but this did not work :/

dhiego gravatar image dhiego  ( 2017-11-23 22:17:17 -0500 )edit
0

answered 2016-06-16 15:11:35 -0500

updated 2016-06-16 15:41:11 -0500

It may be a timeout exception: Are you sure that the required transform tree is being broadcasted periodically?

Did you try to wrap your code in a try catch block?

try: 
   ..
catch Except as ex:
   rospy.loginfo(ex.message)
edit flag offensive delete link more

Comments

since i was using python, i used try ... catch Exception as e: traceback.print_exc(); this is printing <module> tf2.waitForTransform(target, point.header.frame_id, rospy.Time.now(), rospy.Duration(4.0)); Exception: . canTransform returned after 4.00015 timeout was 4.

anilmullapudi gravatar image anilmullapudi  ( 2016-06-16 15:37:37 -0500 )edit

I increased duration to 5.0 , still same issue.

anilmullapudi gravatar image anilmullapudi  ( 2016-06-16 15:38:20 -0500 )edit

It looks like it is a timeout exception. Are you sure that the required transform tree is being broadcasted periodically?

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-16 15:39:35 -0500 )edit

It does not matter how much you increase the time if you are not publishing all the required transforms. you can check what is happening if you look at the raw tf topic

rostopic echo /tf
Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-16 15:46:30 -0500 )edit

yes rostopic echo /tf giving output. Sorry, here is complete exception details. line 61, in <module> tf2.waitForTransform(target, point.header.frame_id, rospy.Time.now(), rospy.Duration(4.0)); Exception: Lookup would require extrapolation into the future.

anilmullapudi gravatar image anilmullapudi  ( 2016-06-16 15:54:49 -0500 )edit

Requested time 1466110388.818536997 but the latest data is at time 3101.240000000, when looking up transform from frame [base_link] to frame [wide_stereo_optical_frame]. canTransform returned after 4.003 timeout was 4.

anilmullapudi gravatar image anilmullapudi  ( 2016-06-16 15:56:08 -0500 )edit

Please edit your question to add the additional information. That way you can format it better etc. PS Please use the preformatted text mode. (highlight the block, and click the 101010 button to auto indent.

tfoote gravatar image tfoote  ( 2016-06-16 15:56:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-16 15:02:11 -0500

Seen: 861 times

Last updated: Jun 17 '16