Attention

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

Intel® RealSense™ ROS 2 Sample Application

This tutorial tells you how to:

  • Launch ROS nodes for a camera.

  • List ROS topics.

  • See that Intel® RealSense™ topics are publishing data.

  • Get data from the Intel® RealSense™ camera (data coming at FPS).

  • See an image from the Intel® RealSense™ camera displayed in rviz2.

Run the Intel® RealSense™ ROS 2 Sample Application

  1. Connect an Intel® RealSense™ camera (for example, D435i) to the host.

  2. To download and install the Intel® RealSense™ ROS 2 sample application run the command below:

    sudo apt-get install ros-humble-realsense2-tutorial-demo
    
    Copy to clipboard
  3. Set up your ROS 2 environment

    source /opt/ros/humble/setup.bash
    
    Copy to clipboard
  4. Launch Intel® RealSense™ viewer and check for any firmware updates.

    1. To download and install the Intel® RealSense™ viewer run the command below:

      sudo apt-get install librealsense2-dkms
      sudo apt-get install librealsense2-udev-rules
      sudo apt-get install librealsense2-utils
      
      Copy to clipboard
    2. Open the Intel® RealSense™ viewer application:

      sudo -E realsense-viewer
      
      Copy to clipboard

      In the Intel® RealSense™ viewer, if any firmware update is available, a window popup appears in the upper right corner.

    3. During the firmware update installation, do not disconnect the Intel® RealSense™ camera. Press Install in the window popup.

    4. After the installation is complete or if no update is available, close the Intel® RealSense™ viewer.

  5. Run the Intel® RealSense™ ROS 2 sample application:

    /opt/ros/humble/share/realsense/tutorial-realsense/realsense-demo.sh
    
    Copy to clipboard

    Expected output: The image from the Intel® RealSense™ camera is displayed in rviz2, on the bottom left side.

    ../../../_images/7D402688-0369-4FDA-BB1B-107523B9B43F-low.png
  6. To close this, do the following:

    • Type Ctrl-c in the terminal where you did the command for tutorial.