Network segmentation

In this simple tutorial we will learn how to take advantage of one of the command line arguments you can supply to the environment.

-m, --multi_instance : Provide network segmentation to allow multiple instances.

-p PORT, --port PORT : Provide exact port to the network segmentation to allow multiple instances.

Sometimes we will need to run multiple gazebo and ROS 2 instances and there are two main reasons for this:

  • The algorithm we want to use benefits from running multiple instances at the same time.
  • We are sharing the network with some colleague that is running other ROS or Gazebo components.

Either if its to solve a network conflict at the office or if its to improve a learning process, segmenting the network is a necessary option. This simple means setting different ROS_DOMAIN_ID and GAZEBO_MASTER_URI variables, so that multiple instances don't interact or cause conflicts with each other.

-p PORT comes handy when you are sharing the network with another developer and you don't want to interfere with that person. Just agree which port you are going to use for your partners and always use that one.

-m can tackle the same problem, but it includes the automatic free port selection, as a random free port is selected (from 10000 to 15000). This is really useful when using automatic multiple instance launchers (external to gym-gazebo2) as each one of the automatically launched instances will get a different segment of the network.

These command line arguments and more are available for all MARA environments.