Using A realsense camera in a docker container running ROS - VTAstrobotics/Documentation GitHub Wiki

Contents

Prerequisites

To understand the content on this page, you should know how to

  • Run a docker container from an image
  • Install packages

How to

After the Jetson is booted you'll need to install some software if it isn't already installed. you'll need to do the following outside of the docker container.

sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE

sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u

sudo apt-get install librealsense2-utils sudo apt-get install librealsense2-dev

you can test it with the following command--plug in the camera.

realsense-viewer

next you need to pull and run in privaleged mode the following docker container. docker pull camtriggerhappy/rosrealsense:realsense

Just in case here is the docker file used:

# Taken from these places:

# https://github.com/IntelRealSense/realsense-ros?tab=readme-ov-file#installation

# should only be build on the jetson

ARG ROS_DISTRO=humble

FROM ros:${ROS_DISTRO} as base

ENV ROS_DISTRO=${ROS_DISTRO}

RUN sudo apt update && sudo apt install python3-pip -y

# https://stackoverflow.com/questions/63472872/building-from-dockerfile-and-getting-the-following-signatures-couldnt-be-verif # RUN sudo apt update && sudo apt install curl # RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

RUN sudo apt install software-properties-common -y && sudo apt update

RUN sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE

RUN sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u

RUN sudo apt update -y && sudo apt upgrade -y

RUN sudo apt install ros-humble-librealsense2* -y

RUN sudo apt install ros-humble-realsense2-* -y

RUN sudo apt install ros-humble-desktop -y

#RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ # && source install/setup.bash \ # && ros2 run realsense2_camera realsense2_camera_node # RUN sudo apt-get install librealsense2-utils -y && sudo apt-get install librealsense2-dev -y

RUN sudo apt update -y && sudo apt upgrade -y

RUN sudo apt install ros-humble-realsense2-* -y

you should now be able to run the ros node following the instructions on the intel github