Documentation

  • 2021.2
  • 06/30/2021
  • Public Content

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

Run the Sample Application

  1. Connect an Intel® RealSense™ camera (for example, D435I or L515) 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>
  4. Launch ROS nodes for the camera:
    # for D435i camera model: ros2 launch realsense2_camera rs_launch.py align_depth:=true & # for L515 camera model: ros2 launch realsense2_camera rs_launch.py color_width:=1280 color_height:=720 color_fps:=30. &
    Expected output:
  5. 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
  6. 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
    .
  7. 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
    .
  8. Run the rviz2 command. The image from the Intel® RealSense™ camera will be displayed in rviz:
    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.

Summary and Next Steps

In this tutorial, you learned how to launch ROS nodes for camera, list the ROS topics, see that 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 rviz.

Product and Performance Information

1

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