Calling ServiceProxy make the script hang
Hello! I am trying to set up a ServiceProxy that spawns a sphere for me. The sphere actually spawns in Gazebo but after that the script just hangs! So what am I doing wrong? Here is my code:
import rospy
from gazebo_msgs.srv import SpawnEntity,SpawnEntityRequest
from geometry_msgs.msg import Pose
rospy.wait_for_service('/gazebo/spawn_sdf_entity')
spawn_model_srv = rospy.ServiceProxy("/gazebo/spawn_sdf_entity", SpawnEntity,persistent=False)
initial_pose = Pose()
initial_pose.position.x = 1.7
initial_pose.position.y = 1.0
initial_pose.position.z = 2.7
model = open("sphere.sdf","r")
sdf = model.read()
model_name = "ball2"
try:
spawn_model_srv(model_name, sdf, "", initial_pose, "world")
except:
pass
model.close()
Asked by monocle on 2019-08-09 19:32:53 UTC
Comments