Ask Your Question
0

rospy: how to set a transform to TransformerROS ?

asked 2016-11-06 14:34:00 -0500

vincent78 gravatar image

updated 2016-11-06 14:50:03 -0500

After initializing a node, a declare a TransformerROS.

transformer = tf.TransformerROS(True,rospy.Duration(10.0))

but if I want to perform a transform between two frames (in my case, I use turtlebot and I want to transform between odom and base_link), this does not work :

transformed_point = transformer.transformPoint("odom",point)

with error:

[...]
File "/opt/ros/indigo/lib/python2.7/dist-packages/tf/listener.py", line 71, in asMatrix
translation,rotation = self.lookupTransform(target_frame, hdr.frame_id, hdr.stamp)
[...]
LookupException: "odom" passed to lookupTransform argument target_frame does not exist

note: I have the bring up nodes of turtlebot running and rostopic informs me odom is broadcasted at 50Hz. Also odom frame shows up in rviz.

Also, I notice :

 transformer.getFrameStrings()

prints []

What am I missing ?

Example from here: http://docs.ros.org/jade/api/tf/html/... seems to imply I should set the transform to the transformer first, but according to the error I get, the transformer seems to be searching for the transform itself (" ... self.lookupTransform(target_frame, hdr.frame_id, hdr.stamp) ...")

edit : I tried with an instance of TransformListener rather than TransformROS, for same result

edit retag flag offensive close merge delete

Comments

I haven't used the TransformerROS, but is it possible that you create it and use it immediately so it didn't have the time to receive the transformations?

NEngelhard gravatar image NEngelhard  ( 2016-11-06 15:45:05 -0500 )edit

for your issue in the edit: this helped me. But i'm having the same issue with the TransformerROS aswell...

David_111 gravatar image David_111  ( 2017-06-26 04:30:06 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-26 12:24:37 -0500

tfoote gravatar image

updated 2017-06-26 12:24:57 -0500

Without more context it's hard to tell you what's wrong.

@NEngelhard is right that you may not be filling the buffer. The listener automatically fills the buffer but does need to wait to receive data.

Please see the tutorials: python listener and tf and time

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-11-06 14:34:00 -0500

Seen: 806 times

Last updated: Jun 26 '17