Installing Intel Realsense toolkit on NVIDIA Jetson

Prashant Dandriyal
3 min readDec 8, 2021

Size is the anchor of performance ~Warren Buffett

Method 1 has been performed on a Jetson Xavier AGX flashed with JetPack v4.4; Jetson L4T version: 32.4.3 (+Ubuntu 18.04LTS). We’ll be referencing official intel REALSENSE documentation. Check kernel version using uname -r. Also, CUDA must be installed, preferably during flashing JetPack. Method 2 has been tested on JetPack v4.5+.

METHOD 1: Building from Source using RSUSB Backend (without kernel patching)

  • The method was verified with Jetson AGX boards with JetPack 4.2.3[L4T 32.2.1,32.2.3], 4.3[L4T 32.3.1] and 4.4[L4T 32.4.3].
  • The medhod has not yet been verified on the Jetson Nano board.

Prerequisites

  • Internet connection on the Jetson Xavier.
  • Space > 2.5 GB. (check using df -h)
  • Toggle MAX_POWER mode (mode 0) using
sudo /usr/sbin/nvpmodel -m 0
  • Disconnect attached USB/UVC cameras (if any).

Build and Patch Kernel Modules for Jetson L4T

git clone https://github.com/IntelRealSense/librealsense.git
cd librealsense
  • Run the script
./scripts/patch-realsense-ubuntu-L4T.sh

Successful attempt looks like this:

Build librealsense2 SDK

  • Install the missing components and configuration items:
cd librealsense
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

During this, if you get prompts like the one below, choose option No.

  • Reboot
  • Build as follows:
cd librealsense
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev -y
./scripts/setup_udev_rules.sh mkdir build && cd build cmake .. -DBUILD_PYTHON_BINDINGS:bool=true -DBUILD_EXAMPLES=true -DCMAKE_BUILD_TYPE=release -DFORCE_RSUSB_BACKEND=false -DBUILD_WITH_CUDA=truesudo make uninstall && sudo make clean && sudo make -j4 && sudo make installexport PYTHONPATH=$PYTHONPATH:/usr/local/lib
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/pyrealsense2

You might need to reboot and then re-export the PYTHONPATH to import pyrealsense2.

import error in python scripts

It’s possible that the library might not be imported/found while running the python script that includes import pyrealsense2. In this case, you’ll need to explicitly add paths everytime you import it.

############################################################## Initialize REALSENSE
import sys
sys.path.insert(0, "/usr/local/lib/python3.6/pyrealsense2")
import pyrealsense2 as rs

METHOD 2: Installing with Debian packages

The docs suggest a simpler method for the latest JetPack versions, where method 1 fails.

  • Register the server’s public key
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
  • Add the server to the list of repositories
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u
  • Install the SDK
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev

That’s it; a simpler and faster method. Check installation using realsense-viewer or compiling a C++ application using g++ -std=c++11 filename.cpp -lrealsense2 .

Please let me know if this helps you 😃

If I could help you, you can also send me some crypto like Solana, Ethereum, Doge or coins on BSC. 🤠

SOL wallet: Geyvsojk1KAegziagYAJ5HWaDuAFYKZAS2KpqZeag9DM

BSC wallet: 0x47acC4B652166AE55fb462e4cD7DD26eFa97Da04

ETH wallet: 0x47acC4B652166AE55fb462e4cD7DD26eFa97Da04

Doge wallet: DFT6Pydzw7RAYG1ww4RRfctBKqyiXbbBwk

--

--