Home | Tutorials | Wiki | Issues
Ask Your Question

Best practices for programmatic start, unpause, and shutdown of Gazebo simulation

asked 2018-06-22 13:55:25 -0500

Ubuntu 16.04
Gazebo 7.0
ROS Kinetic

For both regression testing and experiments, I want to set up a framework that:
1) Launches Gazebo and loads the payload models/plugins, etc. w/ the simulation paused
2) Unpauses Gazebo once it has finished loading
3) Run my experiment
4) Closes gz_server & client
5) Repeat
6) Profit?!

Does anyone have advice/suggestions/templates for this type of use-pattern?

I was planning to start Gazebo via the gazebo_ros package using subprocess wtih roslaunch.

My primary concern is 2). Does Gazebo broadcast some kind of signal once it's finished starting up completely?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-25 06:04:15 -0500

wentz gravatar image

I did something like you mentioned in my work as research assistant in the university. Probably this will become open source in the next month. So I will describe how i did it and give you some hints.

I have 4 packages.

  • first generate's yaml files with the description of the simulation (models, poses ,plugins, parameter, etc)
  • second loads these files and starts all launchfiles, spawn objects, etc.
  • an observer to determine if a test has ended and if it was successful
  • a logger to collect datas like rosbag, test time, etc
  • (5.) a small visualization library

I also used python and the subprocess-API this worked fine for me. More problematic is to kill all the programs/nodes that was running (specially action_server like move_base). So at the end of the test i just reset the simulation and only kill nodes that i really need to be kill. Also over time the memory usage of my system getting really high. Couldn't figure out why is that. But for this reason i restart the framework every 100 tests.

Hope that will help you. If you have more questions please ask me.

edit flag offensive delete link more


Thank you for the hints/tips! Very helpful. I'll be sure to ask as I run into more questions.

josephcoombe gravatar imagejosephcoombe ( 2018-06-25 10:44:24 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-22 13:55:25 -0500

Seen: 86 times

Last updated: Jun 25