Ask Your Question
0

tf spits a lookup exception

asked 2011-05-11 02:19:37 -0600

updated 2011-05-11 07:22:05 -0600

I'm using the tf package and specifically the tf.TransformerROS class in Python. If I try calling its methods transformPose or transformPointCloud it returns a LookupException

tf.LookupException: Frame id /map does not exist! When trying to transform between /base_link and /map.

However if I try running the tf_monitor right after that I see that tf has knowledge of the frame

~>rosrun tf tf_monitor base_link map 
Waiting for transform chain to become available between /base_link and /map 

RESULTS: for /base_link to /map 
Chain is: /base_link -> /base_footprint -> /odom_combined -> /map 
Net delay     avg = 0.00684423: max = 0.054 

Frames: 
Frame: /base_footprint published by /robot_pose_ekf Average Delay: 0.0185 Max Delay: 0.026 
Frame: /base_link published by /robot_state_publisher Average Delay: 0.0075 Max Delay: 0.008 
Frame: /odom_combined published by /slam_gmapping Average Delay: 0 Max Delay: 0 

All Broadcasters: 
Node: /robot_pose_ekf 33.5196 Hz, Average Delay: 0.0185 Max Delay: 0.026 
Node: /robot_state_publisher 55.5556 Hz, Average Delay: 0.0075 Max Delay: 0.008 
Node: /slam_gmapping 25 Hz, Average Delay: 0 Max Delay: 0

I'm running gazebo simulation and have ROBOT=sim set. Any ideas how to get transformPointCloud to work?

Edit: Here is (simplified) the part of the code that deals with tf

import roslib
roslib.load_manifest(PKG)
import rospy
import tf

class Class():
    def __init__(self):
        #...
        self.tfTrasformer = tf.TransformerROS()
        #...


    # somewhere in the methods
    obj.object.cluster = self.tfTrasformer.transformPointCloud("/map",obj.object.cluster)
edit retag flag offensive close merge delete

Comments

Could you post/link to your code that makes the TransformerROS instance as well as the code that calls the methods that are failing? If possible a minimal example that reproduces the problem would be best.
Eric Perko gravatar imageEric Perko ( 2011-05-11 07:09:12 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-05-11 13:07:58 -0600

Eric Perko gravatar image

You should use the TransformListener class, not TransformerROS. I'm pretty sure that TransformerROS does not automatically subscribe to the "/tf" topic, which would be why you are getting errors about missing frames.

For example usage, see the Python TF tutorials.

I'm not really sure why there are no docs for the TransformListener class online, since there are doc strings in the source code.

edit flag offensive delete link more

Comments

Thank you. But I looked at these links before I posted my question and I'm not sure: should I write my own function which applies translation and rotation to coordinates? I am happy to do so but thought something like that existed in ROS already.
Dimitar Simeonov gravatar imageDimitar Simeonov ( 2011-05-11 15:30:55 -0600 )edit
No need. The TransformListener inherits from TransformerROS, so has all of the same methods. The only important difference in this case is that the TransformListener automatically subscribes to "/tf" whereas TransfomerROS needs somebody to shove transform info into it.
Eric Perko gravatar imageEric Perko ( 2011-05-11 15:33:09 -0600 )edit
Ha, I had no idea it subclasses it - at least this isn't really visible from the documentation or the tutorials. Thanks, I'll try it tomorrow and see how it works.
Dimitar Simeonov gravatar imageDimitar Simeonov ( 2011-05-11 15:43:23 -0600 )edit
Ya... not sure what's up with the docs... You may want to file a ticket against tf for the docs describing what you were unable to find/the source of your confusion... at the least, there are doc strings for e.g. TransformListener in the source that might help if they were in the generated API pages
Eric Perko gravatar imageEric Perko ( 2011-05-11 15:46:43 -0600 )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

Stats

Asked: 2011-05-11 02:19:37 -0600

Seen: 1,045 times

Last updated: May 11 '11