Attention

You are viewing an older version of the documentation. The latest version is v3.3.

Robot Operating System Software

ROS2 Overview

The Robot Operating System* (ROS*) is a flexible framework for writing robot software. It is a collection of tools, libraries, and conventions that aim to simplify the task of creating complex and robust robot behavior across a wide variety of robotic platforms.

../../_images/ros_equation.png

ROS2 is the second generation of ROS system in which new technologies and implementations were adopted to better fit Software-defined industrial systems.

ROS2 is built on top of DDS/RTPS as its middleware (RMW), which provides discovery, serialization, and transportation. DDS is an end-to-end middleware that provides features relevant to the ROS systems, such as distributed discovery (not centralized like in ROS 1) and control over different “Quality of Service” options for the transportation.

../../_images/ros2_arch.png

DDS 1.4 is the industry OMG standard proposed by multiple of vendors as ROS2 implementations:

RTPS 2.2 (also known as DDSI-RTPS) is the industry OMG interoperable wire-protocol standard used by DDS to communicate over the network.

../../_images/Ros2_humble.png

Intel® Edge Controls for Industrial (Intel® ECI or ECI) provides several hardware-accelerated subsystems and plug & play extensions compatible with the latest ROS2 Humble Hawksbill rosdistro , including:

For more information, refer to the official ROS2 Humble documentation

Install Robot Operating System Software

ROS is comprised of many elements, some of which require a graphical Desktop Environment to function. The installation of ROS is divided into “Core” components which do not require graphics, and “Desktop” components which require a Linux Desktop environment installation. Follow the sections below based on your application requirements.

Note

ROS2 Humble Hawksbill only redistributes full Deb packages for Canonical Ubuntu* 22.04 (Jammy Jellyfish) and Red Hat Enterprise Linux* 9.3 (Plow) (e.g. Tier1). Consequently, the ECI APT repository redistributes ROS2 Humble Hawksbill full Deb packages for Debian* 11 (Bullseye).

Install ROS2 Core Components

ROS2 Core elements do not require a graphical Desktop Environment. You can install the ROS2 Core components from the ECI APT repository. Perform the following steps to install ROS2 Core components:

  1. Setup the ECI APT repository.

  2. Enable Intel® Graphics Compute Runtime Level-Zero and OpenCL™ GPU.

  3. Enable Intel® oneAPI DPC++ and OpenMP Compute Runtimes.

  4. Setup the ROS2 APT repository:

    # download the key to system keyring
    $ sudo -E wget -O- https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | sudo tee /usr/share/keyrings/ros-archive-keyring.gpg > /dev/null
    
    # add signed entry to apt sources and configure the APT client to use ROS repository:
    $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $VERSION_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list
    

    Attention

    If you are located in the People’s Republic of China, modify the /etc/hosts file to directly connect to the raw.githubusercontent server:

    $ sudo bash -c "echo '185.199.108.133 raw.githubusercontent.com' >> /etc/hosts"
    
  5. Update the APT sources lists:

    $ sudo apt update
    
  6. Install ROS2 Core components from the ECI meta-package:

    $ sudo apt install eci-robotics
    
  7. Optionally, setup the Intel RealSense2 APT repository as described in Intel® RealSense™ SDK 2.0 guidelines

    Note

    ECI APT repository redistributes librealsense2-dkms Deb packages compatible with the various ECI Linux Intel LTS Kernel.

Install ROS2 Desktop Components

If you plan on using any ROS2 “Desktop” components (ex: RViz) then complete the following steps to setup ROS with graphics:

  1. Install the ROS2 Core components

  2. If your target system does not already have a graphical Desktop Environment, complete the following section to install a graphical Desktop Environment before proceeding further: Install a graphical Desktop Environment

  3. Install ROS2 “Desktop” components of your choice. For example:

    $ sudo apt install \
      ros-humble-rviz2 \
      ros-humble-gazebo-ros \
      ros-humble-gazebo-ros-pkgs \
      ros-humble-moveit \
      ros-humble-moveit-servo \
      ros-humble-cartographer-ros\
      ros-humble-turtlebot3 \
      ros-humble-navigation2 \
      ros-humble-nav2-bringup \
      ros-humble-desktop
    

Getting Started with ROS2

Setup the Robotic node

