Get Started Guide

  • 2021.3
  • 10/21/2021
  • Public Content

Run an Intel® RealSense™ ROS 2 Sample Application in Docker* Container

Run the Sample Application

  1. Connect an Intel® RealSense™ camera (for example, D435i) to the host.
  2. Go to the
    AMR_containers
    folder:
    cd <edge_insights_for_amr_path>/Edge_Insights_for_Autonomous_Mobile_Robots_<version>/AMR_containers
  3. Run the command below to start the Docker container:
    ./run_interactive_docker.sh amr-ubuntu2004-full-flavour-sdk:<TAG> eiforamr
  4. 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.
  5. Launch ROS nodes for the camera:
    # for D435i camera model: ros2 launch realsense2_camera rs_launch.py align_depth:=true &
    Expected output:
  6. Display the ROS topics list:
    ros2 topic list
    The following topics are displayed:
    /camera/aligned_depth_to_color/camera_info /camera/aligned_depth_to_color/image_raw /camera/color/camera_info /camera/color/image_raw /camera/depth/camera_info /camera/depth/image_rect_raw /camera/extrinsics/depth_to_color
  7. Send command to see that RealSense topics are publishing data:
    ros2 topic echo /camera/color/image_raw
    The published data will have the following structure:
    -- header: stamp: sec: 1618393694 nanosec: 869479680 frame_id: camera_color_optical_frame height: 720 width: 1280 encoding: rgb8 is_bigendian: 0 step: 3840 data: - 159 - 174 - 156 - 163 ...
    Press
    CTRL+C
    .
  8. Get data from the Intel® RealSense™ camera (data coming at FPS):
    ros2 topic hz /camera/color/image_raw
    Data received from the device:
    average rate: 29.709 min: 0.020s max: 0.049s std dev: 0.00422s window: 32 average rate: 29.784 min: 0.020s max: 0.051s std dev: 0.00470s window: 62 average rate: 29.772 min: 0.020s max: 0.051s std dev: 0.00436s window: 92
    Press
    CTRL+C
    .
  9. Run the rviz2 command. The image from the Intel® RealSense™ camera will be displayed in rviz2:
    ros2 run rviz2 rviz2 --display-config rviz2
    In rviz2 press:
    1. ADD
      button - By Topic - /camera/color/image_raw/Camera and press
      OK
      .
    2. ADD
      button - By Topic - /camera/aligned_depth_to_color/image_raw/Camera and press
      OK
      .
    3. From top, left side at
      Fixed Frame
      select
      camera_link
      or
      camera_color_frame
      .
    4. From top, left side go to
      Camera > Topic > Reliability Policy >
      select
      Best Effort
      (perform this step for both Cameras from the left side).
    5. The image from the Intel® RealSense™ camera will be displayed in rviz2, bottom left side.

Troubleshooting

If the following error is encountered:
$ ./run_interactive_docker.sh amr-ubuntu2004-full-flasvour-sdk:<TAG> eiforamr bash: ./run_interactive_docker.sh Permission denied
Give executable permission to the script:
$ chmod 755 run_interactive_docker.sh
For Intel® RealSense™ documentation, see https://dev.intelrealsense.com/docs/docs-get-started.

Summary and Next Steps

In this tutorial, you learned how to launch ROS nodes for camera, list the ROS topics, see that Intel® RealSense™ topics are publishing data, get data from Intel® RealSense™ camera (data coming at FPS), and how to see image from Intel® RealSense™ camera displayed in rviz2.

Product and Performance Information

1

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