realsense的安裝問題
接手一位同事的realsense相關項目,先配置一個環境,出現不少問題,總結一下。以下操作基於ubuntu16.04
0. 旁白
我先在自己的舊系統上裝,在執行sudo apt-get install librealsense2-utils
命令的時候出現依賴不足,所以就補,結果就是1缺2,2缺4,無敵洞一樣,然後試着重啓了電腦,結果就黑屏了,各種修復失敗。尚不明瞭問題出在哪裏。這位哥們說是因爲源的問題,我因爲後面纔看到他的帖子已無法證實。
後來就只能重裝系統。
1. SDK的安裝
SDK的安裝方法從官網看有兩種方法,直接安裝或者從SDK手動編譯。建議從SDK安裝,官網教程
Register the server’s public key:
sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
In case the public key still cannot be retrieved, check and specify proxy settings: export http_proxy=“http://:”
, and rerun the command. See additional methods in the following link.
Add the server to the list of repositories:
Ubuntu 16 LTS:
sudo add-apt-repository “deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main” -u
Ubuntu 18 LTS:
sudo add-apt-repository “deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main” -u
Install the libraries (see section below if upgrading packages):
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
The above two lines will deploy librealsense2 udev rules, build and activate kernel modules, runtime library and executable demos and tools.
Optionally install the developer and debug packages:
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
With dev package installed, you can compile an application with librealsense using g++ -std=c++11 filename.cpp -lrealsense2 or an IDE of your choice.
Reconnect the Intel RealSense depth camera and run: realsense-viewer to verify the installation.
Verify that the kernel is updated :
modinfo uvcvideo | grep "version:" should include realsense string
主要就是上面加粗的命令,最後可以用realsense-viewer
來打開軟件測試效果。
2. python開發包的安裝
3. nodejs開發包的安裝
安裝有兩種方法,一個是直接安裝nodejs的開發包,另一種是安裝完整的realsense開發包然後在裏面直接安裝。
方法1:
首先就是安裝nvm,按照教程安裝在了/usr/local/lib
路徑下,這個會導致後續在安裝軟件時的權限不足,哪怕是用sudo
也無解,該問題官方給出了解決方案,還有簡書。
然後就是正常的安裝realsense,官網教程,其中遇到:
- 安裝1
cd wrappers/nodejs
npm install
- 測試
cd wrappers/nodejs/examples
npm install
node nodejs-capture.js
Q1:因爲公司內部網絡,需要代理,所以npm在使用時會提示失敗或超時
A1:只要設置一下相關的代理就好了。
npm config set proxy=http://127.0.0.1:8087
npm config set registry=http://registry.npmjs.org
Q2:preinstall
問題,可能是因爲之前安裝失敗導致的殘留。
A2:
sudo npm cache clean --force
sudo rm -rf node_modules
npm install --save node-librealsense