Waiting for "gazebo_msgs/GetLinkState" causes Python to freeze
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.
Have you confirmed that the service exists? (Is it listed in 'rosservice list'?)
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