1.2. Large data communication with ROS 2 (a practical example)

This use case explains how to use ROSbot XL with Orbbec Astra camera to perform autonomous navigation and mapping while taking images of the environment. This tutorial serves to demonstrate the new auto-configuration of Fast DDS, the default communications middleware in ROS 2, for sending large data between multiple systems in a distributed environment.

As we will see throughout this case study, enabling large data mode in Vulcanexus is as simple as setting FASTDDS_BUILTIN_TRANSPORTS=LARGE_DATA environment variable.

This command changes the default configuration of the transport layer in Fast DDS to better support the large data packages that the Orbbec Astra camera sends from the robot to the remote machine, among others.



1.2.1. Background

In this demo we will use an ROSbot XL - an autonomous mobile robot platform by Husarion, equipped with a RPLIDAR A2 laser scanner, and a RGB-D Orbbec Astra, to demonstrate the new Fast DDS builtin configuration to transmit large data.

The activation of this Fast DDS mode of operation is triggered by executing the following command before running any ROS 2 node.

export FASTDDS_BUILTIN_TRANSPORTS=LARGE_DATA

If you want to know more about the changes made to the middleware, please refer to the Fast DDS documentation.

The ROSbot XL is an affordable robot platform for rapid development of autonomous robots. It can be a base for industrial robots, custom service robots, inspection robots and robots working in swarms.

../../../_images/rosbotxl.png

RViz2 is a 3D visualization tool developed for ROS 2. It allows the display of ROS 2 Topics and the extension of its capabilities through the development of plugins.

../../../_images/rviz.png

rosbot_xl_ros is the GitHub repository from Husarion where you can find the ROS 2 Launch files and configurations for the ROSbot XL. All its contents are explained below.

../../../_images/rosbot_xl_ros_repository.png

sllidar_ros2 is the GitHub repository from Husarion where you can find the ROS 2 Launch files and configurations for the RPLIDAR A2. All its contents are explained below.

../../../_images/sllidar_ros2_repository.png

astra-docker is the GitHub repository from Husarion where you can find the Dockerfile to install and clone all the necessary packages to launch the Orbbec Astra camera in ROS 2.

../../../_images/astra-docker_repository.png

Nav2 is the ROS 2 Navigation Stack that provides a modular architecture for autonomous navigation in robots. It includes packages for mapping, localization, path planning, and obstacle avoidance.

../../../_images/nav2.png

MicroXRCEAgent acts as a server between the DDS Network and eProsima Micro XRCE-DDS Clients applications. It is part of the Micro XRCE-DDS stack, which is the default middleware for micro-ROS. It allows the ROS 2 stack to communicate with the micro-ROS stack.

../../../_images/microxrceagent.png

1.2.2. Prerequisites

This use case assumes that you have a ROSbot XL equipped and ready to use with an Orbbec Astra camera. If this is not your case, please refer to the ROSbot XL Quick Start guide to set up your robot. It is also necessary to have a machine with Vulcanexus installed. Please refer to Vulcanexus installation guide to install Vulcanexus in your device.

Below are the steps to install the necessary packages and dependencies to run the demo.

  1. Clone the rosbot_xl_ros repository from GitHub into your workspace directory using the following command:

    git clone https://github.com/husarion/rosbot_xl_ros.git
    
  2. Add the sllidar_ros2 GitHub repository into your workspace directory with the following command:

    git clone https://github.com/husarion/sllidar_ros2.git
    
  3. Follow the installation instructions provided on the NAV 2 website to install the nav2_bringup package.

  4. Please refer to the provided Dockerfile at this link to install the astra_camera package. This Dockerfile facilitates the installation and cloning of all necessary packages required to launch the Orbbec Astra camera in ROS 2.

Ensure that all dependencies and prerequisites are met before proceeding further with the use case.

1.2.3. ROS 2 Packages

The ROS 2 Packages involve in the demo are the following:

  • rosbot_xl_bringup: a ROS 2 package that provides the ROS 2 launch files and configurations for the ROSbot XL.

  • sllidar_ros2: a ROS 2 package that provides the ROS 2 node for the RPLIDAR A2.

  • astra_camera: a ROS 2 package that provides the ROS 2 driver for Orbbec 3D cameras.

  • nav2_bringup: a ROS 2 package that provides the ROS 2 launch files and configurations for the NAV 2 stack.

