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:
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
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 ara available for all MARA environments.