Let's begin with the main launch file.
We are going to either run this project with a single robot that doesn't use namespaces, or with two different robots. To do it, simply switch comments in the following section:
As you can see, robot has a name, initial position, and color (name and RGB). I am using identical robots in this project; if robots were different, that same array should have contained names for robot-specific URDF files.
Also, please pay attention later in "Build and Run" section, as to run this all properly, you should set both mode and file for RViz to use.
In this project I am not going to touch SLAM or Nav2, however we can pass "mode" to the launch file. Mode can be one of the following: simple, slam, map (currently, only "simple" is implemented). "simple" means that we are not going to use neither SLAM toolbox, nor the nav2.
From the earlier projects, we have inherited the bringup launch file. It takes boolean "slam" parameter, if "slam" is True, SLAM toolbox is launched, if False, nav2 is launched.
Now, we have a non-boolean "mode" instead, but we still can get "slam" value from it, so we don't have to pass both "mode" and "slam". In other words, we "fake" the "slam" parameter, creating it on the spot, rather than getting it from command line.