documentation:vision:realsense2-ros

Realsense2 + ROS

Minimal test setup in ROS containers:

To allow hardware to work within containers you have to use the option use-real which will map /dev inside (for USB communication) and run docker in --priviledged mode which will allow the container to have the same priviledges as outside the container for interacting with hardware.

# Install realsense drivers
# Get distribution environment variables
. /etc/lsb-release
export repo="https://librealsense.intel.com/Debian/apt-repo"
export repo_check="$repo $DISTRIB_CODENAME main"
export repo_add="$repo main"
if ! grep -q "^deb .*$repo_check" /etc/apt/sources.list /etc/apt/sources.list.d/*; then\
    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 "$repo_add" -u
else
    echo "Realsense repo exists already."
fi

sudo apt update
sudo apt install -y librealsense2-dkms librealsense2-utils librealsense2-dev ros-noetic-realsense2-camera

To get all Robotlab pieces for vision there is a config:

workspace init minimal_vision.rosinstall
cd ~/catkin_ws
catkin build
workspace shell
roslaunch vision realsense_d435.launch   # launches a node

If you get an error similar to this: failed to open usb interface: 0, error: RS2_USB_STATUS_ACCESS

This is known to be fixable by a firmware update of the Realsense D435 camera.

  • documentation/vision/realsense2-ros.txt
  • Last modified: 2023/01/19 10:06
  • by marcusk