Skip to content

flyingmarkk/RealSense-L515-Docker

Repository files navigation

RealSense L515 ROS2 Docker Environment

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.

Features

  • 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.

Prerequisites

  1. Docker: Installed on your host machine (Rootless mode is supported).
  2. RealSense Device: Intel RealSense L515 (or other models compatible with librealsense 2.54).

Host Configuration (Crucial for Rootless Docker)

To access the camera from a Docker container without using --privileged, you need to configure udev rules and user groups on your host machine.

  1. Add current user to video group:

    sudo usermod -aG video $USER

    Log out and log back in for this to take effect.

  2. 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

Installation

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/RealSense-Docker.git
    cd RealSense-Docker
  2. Build the Docker image:

    docker compose build

Usage

Start the Camera and Visualization

We use docker compose to manage the camera node and RViz visualization.

  1. 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 DISPLAY environment variable in docker-compose.yml to point to your host's IP (e.g., 10.5.20.132:0 or whatever your setup requires).

    Note: For Rootless Docker, network_mode: host might not resolve 127.0.0.1 correctly to the host user namespace. Use the host's actual LAN IP.

  2. Launch Services:

    docker compose up -d

    This starts two containers:

    • realsense: The driver node publishing topics.
    • rviz: The visualization tool.
  3. Access the Container (Optional): If you need to run commands manually:

    docker compose exec realsense bash

Viewing Data in RViz

  1. RViz should open automatically.

  2. Set Fixed Frame: In the "Global Options" (left panel), change "Fixed Frame" to camera_link or camera_depth_optical_frame.

  3. Add Image: Click "Add" -> "Image" -> set topic to /camera/color/image_raw.

  4. 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.

Troubleshooting

Camera Not Found / Permission Denied

  • Ensure you have added the udev rules on the host.
  • Ensure your user is in the video group.
  • Try re-plugging the camera.

No Images in RViz (Communication Issues)

  • 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.xml and configured FASTRTPS_DEFAULT_PROFILES_FILE in docker-compose.yml to force UDP transport. Ensure this file is correctly mounted.

"Could not connect to display"

  • Check your DISPLAY environment 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 DISPLAY to your host IP address (e.g., 192.168.x.x:0) instead of localhost.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgement

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors