본문 바로가기

카테고리 없음

Jetson nano Realsense-L515 빌드

우분투 환경에서 파이썬 버전이 3.8이상이면

pip install pyrealsense2

로 손쉽게 설치가 가능했는데, 실제로 젯슨 나노에서 파이썬 버전이 3.8이상임에도 불구하고 설치가 안되더라.

 

$ pip install pyrealsense2

# 오류 메세지
ERROR: Could not find a version that satisfies the requirement pyrealsense2 (from versions: none)
ERROR: No matching distribution found for pyrealsense

 

https://github.com/IntelRealSense/librealsense/issues/6296#issuecomment-672768158

 

pyrealsense2 Python3.8 support · Issue #6296 · IntelRealSense/librealsense

This is related to #5777 Pyrealsense2 should support Python3.8+ without needing to build manually.

github.com

여기서 확인해보니 젯슨 나노에서는 pip install pyrealsense2를  지원안한다고 하더라..

그래서 실제로 CMAKE기반으로 빌드를 직접 해줘야 하는 불편함이 생겼다.

 

젯슨 나노에서 쉽게 빌드할 수 있는 방법을 가져왔다.

https://github.com/IntelRealSense/librealsense/issues/7722#issue-736687248

 

I have written a set of instructions to install librealsense and pyrealsense2 on the Jetson NX · Issue #7722 · IntelRealSense/

There seems to be quite a lot of interest (and difficulty) in installing pyrealsense2 on the Jetson: see issues #6964, #6820, #6980 and others. I think this is because the documentation is not as c...

github.com

 

우선, 보통 젯슨 보드 default 환경은 Ubuntu 18.04, Python 3.6.9 버전이므로 다음 수순을 따른다면 금방 설치할 수 있을 것.

# Installs librealsense and pyrealsense2 on the Jetson NX running Ubuntu 18.04
# and using Python 3
# Tested on a Jetson NX running Ubuntu 18.04 and Python 3.6.9 on 2020-11-04

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y --no-install-recommends \
    python3 \
    python3-setuptools \
    python3-pip \
    python3-dev

# Install the core packages required to build librealsense libs
sudo apt-get install -y git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
# Install Distribution-specific packages for Ubuntu 18
sudo apt-get install -y libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev

# Install LibRealSense from source
# We need to build from source because
# the PyPi pip packages are not compatible with Arm processors.
# See link [here](https://github.com/IntelRealSense/librealsense/issues/6964).

# First clone the repository
git clone https://github.com/IntelRealSense/librealsense.git
cd ./librealsense

# Make sure that your RealSense cameras are disconnected at this point
# Run the Intel Realsense permissions script
./scripts/setup_udev_rules.sh

# Now the build
mkdir build && cd build
## Install CMake with Python bindings (that's what the -DBUILD flag is for)
## see link: https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python#building-from-source
cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true
## Recompile and install librealsense binaries
## This is gonna take a while! The -j4 flag means to use 4 cores in parallel
## but you can remove it and simply run `sudo make` instead, which will take longer
sudo make uninstall && sudo make clean && sudo make -j4 && sudo make install

## Export pyrealsense2 to your PYTHONPATH so `import pyrealsense2` works
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/pyrealsense2

 

하지만 빌드를 하려다보니 또 CMAKE버전 문제가 오류가 뜨더라. 만약 CMAKE 버전이 안 맞는다면 다음과 같은 방법으로 CMAKE를 업데이트 해주면 된다.

 

https://github.com/IntelRealSense/librealsense/issues/6980#issuecomment-666858977

 

pyrealsense2 on python3 Jetson Xavier NX · Issue #6980 · IntelRealSense/librealsense

Required Info Camera Model { D400 } Firmware Version () Operating System & Version { Linux (Ubuntu 14/16/17) Kernel Version (Linux Only) () Platform NVIDIA Jetson SDK Version { 2.36 } Language {pyt...

github.com

wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0/
cd cmake-3.13.0/
./bootstrap --system-curl
make -j6
echo 'export PATH=/home/ubuntu/cmake-3.13.0/bin/:$PATH' >> ~/.bashrc # 본인 경로로 수정
source ~/.bashrc