Robotics StackExchange | Archived questions

rospy: how to set a transform to TransformerROS ?

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/python/tf_python.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(targetframe, hdr.frameid, hdr.stamp) ...")

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

Asked by vincent78 on 2016-11-06 15:34:00 UTC

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?

Asked by NEngelhard on 2016-11-06 16:45:05 UTC

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

Asked by David_111 on 2017-06-26 04:30:06 UTC

Answers

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

Asked by tfoote on 2017-06-26 12:24:37 UTC

Comments