Repeatability of Experiments and Determinism of Gazebo Simulation
Hello,
This has been discussed for previous versions of gazebo, but I could not really find a solution, so I am posting:
Lets say I am making an experiment in gazebo, with a control algorithm. Due to non-deterministic nature of the simulation, I get varying results each time I run the simulation. At first, I thought the variation between results had to be my computer slowing down, especially disk i/o, so I shutdown all the logging, cameras, [I have a top down looking camera, that saves to the disk] - So I shut all the extras off, and rerun my experiment, and I found out that the results still do vary.
The experiment in question uses a small robot, with differential drive plugin, so I plotted the odometry data, to find out, YES, the control algorithm, does indeed produce different outputs, that leads to different simulations.
I have tried stepping ~world_control externally, also to test if any bottleneck in the system was causing variations, but again, even if you wait a long time between steps, it still produces different results, under same circumstances. (a little of course)
Is there any way, that I can get repeatability in my experiments? Are there any parameters for the gazebo sim, that can make the simulation less realistic, but more repeatable.
There has been a discussion about the RNG salt during init, but that was gazebo 1.9, and I could not access the page of discussion, since it was deleted, and it was not also in archive.org.
Any ideas/recomendations/help on the problem much appreciated.
Best Regards, ~C.
Asked by altineller on 2020-05-03 03:11:38 UTC
Answers
I was able to make a deterministic and repeatable Gazebo simulation using the --seed argument. If you're launching with ROS, I believe this is available as a parameter to the launch file. You have to be careful though that you're not doing any message passing at all including when you spawn your model - with Gazebo+ROS it's very easy to accidentally have IPC that you don't realize.
I actually asked this question myself about a year ago and spawning the model at a non-deterministic time turned out to be my problem :)
Asked by Jenny B on 2020-06-12 19:46:06 UTC
Comments