ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

When you spawn it in a launch file it works like this:

<node name="spawned_object_name" pkg="gazebo" type="spawn_model" args="-urdf -file $(find rospackagename)/path/to/file.urdf -model object_name_from_gazebo_perspective -x 0.50 -y 0.05 -z 0.65" respawn="false" output="screen"/>

If you look at

http://www.ros.org/wiki/simulator_gazebo/Tutorials/Gazebo_ROS_API

it tells you that there is also a ROS service gazebo/spawn_model which you can call programmatically through a ROS message - this seems like the right way to do it.

Here is the documentation of the service: http://www.ros.org/doc/api/gazebo/html/srv/SpawnModel.html

When you spawn it in a launch file it works like this:

 <node name="spawned_object_name" pkg="gazebo" type="spawn_model"  args="-urdf -file $(find rospackagename)/path/to/file.urdf -model  object_name_from_gazebo_perspective  -x 0.50 -y 0.05 -z 0.65"  respawn="false" output="screen"/> 

output="screen" />

If you look at

http://www.ros.org/wiki/simulator_gazebo/Tutorials/Gazebo_ROS_API

it tells you that there is also a ROS service gazebo/spawn_model which you can call programmatically through a ROS message - this seems like the right way to do it.

Here is the documentation of the service: service:

http://www.ros.org/doc/api/gazebo/html/srv/SpawnModel.html