How to detect gzserver's --iters limit reached?
I would like to run a large number of gazebo environments, each with small parameter changes, and collect data for each trial. To do this, I'd like to run gzserver
with my modified world file, use the --iters
option to specify the duration of the test, use a plugin to log state data, then when the simulation reaches its step limit, close gzserver
, change the world file, and repeat.
The --iters
option seems like a good approach to limit the execution of a simulation to some desired number of sim steps, regardless of execution time, but I haven't found a clean way to detect that this limit has been reached; I am curious if anyone has thought of this before or has a solution in mind?
Some ideas I've had that feel a bit "clunky".
- monitor the number of threads being used by the gzserver process. This number seems to drop by 4 consistently when the
--iters
limit has been reached. - echo one of the topics (e.g.
gz topic -e /gazebo/default/world_stats
) and wait for it to stop outputting data
Any better approaches would be much appreciated!