2b-t / realsense-ros2-docker Goto Github PK
View Code? Open in Web Editor NEWDockerfile for Intel Realsense camera in ROS 2
License: MIT License
Dockerfile for Intel Realsense camera in ROS 2
License: MIT License
So I'm trying to run the nvidia gui file on jetson nano.
I installed docker-compose on the nano using pip3:
sudo apt update && sudo apt -y upgrade
sudo apt install curl python3-pip libffi-dev python-openssl libssl-dev zlib1g-dev gcc g++ make -y
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install setuptools-rust
sudo python3 -m pip install docker-compose
I might've missed some packages that I installed!
then I did:
xhost +local:root
docker compose -f docker-compose-gui-nvidia.yml build
docker compose -f docker-compose-gui-nvidia.yml up
and with the last command I get this output:
/usr/local/lib/python3.6/dist-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography (40.0) will be the last to support Python 3.6.
from cryptography.hazmat.backends import default_backend
Building realsense_ros2
Sending build context to Docker daemon 139.8kB
Step 1/9 : FROM ros:humble-perception
---> bad31d6015e0
Step 2/9 : ENV WS_DIR="/ros2_ws"
---> Using cache
---> b351c85dd87d
Step 3/9 : WORKDIR ${WS_DIR}
---> Using cache
---> 5c526ba274d9
Step 4/9 : SHELL ["/bin/bash", "-c"]
---> Using cache
---> 6fedfec2692e
Step 5/9 : ARG DEBIAN_FRONTEND=noninteractive
---> Using cache
---> 4cb30bb908bd
Step 6/9 : RUN apt-get update -y && apt-get install -y build-essential cmake git-all software-properties-common
---> Using cache
---> d4f66f96e17b
Step 7/9 : RUN apt-get update -y && apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE && add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u && apt-get install -y librealsense2-dbg librealsense2-dev librealsense2-dkms librealsense2-utils
---> Running in 4e125806f392
Hit:1 http://packages.ros.org/ros2/ubuntu jammy InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Reading package lists...
W: http://packages.ros.org/ros2/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Executing: /tmp/apt-key-gpghome.pvaIdQjDQ2/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
gpg: key C8B3A55A6F3EFCDE: public key ""CN = Intel(R) Intel(R) Realsense", O=Intel Corporation" imported
gpg: Total number processed: 1
gpg: imported: 1
Hit:1 http://packages.ros.org/ros2/ubuntu jammy InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Get:6 https://librealsense.intel.com/Debian/apt-repo jammy InRelease [2400 B]
Fetched 2400 B in 2s (1378 B/s)
Reading package lists...
W: http://packages.ros.org/ros2/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: https://librealsense.intel.com/Debian/apt-repo/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Repository: 'deb https://librealsense.intel.com/Debian/apt-repo jammy main'
Description:
Archive for codename: jammy components: main
More info: https://librealsense.intel.com/Debian/apt-repo
Adding repository.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_librealsense_intel_com_debian_apt-repo-jammy.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_librealsense_intel_com_debian_apt-repo-jammy.list
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package librealsense2-dbg
E: Unable to locate package librealsense2-dev
E: Unable to locate package librealsense2-dkms
E: Unable to locate package librealsense2-utils
The command '/bin/bash -c apt-get update -y && apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE && add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u && apt-get install -y librealsense2-dbg librealsense2-dev librealsense2-dkms librealsense2-utils' returned a non-zero code: 100
ERROR: Service 'realsense_ros2' failed to build : Build failed
Any thoughts?
In the main readme in section launching a reference is made to realsense-viewer
but the installation instructions using binaries do not install librealsense-utils
which has the realsense-viewer directive.
I can make a PR to add these, wanted to check first if they should be added to the default setup or as some optional tool, for example through multi-stage builds or docker compose config.
Hello,
thank you for this marvelous work :)
I use ROS2 galactic in ubuntu 18.04 docker container.
I followed your guideline with a slight modification and I encountered the error that says
No stream match for pointcloud chosen texture Process - Color
The dockerfile lines that I used is as below:
RUN apt-get install kmod && \
cd ~ && \
wget https://github.com/IntelRealSense/librealsense/archive/refs/tags/v2.51.1.zip && \
unzip v2.51.1.zip && \
cd ~/librealsense-2.51.1 && \
./scripts/patch-realsense-ubuntu-L4T.sh && \
apt-get install git libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev -y && \
./scripts/setup_udev_rules.sh && \
mkdir build && cd build && \
cmake .. -DCMAKE_C_FLAGS_RELEASE="${CMAKE_C_FLAGS_RELEASE} -s" -DCMAKE_CXX_FLAGS_RELEASE="${CMAKE_CXX_FLAGS_RELEASE} -s" -DCMAKE_INSTALL_PREFIX=/opt/librealsense -DBUILD_PYTHON_BINDINGS:bool=true -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=release -DFORCE_RSUSB_BACKEND=false -DBUILD_WITH_CUDA=true && make -j$(($(nproc)-1)) && sudo make install && \
cd ~ && \
wget https://github.com/IntelRealSense/realsense-ros/archive/refs/tags/4.51.1.zip && \
apt-get install python3-rosdep -y && \
unzip 4.51.1.zip && \
cd realsense-ros-4.51.1 && \
rm /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep init && rosdep update && rosdep install -i --from-path src --rosdistro $ROS_DISTRO --skip-keys=librealsense2 -y && \
colcon build --symlink-install && \
. install/local_setup.zsh
and I use the docker run command refering to yours
docker run --name jetson-tmp5 -d -it --runtime nvidia -e "ACCEPT_EULA=Y" --ipc=host --privileged --network=host \
-v $(pwd)/..:/workspace:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
-v /dev:/dev \
-v /usr/src:/usr/src \
-v /etc/nv_tegra_release:/etc/nv_tegra_release \
-v /etc/udev/rules.d:/etc/udev/rules.d \
-v /lib/modules/4.9.140-tegra:/lib/modules/4.9.140-tegra \
--device-cgroup-rule='c 81:* rmw' \
--device-cgroup-rule='c 189:* rmw' \
kenloumixx/jetson-rs
In installing librealsense and realsense-ros, I also referred to the guideline described in the README.md
May I ask which part is wrong?
TIA
Hello,
I'm trying to use your docker with a Raspberry Pi 4 4GB, running Raspbian Bullseye aarch64. The docker compose build
and docker compose up
commands work without errors.
However, when I try to use the container I get the following error:
root@0c938c5b80bd:/ros2_ws# rs-enumerate-devices
02/01 17:55:11,308 ERROR [548659127392] (librealsense-exception.h:52) /dev/video10 is no video capture device Last Error: Invalid argument
02/01 17:55:11,308 ERROR [548659127392] (sensor.cpp:661) acquire_power failed: /dev/video10 is no video capture device Last Error: Invalid argument
Could not create device - /dev/video10 is no video capture device Last Error: Invalid argument . Check SDK logs for details
02/01 17:55:11,408 ERROR [548659127392] (librealsense-exception.h:52) /dev/video12 is no video capture device Last Error: Invalid argument
02/01 17:55:11,409 ERROR [548659127392] (sensor.cpp:661) acquire_power failed: /dev/video12 is no video capture device Last Error: Invalid argument
Could not create device - /dev/video12 is no video capture device Last Error: Invalid argument . Check SDK logs for details
02/01 17:55:11,509 ERROR [548659127392] (librealsense-exception.h:52) /dev/video18 is no video capture device Last Error: Invalid argument
02/01 17:55:11,509 ERROR [548659127392] (sensor.cpp:661) acquire_power failed: /dev/video18 is no video capture device Last Error: Invalid argument
Could not create device - /dev/video18 is no video capture device Last Error: Invalid argument . Check SDK logs for details
Segmentation fault (core dumped)
The Raspberry detects the Realsense without problem:
$ lsusb
Bus 002 Device 002: ID 8086:0b64 Intel Corp. Intel(R) RealSense(TM) 515
Am I missing something to configure in the docker or Raspberry?
Thank you!
ros2 launch realsense2_camera rs_launch.py pointcloud.enable:=true enable_gyro:=true enable_accel:=true
Running the above straight away throws error. I would like to get the /camera/imu
topic.
662 ERROR [139936804103744] (librealsense-exception.h:52) Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] 30/01 23:18:37,663 ERROR [139936804103744] (backend-hid.cpp:1005) Hid device is busy!
[realsense2_camera_node-1] [ERROR] [1706656717.663373915] [camera.camera]: ./src/rs_node_setup.cpp:370:An exception has been thrown: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] Failed to start device: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] [INFO] [1706656717.664063767] [camera.camera]: Stopping Sensor: Motion Module
[realsense2_camera_node-1] [INFO] [1706656717.667175929] [camera.camera]: Starting Sensor: Motion Module
[realsense2_camera_node-1] 30/01 23:18:37,667 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.4.auto
[realsense2_camera_node-1] 30/01 23:18:37,667 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.3.auto
[realsense2_camera_node-1] 30/01 23:18:37,668 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.5.auto
[realsense2_camera_node-1] 30/01 23:18:37,668 WARNING [139936384665152] (backend-hid.h:48) write_fs_attribute with accel_3d-dev1 failed. The specified path /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/trigger/current_trigger is not valid
[realsense2_camera_node-1] 30/01 23:18:37,668 ERROR [139936644707904] (librealsense-exception.h:52) Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] 30/01 23:18:37,669 ERROR [139936644707904] (backend-hid.cpp:1005) Hid device is busy!
[realsense2_camera_node-1] [ERROR] [1706656717.669156742] [camera.camera]: ./src/rs_node_setup.cpp:370:An exception has been thrown: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] [ERROR] [1706656717.669198501] [camera.camera]: Error updating the sensors: Failed to open scan_element /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.5/0003:8086:0B5C.003C/HID-SENSOR-200073.7.auto/iio:device1/scan_elements/in_accel_y_en Last Error: Read-only file system
[realsense2_camera_node-1] 30/01 23:18:37,694 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.4.auto
[realsense2_camera_node-1] 30/01 23:18:37,694 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.3.auto
[realsense2_camera_node-1] 30/01 23:18:37,694 WARNING [139936804103744] (backend-hid.cpp:1205) Failed to read busnum/devnum. Custom HID Device Path: /sys/bus/platform/drivers/hid_sensor_custom/HID-SENSOR-2000e1.5.auto
[realsense2_camera_node-1] [INFO] [1706656717.695129269] [camera.camera]: Device with serial number 318122301758 was found.
[realsense2_camera_node-1]
[realsense2_camera_node-1] [INFO] [1706656717.695212644] [camera.camera]: Device with physical ID /sys/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1.1/4-1.1:1.0/video4linux/video4 was found.
[realsense2_camera_node-1] [INFO] [1706656717.695230950] [camera.camera]: Device with name Intel RealSense D456 was found.
[realsense2_camera_node-1] [INFO] [1706656717.695577886] [camera.camera]: Device with port number 4-1.1 was found.
[realsense2_camera_node-1] [INFO] [1706656717.695596253] [camera.camera]: Device USB type: 3.2
[realsense2_camera_node-1] [INFO] [1706656717.695807486] [camera.camera]: Stop Sensor: Depth Module
[realsense2_camera_node-1] [INFO] [1706656717.695832956] [camera.camera]: Close Sensor.
[realsense2_camera_node-1] [WARN] [1706656718.101862981] [camera.camera]:
[realsense2_camera_node-1] 30/01 23:18:38,267 ERROR [139936795711040] (librealsense-exception.h:52) get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Protocol error
[realsense2_camera_node-1] 30/01 23:18:38,267 ERROR [139936795711040] (global_timestamp_reader.cpp:239) Error during time_diff_keeper polling: get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Protocol error
[realsense2_camera_node-1] 30/01 23:18:38,280 ERROR [139936636315200] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 20 error: No such device
[realsense2_camera_node-1] 30/01 23:18:38,280 ERROR [139936636315200] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 20 error: No such device
[realsense2_camera_node-1] 30/01 23:18:38,280 ERROR [139936636315200] (backend-v4l2.cpp:2771) xioctl(VIDIOC_QBUF) failed when requesting new frame! fd: 20 error: No such device
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.