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.
- A ROS 2 Humble image with RealSense ROS packages preinstalled (
.ci/Dockerfile) - A
docker composeservice configured for USB camera access and host networking (docker-compose.yaml) - A launch script that starts
realsense2_camera_nodeand publishes a static TF (scripts/launch_realsense.sh) - A CycloneDDS profile with selectable network interfaces (
configs/cyclonedds.xml) - Convenience
maketargets for build/run/debug lifecycle (Makefile)
- Docker Engine + Docker Compose plugin
- Linux host with RealSense camera connected over USB
- Access to
/dev/bus/usbon host (provided viaprivileged+ bind mount in compose)
Optional but recommended:
make
- Build image:
make build- Start container:
make up- View logs:
make logs- Open shell in running container:
make shell- Stop container:
make downWhen the service starts, it runs:
source /opt/ros/humble/setup.bash
./launch_realsense.shThe launch script:
- Starts
realsense2_camera_nodein namespace/rgbd - Uses camera node name
realsense_defaultby default - Enables color, depth, aligned depth, and pointcloud output
- Publishes a static transform from
head_front_camera_linkto<camera_name>_link
You can override camera name by running inside the container:
./launch_realsense.sh my_cameraCycloneDDS 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=2RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
make build- build Docker imagemake up- start service in backgroundmake down- stop and remove containermake logs- follow container logsmake shell- enter running container (bash)make clean- stop container and remove built images
.
├── .ci/Dockerfile
├── configs/cyclonedds.xml
├── docker-compose.yaml
├── Makefile
└── scripts/launch_realsense.sh
-
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
- Check host USB visibility:
-
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
- Verify both sides use same
-
Node starts but no expected TF alignment:
- Check
TARGET_FRAMEinscripts/launch_realsense.sh - Ensure the target frame exists in your robot TF tree
- Check
- This setup assumes ROS 2 Humble.
- The container runs with elevated privileges to access USB devices.