../../_images/target_generic2.png
  1. Install ROS2 Core or ROS2 Desktop components, if not already completed.

  2. Initialize the ROS2 workspace:

    $ source /opt/ros/humble/setup.bash
    

    Expected Result:

    The script is correctly executed without any “Error” or “Warning” messages being printed.

  3. Run the following command in the same terminal:

    $ ros2 --help
    

    Expected Result:

    The command executes without any “Error” or “Warning” messages being printed. The command also prints information similar to the following:

    root@eci-intel-25d7:~# ros2 --help
    usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...
    
    ros2 is an extensible command-line tool for ROS 2.
    
    optional arguments:
      -h, --help            show this help message and exit
    
    Commands:
      action     Various action related sub-commands
      component  Various component related sub-commands
      daemon     Various daemon related sub-commands
      interface  Show information about ROS interfaces
      launch     Run a launch file
      lifecycle  Various lifecycle related sub-commands
      multicast  Various multicast related sub-commands
      node       Various node related sub-commands
      param      Various param related sub-commands
      pkg        Various package related sub-commands
      run        Run a package specific executable
      security   Various security related sub-commands
      service    Various service related sub-commands
      test       Run a ROS2 launch test
      topic      Various topic related sub-commands
    
      Call `ros2 <command> -h` for more detailed usage.
    

    Note: The output might differ based on the version of the integrated ROS.

  4. Verify that the required ROS2 packages (such as ros_core, launch_ros, and ros2pkg) exist.

    $ source /opt/ros/humble/setup.bash
    $ ros2 pkg list | egrep '(ros2|ros_core|launch_ros)'
    

    The output should be a list similar to the following:

    launch_ros
    ros2action
    ros2cli
    ros2component
    ros2doctor
    ros2interface
    ros2launch
    ros2lifecycle
    ros2multicast
    ros2node
    ros2param
    ros2pkg
    ros2run
    ros2service
    ros2topic
    ros_core
    sros2
    sros2_cmake
    
  5. Add the ROS2 setup script to the .bashrc file so that ROS2 is enabled in new terminal sessions:

    $ echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
    $ echo 'export ROS_DOMAIN_ID=31' >> ~/.bashrc
    $ source ~/.bashrc
    

    Note: If other ROS2 instances are using ROS_DOMAIN_ID=31, you may want to change ROS_DOMAIN_ID to different number (lesser than 255) to avoid conflicts.

ROS2 DDS/RSTP Communication sanity-check

  1. Setup the Robotic node.

  2. Open a terminal, run the following command in the same terminal:

    $ ros2 topic pub /chatter std_msgs/String "data: Hello ECI"
    

    Expected Result:

    The command is correctly executed without any “Error” or “Warning” messages being printed. The command also prints information similar to the following:

    sh-5.0# source /opt/ros/humble/setup.sh
    sh-5.0# ros2 topic pub /chatter std_msgs/String "data: Hello ECI"
    publisher: beginning loop
    publishing #1: std_msgs.msg.String(data='Hello ECI')
    publishing #2: std_msgs.msg.String(data='Hello ECI')
    publishing #3: std_msgs.msg.String(data='Hello ECI')
    publishing #4: std_msgs.msg.String(data='Hello ECI')
    publishing #5: std_msgs.msg.String(data='Hello ECI')
    publishing #6: std_msgs.msg.String(data='Hello ECI')
    
  3. Open a new terminal, and run the following command:

    $ ros2 topic echo /chatter
    

    Tip

    If you receive a message WARNING: topic [/chatter] does not appear to be published yet, verify that the environment variable ROS_DOMAIN_ID has been properly set to the same value in both terminal environments.

    Expected Result:

    The command is correctly executed without any “Error” or “Warning” messages being printed. The command also prints information similar to the following:

    sh-5.0# ros2 topic echo /chatter
    data: Hello ECI
    ---
    data: Hello ECI
    ---
    data: Hello ECI
    ---
    

ROS2 Navigation Stack

The Navigation2 stack takes in information from odometry and sensor streams and outputs velocity commands to send to a mobile base. As a pre-requisite for navigation stack use, the robot must be running ROS, have a TF transform tree in place, and publish sensor data using the correct ROS Message types. Also, the navigation stack needs to be configured for the shape and dynamics of a robot to perform at a high level.

Navigation2 provides perception, planning, control, localization, visualization, and much more to build highly reliable autonomous systems integrated with the ROS2.

../../_images/nav_comic.png

