.. _multi-robot-setup: Multi Robot Scenario -------------------- Have bought more than one robot from us? Planning to do a research with fleet of Neobotix robots? Not sure how to start? This tutorial will be a kick starter guide for all your question related to setting up and using multiple Neobotix robots deploying ROS 2 for an application or research. .. Note:: This tutorial assumes that, you already have gone through the the :ref:`installation` steps and :ref:`start-with-ros-on-the-robot` know the basic working of our robots. If you have brought brand new robots from us directly then you can skip the installation procedures given below. The main essence for the set-up of the multi robot system is the Namespace. Namespace is just like the names for the human twins, they look alike but are differentiated mainly by their names. The main subjective idea here is to explain how to configure, set up and the navigate your robots with different namespaces. Installation ============ Multi robot environment is currently supported for mpo_700, mpo_500 and mp_400 on the real robot and mpo_700 and mp_400 for the simulation. .. Note:: Currently, we have this support only for ROS 2 - Humble. If you required support for any other distros, please feel free to contact us. Please update all the repositories in the robots workspaces in order to get the updates made for the multi-robot scenario. Finally in order to have visualize and control multiple robots in the same RViz, `clone the neo_fleet_rviz2 plugin `_. Build all the packages cloned from the src of your workspace using ``colcon_build --symlink-install``. Configuration ============= Kinematics ********** For the robots with differential kinematics such as the MP-400 and MP-500, it is essential to setup the odom frame id to have a trailing "/" at the beginning of the frame id. For example, the odom must be inputted to `/odom` and base_link to `/base_link`. The similar steps must be adapted to mecanum and the omnidrive kinematics. Navigation ********** An example configuration of handling multi-robot system can be found in `our mp_400 repo for ros2 `_. In this config file you can note that the name of the frames must be changed according to the namespaces. For the rest of the tutorial, we assume that the user will use `robot1` has the namespace. For now, there is a strict rule on the naming convention of the robot and needs to be named with "robot" + robot_number. For the robot environments with two robots, then the namespaces will be configured as robot1 and robot2 respectively. It is important to note that, all the neobotix packages are developed with a default support to the namespaces. Therefore it is necessary for the users to carefully specify the frame ids as parameters wherever necessary. In almost all the cases, the frame ids should have a "/" at the beginning. For example, while inputting the frame id for the odometry in the kinematics configs, it is essential to use "/odom". .. Attention:: In those cases that doesn't require namespacing, it is essential to remove the trailing "/" especially in the frame ids of the differential / omnidirectional kinematics configurations. Environment variables ********************* For the robots to communicate between each other, it is essential that the robot are connected to a network having the same subnet mask. Once that is verified, check that the robots that needs to communicate with each other are on the same ros domain id. The default settings of the neobotix robots are set to domain id 0. But, depending on the application demands, the domain ids could be adjusted in the bashrc. Launch ====== Driver Bringup ************** The first task will be to launch all the robot specific drivers in different namespace. In case if you had bought brand new robots with ROS 2 from us, we would have configured an autostart for ROS on your robot. In that scenario, you need to do the following: .. Note:: If you have brought a multi robot setup from us already, the bringup would be already pre-configured. :: gedit ~/ROS_AUTOSTART.SH This will open the autostart script. Now in line 7, remove the entire line and replace it with: :: ros2 launch neo_mpo_700-2 bringup.launch.py robot_namespace:="robot1" Nav2 bringup ************ Once we are done with bringing up the drivers, the next step is to bringup the nav2 packages of our robot. Thanks to the flexibility provided by the ``neo_nav2_bringup`` package, it was easy to organize the launch files for the multi robot system. .. Note:: The mapping procedure is same as that of the procedures which you would have seen in the :ref:`start-with-ros-on-the-robot`. The first step would be again to change the autostart script. In line 9 replace the entire line with: :: ros2 launch neo_mpo_700-2 navigation.launch.py namespace:="robot1" use_multi_robots:=True head_robot:=True **namespace:** Allows you to set the intended namespace in String. **use_multi_robots:** You will be able to set namespace to your robot, if and only if this parameter is set to True. (Bool) **head_robot:** Only the head robot will run the map server. So every robot in the particular fleet will share single map. **params_file** Parameter file for the navigation. .. Attention:: Freshly brought multi robot setup will have the default configuration set to multi_robot_navigation.yaml. RViz2 bringup ************* Visualization is very important to see how our robots behave. In order to do that, we have developed a special RViz2 plugin, in which you will be able to select and send goals to the robot. Of course, we have just one RViz to visualize all the robots in the specified environment for a fleet. In order to start the RViz run the following command from your workspace directory to brings up all the necessary plugins: :: ros2 launch neo_nav2_bringup rviz_launch.py rviz_config:=install/neo_nav2_bringup/share/neo_nav2_bringup/rviz/multi_robot.rviz RViz get's started with the pre-set configuration, you can see the TF's of the robot as shown here: .. figure:: multi_robot_rviz.png .. note:: We here have localized the robot already. Please make sure to localize the robots, by selecting each one at a time from the plugin. Once you are done with the localization, you are free to send goals to the corresponding robots. Simulation ********** If you want to try it out in the simulation, we also have it in a seperate branch of our neo_simulation repo, that can be found `here `_ For simulation, you just have to just run couple of steps as follows: :: ros2 launch neo_simulation2 multi_robot_simulation.launch.py :: ros2 launch neo_simulation2 multi_robot_navigation.launch.py Follow the RViz2 bringup steps shown above to bring up the RViz. By default, the namespacing follows the nomenclature "robot" + "robot_number". The definitions will be robot0, robot1 and so on.