# Revision history [back]

Your service name is missing the gazebo/ prefix and the first code isn't equivalent to the second one because you need to specify the argument as a string. Here a working code to call the service :

# you can also do this before :
# rospy.wait_for_service('/gazebo/delete_model') to ensure the service is available
delete = rospy.ServiceProxy(''/gazebo/delete_model', DeleteModel)
try:
delete(model_name = "snake")
# or simply delete("snake")
except rospy.ServiceException as exc:
print("Service did not process request: " + str(exc))


Your service name is missing the gazebo/ prefix and the first code isn't equivalent to the second one because you need to specify the argument as a string. Here a working code to call the service :

# you can also do this before :
# rospy.wait_for_service('/gazebo/delete_model') rospy.wait_for_service("/gazebo/delete_model") to ensure the service is available
delete = rospy.ServiceProxy(''/gazebo/delete_model', rospy.ServiceProxy("/gazebo/delete_model", DeleteModel)
try:
delete(model_name = "snake")
# or simply delete("snake")
except rospy.ServiceException as exc:
print("Service did not process request: " + str(exc))