How can I add models to Gazebo during runtime?

asked 2016-11-01 09:00:11 -0500

Stian gravatar image

updated 2016-11-01 10:05:13 -0500

I am currently working on a project at my university that uses ROS Indigo in combination with Gazebo 1.9. What I need is to input some basic cylinders to my simulation after my robot model has moved to a certain position. I have tried using a Gazebo world plugin, but I only manage to input models at simulation start. Is it possible to use a launch file to spawn models in a running simulation? I tried opening a world file with the command gazebo, and then roslaunch mylaunch.launch for spawning my robot model, but the launch stops at

[INFO] [WallTime: 1478007130.941782] Waiting for service /gazebo/spawn_urdf_model

I am using ros_control to position my robot, and then I want to put some objects right next to it. Any suggestions will be appreciated!

edit retag flag offensive close merge delete


You can edit the Gazebo world plugin to input models at a certain time (for instance when the status of a topic changes, or for a ROS service).

Another option is using the Gazebo GUI to add objects. You can either use them from the model database or from your own database.

JoshMarino gravatar image JoshMarino  ( 2016-11-01 18:24:52 -0500 )edit