This repository provides a Dockerized environment for using the Intel RealSense L515 depth camera with ROS2 Foxy. It is designed to solve driver compatibility issues and provide a ready-to-use ROS2 topic stream. We have provided Dockerfile so that the community can quickly use L515.
- Base Image: Ubuntu 20.04 (Focal)
- ROS2 Version: Foxy Fitzroy
- LibRealSense: v2.54.1 (Last supported version for L515)
- RealSense-ROS: Compatible version for ROS2 Foxy
- Rootless Docker Support: Configured to run without root privileges on the host (requires udev rules).
- Visualization: Includes RViz2 configuration.
- Docker: Installed on your host machine (Rootless mode is supported).
- RealSense Device: Intel RealSense L515 (or other models compatible with librealsense 2.54).
To access the camera from a Docker container without using --privileged, you need to configure udev rules and user groups on your host machine.
-
Add current user to video group:
sudo usermod -aG video $USERLog out and log back in for this to take effect.
-
Setup udev rules: Create
/etc/udev/rules.d/99-realsense-libusb.rules:sudo nano /etc/udev/rules.d/99-realsense-libusb.rules
Add the following content:
SUBSYSTEM=="usb", ATTRS{idVendor}=="8086", MODE="0666" SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", MODE="0666" KERNEL=="iio*", ATTRS{idVendor}=="8086", MODE="0666" KERNEL=="video*", ATTRS{idVendor}=="8086", MODE="0666", GROUP="video"Reload rules:
sudo udevadm control --reload-rules && sudo udevadm trigger
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/RealSense-Docker.git cd RealSense-Docker -
Build the Docker image:
docker compose build
We use docker compose to manage the camera node and RViz visualization.
-
Configure Display (If using remote X11): Ensure your X server is running and accessible. If you are running this on a remote server and visualizing on a local machine via SSH X11 forwarding or a tunnel, update the
DISPLAYenvironment variable indocker-compose.ymlto point to your host's IP (e.g.,10.5.20.132:0or whatever your setup requires).Note: For Rootless Docker,
network_mode: hostmight not resolve127.0.0.1correctly to the host user namespace. Use the host's actual LAN IP. -
Launch Services:
docker compose up -d
This starts two containers:
realsense: The driver node publishing topics.rviz: The visualization tool.
-
Access the Container (Optional): If you need to run commands manually:
docker compose exec realsense bash
-
RViz should open automatically.
-
Set Fixed Frame: In the "Global Options" (left panel), change "Fixed Frame" to
camera_linkorcamera_depth_optical_frame. -
Add Image: Click "Add" -> "Image" -> set topic to
/camera/color/image_raw. -
Add PointCloud (Optional): Click "Add" -> "PointCloud2" -> set topic to
/camera/depth/color/points.Note: To see point clouds, you must enable the filter when launching the node:
ros2 launch realsense2_camera rs_launch.py enable_pointcloud:=true align_depth.enable:=true
It is already the default setting.
- Ensure you have added the udev rules on the host.
- Ensure your user is in the
videogroup. - Try re-plugging the camera.
- If running multiple containers on the same host, they might default to Shared Memory (SHM) transport, which fails between isolated containers.
- We included
fastdds_udp.xmland configuredFASTRTPS_DEFAULT_PROFILES_FILEindocker-compose.ymlto force UDP transport. Ensure this file is correctly mounted.
- Check your
DISPLAYenvironment variable. - If using Xming/VcXsrv on Windows via SSH:
- Ensure your SSH client enables X11 forwarding or you have a tunnel set up.
- Try setting
DISPLAYto your host IP address (e.g.,192.168.x.x:0) instead oflocalhost.
This project is licensed under the MIT License - see the LICENSE file for details.