What is the correct way to spawn a model to Gazebo using a Python script?
Hi, I'm kinda fuzzy on this part. Here's my attempt:
rospy.wait_for_service("/gazebo/spawn_urdf_model")
try:
spawner = rospy.ServiceProxy("/gazebo/spawn_urdf_model", SpawnModel)
spawner(rover_name, str(open("/home/anh/catkin_ws/src/rover_project/rover_description/urdf/rover.urdf",'r')), "/rover", Pose(position= Point(0,0,2),orientation=Quaternion(0,0,0,0)),"world")
except rospy.ServiceException as e:
print("Service call failed: ",e)
However, it leads to this result:
('Service call failed: ', ServiceException('service [/gazebo/spawn_urdf_model] responded with an error: ',))
Now, I'm pretty sure I didn't pass the urdf file the correct way. So if you guys can give me a full example on how to do it in Python, that would be awesome!