Skip to content

hucebot/ros2_realsense_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS 2 RealSense Docker

Minimal Docker setup to run an Intel RealSense camera with ROS 2 Humble, publish RGB-D + pointcloud topics, and use CycloneDDS for networked ROS communication.

What this repo provides

  • A ROS 2 Humble image with RealSense ROS packages preinstalled (.ci/Dockerfile)
  • A docker compose service configured for USB camera access and host networking (docker-compose.yaml)
  • A launch script that starts realsense2_camera_node and publishes a static TF (scripts/launch_realsense.sh)
  • A CycloneDDS profile with selectable network interfaces (configs/cyclonedds.xml)
  • Convenience make targets for build/run/debug lifecycle (Makefile)

Prerequisites

  • Docker Engine + Docker Compose plugin
  • Linux host with RealSense camera connected over USB
  • Access to /dev/bus/usb on host (provided via privileged + bind mount in compose)

Optional but recommended:

  • make

Quick start

  1. Build image:
make build
  1. Start container:
make up
  1. View logs:
make logs
  1. Open shell in running container:
make shell
  1. Stop container:
make down

Runtime behavior

When the service starts, it runs:

source /opt/ros/humble/setup.bash
./launch_realsense.sh

The launch script:

  • Starts realsense2_camera_node in namespace /rgbd
  • Uses camera node name realsense_default by default
  • Enables color, depth, aligned depth, and pointcloud output
  • Publishes a static transform from head_front_camera_link to <camera_name>_link

You can override camera name by running inside the container:

./launch_realsense.sh my_camera

DDS / networking

CycloneDDS is configured through:

  • CYCLONEDDS_URI=/etc/cyclonedds/cyclonedds.xml

The mounted file is configs/cyclonedds.xml, where you can adjust:

  • Network interfaces (<NetworkInterface ... />)
  • Multicast behavior
  • Message sizing / discovery settings

The compose service uses network_mode: host, and ROS domain is set with:

  • ROS_DOMAIN_ID=2
  • RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

Makefile commands

  • make build - build Docker image
  • make up - start service in background
  • make down - stop and remove container
  • make logs - follow container logs
  • make shell - enter running container (bash)
  • make clean - stop container and remove built images

Project structure

.
├── .ci/Dockerfile
├── configs/cyclonedds.xml
├── docker-compose.yaml
├── Makefile
└── scripts/launch_realsense.sh

Troubleshooting

  • Camera not detected:

    • Check host USB visibility: lsusb
    • Confirm camera is present under /dev/bus/usb
    • Restart service after reconnecting camera: make down && make up
  • No ROS discovery across machines:

    • Verify both sides use same ROS_DOMAIN_ID
    • Verify network interface names in configs/cyclonedds.xml
    • Confirm multicast is allowed on your network
  • Node starts but no expected TF alignment:

    • Check TARGET_FRAME in scripts/launch_realsense.sh
    • Ensure the target frame exists in your robot TF tree

Notes

  • This setup assumes ROS 2 Humble.
  • The container runs with elevated privileges to access USB devices.

About

Docker file and script for the tiago pro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors