Intel Realsens on Ubuntu 20.04 + ROS noetic (installation desription)

asked 2020-10-21 02:24:21 -0500

Markus Bader gravatar image

updated 2021-02-18 04:19:44 -0500

[deprecated] Feb 2021

Ubuntu 20.04 LTS is now natively supported by the RealSenseā„¢ SDK 2.0.

Intel Realsens on Ubuntu 20.04

I just like to share my installation desription for my intel realsense d435 on ubuntu 20.04 with ros noetic. At the moment the realsense interface is without python bindings.


# preparations
export REALSENSE_SOURCE_DIR=$HOME/projects/librealsense/
sudo apt-get install guvcview git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

# build
export REALSENSE_INSTALL_PREFIX=/opt/realsense
sudo chown $USER:$USER -R $REALSENSE_INSTALL_PREFIX # not relay needed -> you could run _make_ followed by _sudo make install_
make install

# extend the ld search path
sudo sh -c "echo $REALSENSE_INSTALL_PREFIX/lib > /etc/"
sudo ldconfig

# udev rules
cd ~/projects/librealsense/
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/99-realsense-libusb.rules && sudo udevadm control --reload-rules && udevadm trigger

# make cmake config avaliable
echo "export realsense2_DIR=/opt/realsense/lib/cmake/realsense2" >> ~/.bashrc

# reboot




export REALSENSE_ROS_WS=$HOME/projects/ros/ws00
sudo apt install ros-noetic-ddynamic-reconfigure
git clone $REALSENSE_ROS_WS/src/realsense-ros


rm -rf /opt/realsense
sudo rm /etc/
sudo ldconfig
sudo rm /etc/udev/rules.d/99-realsense-libusb.rules
sudo udevadm control --reload-rules && udevadm trigger
# --> remove the line "export realsense2_DIR=/opt/realsense/lib/cmake/realsense2" from ~/.bashrc
edit retag flag offensive close merge delete


Thanks a ton! This really helped me!

BuilderMike gravatar image BuilderMike  ( 2020-10-30 22:59:46 -0500 )edit

Does this require to install an older kernel? Because the first apt-get throws an error:

ERROR (dkms apport): kernel package linux-headers-5.4.0-56-generic is not supported
Error! Bad return status for module build on kernel: 5.4.0-56-generic (x86_64)
Consult /var/lib/dkms/librealsense2-dkms/1.3.12/build/make.log for more information.
thodor gravatar image thodor  ( 2020-12-11 07:48:59 -0500 )edit

@thodor I used a vanilla 20.04 that I downloaded on Oct 30; and I'm pretty sure the kernel was a 5.4.0, as that is the kernel for 20.04 ( My current kernel is 5.4.0-56-generic, but it's possible that the patch revision was less than 56 at the time this procedure worked for me; however I think the kernel and the patch number might not be the issue. Hope it works out for you...

BuilderMike gravatar image BuilderMike  ( 2020-12-12 15:53:32 -0500 )edit

Note: To preserve compatibility by staying on a 5.4 kernel on 20.04 and not the newer 5.8 kernel (that by default you will get auto-upgraded to as of ~Jan 2021), you can hold some packages like described here: (No idea what's up with that failure with a 5.4.0-56 kernel though :/ )

erelson gravatar image erelson  ( 2021-04-19 12:55:24 -0500 )edit

How would this change if it were to apply python bindings? Is it as simple as changing -DBUILD_PYTHON_BINDINGS=false to -DBUILD_PYTHON_BINDINGS=true?

honchozthename gravatar image honchozthename  ( 2022-02-28 23:05:21 -0500 )edit