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#
Connect an Intel® RealSense™ camera (for example, D435i) to the host.
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
Note
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).
If the image is not installed, Intel® recommends installing the Robot Complete Kit with the Get Started Guide for Robots.
Check that EI for AMR environment is set:
echo $AMR_TUTORIALS # should output the path to EI for AMR tutorials /home/user/edge_insights_for_amr/Edge_Insights_for_Autonomous_Mobile_Robots_2023.1/AMR_containers/01_docker_sdk_env/docker_compose/05_tutorials
If nothing is output, refer to Get Started Guide for Robots Step 5 for information on how to configure the environment.
Run the command below to start the Docker* container:
docker compose -f $AMR_TUTORIALS/realsense.tutorial.yml run --rm realsense bash
Check for latest Intel® RealSense™ firmware updates.
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.
During the firmware update installation, do not disconnect the Intel® RealSense™ camera. Press Install in the window popup.
After the installation is complete or if no update is available, close the Intel® RealSense™ viewer.
Exit the Docker* image:
exit
Run an automated yml file that opens the Intel® RealSense™ ROS 2 node and lists camera-relevant information.
docker compose -f $AMR_TUTORIALS/realsense.tutorial.yml up
Expected output: The image from the Intel® RealSense™ camera is displayed in rviz2, on the bottom left side.
To close this, do the following:
Type
Ctrl-c
in the terminal where you did the up command.Run this command to remove stopped containers:
docker compose -f $AMR_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.
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
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 $AMR_TUTORIALS/realsense.tutorial.yml run --rm 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 calibration issues, see https://dev.intelrealsense.com/docs/self-calibration-for-depth-cameras.
For general robot issues, go to: Troubleshooting for Robot Tutorials.