Launch Navigation2 Sanity Check

  1. Install ROS2 Desktop components, if not already completed.

  2. Setup the Robotic node.

  3. Run a simple ROS2 turtlebot3_navigation2 simulation example:

    $ export TURTLEBOT3_MODEL=waffle
    $ ros2 launch turtlebot3_navigation2 navigation2.launch.py use_sim_time:=True autostart:=True
    

    Expected Result:

    Navigation stack starts correctly, without exiting.

    ../../_images/turtlebot_rviz.png

    Note: Since Navigation is currently in Idle status, it is normal to see warnings/errors such as Waiting for xxxx [service|server] or Time out ... or ...tf error: ....

    [bt_navigator-7] [INFO] [1607067383.422534950] [bt_navigator_rclcpp_node]: Waiting for "global_costmap/clear_entirely_global_costmap" service
    [bt_navigator-7] [INFO] [1607067383.422589829] [bt_navigator_rclcpp_node]: "ClearGlobalCostmap-Subtree" BtServiceNode initialized
    [bt_navigator-7] [INFO] [1607067383.427102038] [bt_navigator_rclcpp_node]: Waiting for "spin" action server
    [bt_navigator-7] [INFO] [1607067383.427317616] [bt_navigator_rclcpp_node]: "Spin" BtActionNode initialized
    [bt_navigator-7] [INFO] [1607067383.433162780] [bt_navigator_rclcpp_node]: Waiting for "wait" action server
    [bt_navigator-7] [INFO] [1607067383.433352841] [bt_navigator_rclcpp_node]: "Wait" BtActionNode initialized
    [lifecycle_manager-9] [INFO] [1607067383.433790244] [lifecycle_manager_navigation]: Configuring waypoint_follower
    [waypoint_follower-8] [INFO] [1607067383.433976703] [waypoint_follower]: Configuring
    [lifecycle_manager-9] [INFO] [1607067383.449495492] [lifecycle_manager_navigation]: Activating controller_server
    [controller_server-4] [INFO] [1607067383.449637024] [controller_server]: Activating
    [controller_server-4] [INFO] [1607067383.449659646] [local_costmap.local_costmap]: Activating
    [controller_server-4] [INFO] [1607067383.449669836] [local_costmap.local_costmap]: Checking transform
    [controller_server-4] [INFO] [1607067383.449680783] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
    [controller_server-4] [INFO] [1607067383.949742206] [local_costmap.local_costmap]: Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
    

Simultaneous Localization and Mapping (SLAM)

SLAM is a method used for autonomous vehicles that enables map building and localization of a vehicle in that map simultaneously. SLAM algorithms allow the vehicle to map out unknown environments. Engineers use the map information for tasks such as path planning and obstacle avoidance, the features of which are covered in ROS2 navigation stack.

Cartographer is an implementation of SLAM, which has already been integrated with the ROS2 system.

../../_images/cartographer.png

Launch SLAM Sanity Check

  1. Install ROS2 Desktop components, if not already completed.

  2. Setup the Robotic node.

  3. Run a simple ROS2 turtlebot3_cartographer simulation example:

    $ ros2 launch turtlebot3_cartographer cartographer.launch.py use_sim_time:=True
    

    Expected Result:

    Cartographer starts correctly.

    Note: Since Cartographer is currently in Idle status, it is normal to see warnings/errors. The following is a sample result:

    [INFO] [launch]: All log files can be found below /home/root/.ros/log/2020-09-25-04-56-52-691691-intel-rt-corei7-64-14812
    [INFO] [launch]: Default logging verbosity is set to INFO
    [INFO] [cartographer_node-1]: process started with pid [14821]
    [INFO] [occupancy_grid_node-2]: process started with pid [14822]
    [cartographer_node-1] [WARN] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
    [occupancy_grid_node-2] [WARN] [occupancy_grid_node]: submap_slices and last_frame_id is empty
    [occupancy_grid_node-2] [WARN] [occupancy_grid_node]: submap_slices and last_frame_id is empty
    

Robot Motion Planning Framework - MoveIt2

MoveIt, an easy-to-use open source robotics manipulation platform for developing commercial applications, prototyping designs, and benchmarking algorithms, is the most widely used software for manipulation. It is released under the terms of the BSD license, and thus free for industrial, commercial, and research use.

../../_images/moveit_features.png

By incorporating the latest advances in motion planning, manipulation, 3D perception, kinematics, control, and navigation, MoveIt is state-of-the-art software for mobile manipulation.

../../_images/moveit_rviz.png

Moveit also supports visual features such as out-of-the-box visual demonstration in RVIZ, simulation combining Gazebo and ROS Control, native step-by-step configuration wizard, and so on.