gym_gazebo2 Usage

If you added the privisioning script to your ~/.bashrc, you can directly execute the algorithm. Load the environment variables manually otherwise.

cd ~/gym-gazebo2/examples/MARA
python3 -g

Every MARA environment provides three command-line customization arguments. You can read the details by using the -h option in any MARA-script (e.g: python3 -h). The help message is the following:

usage: [-h] [-g] [-r] [-v VELOCITY] [-m | -p PORT]

MARA environment argument provider.

optional arguments:
  -h, --help            show this help message and exit
  -g, --gzclient        Run user interface.
  -r, --real_speed      Execute the simulation in real speed and using the
                        running specific driver.
  -v VELOCITY, --velocity VELOCITY
                        Set servo motor velocity. Keep < 1.57 for real speed.
                        Applies only with -r --real_speed option.
  -m, --multi_instance  Provide network segmentation to allow multiple
  -p PORT, --port PORT  Provide exact port to the network segmentation to
                        allow multiple instances.

If you want to get faster simulation speeds, you should launch the simulation withouht the visual interface of gazebo. But it is possible that you want to check the learnt policy at some point without stoping the training, so this is how you do it:

  • Launch the visual interfaze of gazebo:
  • If you used the -m --multi_instance option to provide network segmentation, do the following:

In a new terminal, set the corresponding GAZEBO_MASTER_URI: For convinience, this environment variable is printed at the beginning of every Env execution. Just copy and export it. You can also find information related to any running execution inside /tmp/gym-gazebo2/running/ folder. Example:

export GAZEBO_MASTER_URI=http://localhost:11285

Finally launch the client:


Final note: you can launch as many gzserver and gzclient instances as you want as long as you manage properly the GAZEBO_MASTER_URI environment variable.