gz-sim icon indicating copy to clipboard operation
gz-sim copied to clipboard

Expose random seed through CLI

Open chapulina opened this issue 2 years ago • 0 comments

Desired behavior

It should be possible to pass a custom seed to the random number generator from the CLI. For example:

gz sim --seed 123 my_pseudo_random_world.sdf

Alternatives considered

Don't use the CLI and instead instantiate the simulator through a custom C++ program. This way, the seed can be passed to ServerConfig::SetSeed:

https://github.com/ignitionrobotics/ign-gazebo/blob/49fb65fc2a079303bfe47f0a92983179363e0f04/include/ignition/gazebo/ServerConfig.hh#L307-L309

Implementation suggestion

Additional context

It looks like we supported the --seed option on Blueprint, see https://github.com/ignitionrobotics/ign-gazebo/commit/fe9cbdfc6f09cd72450842768af0d74344fda379. But we missed it when migrating from server_main.cc to ign.cc in https://github.com/ignitionrobotics/ign-gazebo/commit/7dbc19e6ab3d5789819cd3855cd5445e78b70d80.

chapulina avatar May 02 '22 22:05 chapulina