Ask Your Question
0

Waiting for "gazebo_msgs/GetLinkState" causes Python to freeze

asked 2016-07-25 19:30:52 -0500

jwatson_utah_edu gravatar image

ROS Indigo on Ubuntu 14.04 with Gazebo 7.3.0 and Python 2.7:

I have an issue withs starting a Gazebo service proxy for getting link states programmatically from a Python file I run after running the launch file that starts the Gazebo world. At the top of the file I have:

from gazebo_msgs.srv import GetLinkState 
from gazebo_msgs.msg import LinkState # For getting information about link states

...

Later in the file I have:

# Get model information from Gazebo
# Get a handle to the Gazebo model spawner
model_info_prox = rospy.ServiceProxy('gazebo_msgs/GetLinkState', GetLinkState) # No error here
rospy.wait_for_service('gazebo_msgs/GetLinkState') # <-- Python hangs here without error
print model_info_prox( "lbr4_allegro" , "lbr4_7_link" ) # Never makes it here

The script freezes waiting for link states to become available, as noted above. Why does this happen? I used a similar pattern for spawning models and it works fine.

edit retag flag offensive close merge delete

Comments

1

Have you confirmed that the service exists? (Is it listed in 'rosservice list'?)

NEngelhard gravatar imageNEngelhard ( 2016-07-26 02:12:22 -0500 )edit

No, I had not. I grabbed the service name from a post elsewhere online. I was able to find the correct servive with rosservice list. See below. Thanks, @NEngelhard

jwatson_utah_edu gravatar imagejwatson_utah_edu ( 2016-07-26 17:24:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-07-26 17:35:56 -0500

jwatson_utah_edu gravatar image
  • The problem is that the name of the service is incorrect. In Gazebo 7.3, the /gazebo/get_link_state service is offered, according to rosservice list. As written above, the node will be waiting for a service that will never start.
  • The link name should be scoped with the model in a single name, not split into two names.
  • Also, the link state service requires a reference frame with respect to which the link pose will be reported.

The last three lines should be:

model_info_prox = rospy.ServiceProxy('/gazebo/get_link_state', GetLinkState)
rospy.wait_for_service('/gazebo/get_link_state')
print "Link 7 Pose:"    , endl , model_info_prox( "lbr4_allegro::lbr4_7_link" , "world" )
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

1 follower

Stats

Asked: 2016-07-25 19:30:52 -0500

Seen: 551 times

Last updated: Jul 26 '16