Developer Guide

  • 2022.3
  • 10/25/2022
  • Public Content
Contents

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 Sample Application

  1. Connect an Intel® RealSense™ camera (for example, D435i) to the host.
  2. Check if your installation has the amr-realsense Docker* image.
    docker images |grep amr-realsense #if you have it installed, the result is: amr-realsense
    If one or both of the images are not installed, continuing with these steps
    triggers a build that takes longer than an hour
    (sometimes, a lot longer depending on the system resources and internet connection).
  3. If the image is not installed, Intel recommends installing the Robot Complete Kit with the Get Started Guide for Robots.
  4. Go to the
    AMR_containers
    folder:
    cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_*/AMR_containers
  5. Prepare the environment setup:
    source ./01_docker_sdk_env/docker_compose/common/docker_compose.source export CONTAINER_BASE_PATH=`pwd` export ROS_DOMAIN_ID=12
  6. Run the command below to start the Docker* container:
    CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/01_amr/amr-sdk.all.yml run realsense bash
  7. Check for latest Intel® RealSense™ firmware updates.
    1. Open the Intel® RealSense™ viewer application:
      realsense-viewer
      In the Intel® RealSense™ viewer, if any firmware update is available, a window popup appears in the upper right corner.
    2. During the firmware update installation, do not disconnect the Intel® RealSense™ camera. Press
      Install
      in the window popup.
    3. After the installation is complete or if no update is available, close the Intel® RealSense™ viewer.
    4. Exit the Docker* image:
      exit
  8. Run an automated yml file that opens the Intel® RealSense™ ROS 2 node and lists camera-relevant information.
    CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/realsense.tutorial.yml up
    Expected output: The image from the Intel® RealSense™ camera is displayed in rviz2, on the bottom left side.
  9. To close this, do one of the following:
    • Type
      Ctrl-c
      in the terminal where you did the up command.
    • Run this command in another terminal:
    CHOOSE_USER=eiforamr docker-compose -f 01_docker_sdk_env/docker_compose/05_tutorials/realsense.tutorial.yml down

Troubleshooting

In some cases, the stream may not appear due to permission issues on the host. You may see this error message:
ERROR: Pipeline doesn't want to pause.
  1. To fix this, install the librealsense udev rules.
    git clone https://github.com/IntelRealSense/librealsense # Copy the 99-realsense-libusb.rules files to the rules.d folder cd librealsense sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules sudo udevadm trigger
  2. Then open the
    gst-launch
    command.
If the problem persists, you can try any or all of the following:
  • Verify that $DISPLAY has the correct value.
  • Perform an Intel® RealSense™ hardware reset:
# Open realsense docker container docker-compose -f 01_docker_sdk_env/docker_compose/01_amr/amr-sdk.all.yml run realsense bash # While in realsense container, open the realsense-viewer application realsense-viewer # In realsense-viewer menu, go to "More" and then select "Hardware Reset" # Wait for reset to complete and then close the realsense-viewer application.
  • Reboot the target.
For Intel® RealSense™ documentation, see https://dev.intelrealsense.com/docs/docs-get-started.
For general robot issues, go to: Troubleshooting for Robot Tutorials.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.