Gazebo | Ignition | Community
Ask Your Question

How to automatically run multiple simulations due to removals of robots

asked 2017-07-10 08:42:10 -0500 gravatar image

Hi everyone,

I meet with a problem for automating simulations in ROS-Gazebo. In my project, a group of UAVs need to search for target. Once approaching the target, the close robot needs to be removed so that others can keep approaching the target. The problem locates here. After removing all robots, I need to close ROS and Gazebo both and relaunched manually again so that removed robots can be respawned for the next simulation. But I need to run thousands of simulations based on different experimental parameters' value. Hence, I am looking for some ways to solve my issue. The controlling algorithm for each UAV is written in C++. The UAV model is hector_quadrotor. Its package can be downloaded from the website. This package only have .xacro file as robot description file.

So far, I have found ways to repawn robots in c++ during the simulation by calling spawn_urdf_model service. But, I can only create a model without any availalbe topic (such as cmd/vel topic) for controlling it. Does anyone know how to spawn a robot with controllers or topics during the simulation? Or, alternatively, does anyone know how to run at least one hundred simulations simultaneously or successively just through one manual operation?

Thank you very much for any information

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-07-10 09:01:54 -0500

nkoenig gravatar image


You should be able to spawn a robot with gazebo_ros plugins attached. These plugins could provided ros topics. When you try to spawn the quadrotor, do you see error messages? If so, could you add the messages to your original post?

You could also write a shell script that runs roslaunch in a loop. This would let you run hundreds of simulations successively.

edit flag offensive delete link more


Thank you for the reply. No error message with spawning. In hector_quadrotor package I have. It uses .xacro file for description. So, it creates an independent .launch file just for spawning a robot with all necessary parameters. When I call spawn_urdf_model service, I convert .xacro file to .urdf file. So, it does not have any gazebo_ros_control plugin with it. I am looking for some ways to spawn such a robot with all needed control part for calling necessary topics. gravatar ( 2017-07-10 09:14:54 -0500 )edit

Hello, sir. I meet with a new problem and maybe you can offer me some valuable information. Now, I can spawn a hector_quadrotor during the simulation. But the problem is I cannot control it because it does not have necessary topics (cmd/vel and ground_to_truth/pose). I try to call controller_manager service to load controller/twist controller to it so that It can access cmd/vel topic. But the terminal always reture: ok:false.Do you have any idea towards it? gravatar ( 2017-08-14 04:54:57 -0500 )edit

Question Tools

1 follower


Asked: 2017-07-10 08:42:10 -0500

Seen: 603 times

Last updated: Jul 10 '17