Ask Your Question

service exception using tf listener in rospy

asked 2011-07-31 14:25:40 -0500

Nash gravatar image

updated 2014-01-28 17:10:08 -0500

ngrennan gravatar image

I get a service exception whenever I call lookupTransform for tf.TransformListner.

tf_listener = tf.TransformListener()        
tf_listener.waitForTransform( reference_link, end_effector_link, rospy.Time(), rospy.Duration(4.0))     
(posn, rotn) = tf_listener.lookupTransform(reference_link, end_effector_link, rospy.Time())

This is the service exception:

Exception in thread Thread-18:
Traceback (most recent call last):
  File "/usr/lib/python2.6/", line 532, in __bootstrap_inner
  File "/opt/ros/diamondback/stacks/geometry/tf/src/tf/", line 237, in run = rospy.Service('~tf_frames', FrameGraph, self.frame_graph_service)
  File "/opt/ros/diamondback/stacks/ros_comm/clients/rospy/src/rospy/impl/", line 682, in __init__
    get_service_manager().register(self.resolved_name, self)
  File "/opt/ros/diamondback/stacks/ros_comm/clients/rospy/src/rospy/", line 120, in register
    raise ServiceException(err)
ServiceException: service [/test_code_22488_1312164786316/tf_frames] already registered

The tf_listener is initialized within a python function definition. The output of the lookupTransform is otherwise fine (the position and rotation are correct and functional). I just want to get rid of the exception always printing out the screen about the service being already registered.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-08-01 13:54:41 -0500

tfoote gravatar image

I believe this is actually in the constructor. tf.TransformListener advertises that service as a debugging tool. In the c++ version it checks it it has been advertised and doesn't do so again if it's already been done so by a different Listener. If you want to look into the code, the conditional execution could be added in the run method in TransformListenerThread in tf/src/tf/

edit flag offensive delete link more



This bug is still around. You are right, Tully. That exception is only thrown on creation of a tf listener. I posted a "ticket on github":

bit-pirate gravatar image bit-pirate  ( 2012-11-09 15:53:02 -0500 )edit

As this seems to be not fixed on Fuerte as of today I created a patch and want to share it. Therefore the following pull request has been created:

Sebastian Rockel gravatar image Sebastian Rockel  ( 2013-08-01 04:46:45 -0500 )edit

Is it fixed for Indigo? I got it and don't know whether its something in my code or the repo itself.

lahiruherath gravatar image lahiruherath  ( 2018-05-29 07:25:08 -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



Asked: 2011-07-31 14:25:40 -0500

Seen: 1,617 times

Last updated: Aug 01 '11