Setting Up RealSense in LXC
Introduction
This guide explains how to set up an additional RealSense camera in an LXC container running ubuntu 20.04 Focal. The container uses Ubuntu 22.04 for newer software compatibility.
Steps
1. Prepare the Container
Install LXC:
sudo apt-get install lxc
Launch the Container:
lxc launch ubuntu:22.04 my-container
Install Required Software in the Container:
sudo apt-get install librealsense2 ros-foxy-desktop realsense2-camera
2. Device Mapping
Identify Device Information:
lsusb
Note the
vendorid
andproductid
.Map the USB Device:
lxc config device add my-container realsense usb vendorid=8086 productid=0b07 gid=1000
3. Video Devices Mapping
Map
/dev/videoX
Devices:ls -la /dev/video* lxc config device add my-container video0 unix-char path=/dev/video0 gid=1000 lxc config device add my-container video1 unix-char path=/dev/video1 gid=1000
4. Restart and Test
Restart the Container:
lxc restart my-container
Test the Setup:
source /opt/ros/foxy/setup.bash ros2 launch realsense2_camera rs_launch.py
Conclusion
This setup allows the use of the RealSense D435i camera within an LXC container on a Jetson device, leveraging the host’s kernel and maintaining compatibility with other RealSense cameras.
For more details, refer to the original GitHub issue.
Notes
Title Image - Marc Auledas, CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0, via Wikimedia Commons