1.2.4. Execution

The execution of the demo is divided into two parts:

  1. ROSbot XL bring-up.

  2. Launch the controller on the user computer.

1.2.4.1. ROSbot XL

First, it is necessary to setup the Vulcanexus environment and the ROS 2 workspace in all the terminals.

source /opt/vulcanexus/humble/setup.bash
source $HOME/ROS2-ws/install/setup.bash

Then set the environment variable FASTDDS_BUILTIN_TRANSPORTS to LARGE_DATA on all the terminals. As mentioned before, this command changes the default configuration of the transport layer in Fast DDS to better support the large data packages that are going to be sent in this demo.

export FASTDDS_BUILTIN_TRANSPORTS=LARGE_DATA

Warning

Do not forget to run the above commands in all terminals to correctly setup Vulcanexus and ROS 2 to use the large data mode.

  1. Micro XRCE Agent

    Launch the Micro XRCE Agent running the following command in a terminal.

    MicroXRCEAgent udp4 --port 8888
    
  2. ROSbot XL Bringup

    Then, launch the ROSbot XL Bringup running the following command in another terminal. The mecanum argument is optional and it is used to set the robot as a mecanum robot.

    ros2 launch rosbot_xl_bringup bringup.launch.py mecanum:=True
    
  3. RPLIDAR A2

    Launch the RPLIDAR A2, specifying the baud rate and port:

    ros2 launch sllidar_ros2 sllidar_launch.py serial_baudrate:=115200 serial_port:=/dev/ttyRPLIDAR
    
  4. SLAM

    In order to launch SLAM, run the following command. The map argument is optional and it is used to set the path of the map file. The use_sim_time argument is optional and it is used to set the use time provided by simulation. The params_file argument is optional and it is used to set the path of the parameters file.

    ros2 launch nav2_bringup slam_launch.py map:=/maps/map.yaml use_sim_time:=False params_file:=/home/husarion/rosbot-xl-autonomy/config/nav2_rpp_params.yaml
    
  5. NAV 2

    In order to launch the NAV 2 stack, run the following command. The use_sim_time argument is optional and it is used to set the use time provided by simulation. The params_file argument is optional and it is used to set the path of the navigation configuration file.

    ros2 launch nav2_bringup navigation_launch.py use_sim_time:=False params_file:=/home/husarion/ros2_ws/config/nav2_rpp_params.yaml
    
  6. Orbbec Astra

    Finally, launch the Orbbec Astra camera running the following command.

    ros2 launch astra_camera astra_mini.launch.py
    

Note

The ROS 2 launch files explained earlier are executed using a single ROS 2 launch file for ease of use. You can locate this launch file here.



Now the ROSbot XL is ready to move around the environment and create a map!

1.2.4.2. External computer

First, it is necessary to load the Vulcanexus environment and the ROS 2 workspace.

source /opt/vulcanexus/humble/setup.bash
source $HOME/ROS2-ws/install/setup.bash

It is then necessary to set the FASTDDS_BUILTIN_TRANSPORTS environment variable to LARGE_DATA to change the default transport layer configuration to support the large data packets sent by the Orbbec Astra camera.

export FASTDDS_BUILTIN_TRANSPORTS=LARGE_DATA

Finally, launch RViz2 and set the configuration file to visualize the robot and the environment.

ros2 run rviz2 rviz2


Now, the laptop is prepared to visualize the environment and robot movement. You can navigate the environment, set goals, and generate maps effectively.

1.2.5. Troubleshooting

If Large Data mode of Fast DDS is not sufficient to see the image and navigation costmap correctly in RViz, it is possible that the limiting factor for communications is the machine on which we run ROS 2. To improve communications, it is possible to apply some settings to each device running ROS 2, such as increasing the size of the system’s network buffers. To do this, run the following commands:

sudo sysctl -w net.core.rmem_max=100000000
sudo sysctl -w net.core.wmem_max=100000000

1.2.6. Next steps

This tutorial has explained how to configure ROS 2 for large data transmission. Stay tuned as this auto-configuration will be extended in future versions of Vulcanexus, offering more middleware configuration options via the same environment variable.