Ubuntu 16.04 Installation
Ubuntu Build Dependencies
安裝過程中會用到wget, git, add-apt-repository 等命令,有可能會被防火牆阻攔,所以建議不要使用公司的網(我就出現了這個問題,公司的網有的命令怎麼都連不上,開了手機熱點,就解決了。)
1、前期準備
更新 Ubuntu:
Update Ubuntu distribution, including getting the latest stable kernel:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
如果需要查看內核版本,運行如下命令:
uname -r
2、下載最新的librealsense SDK包:
下載地址如下:https://github.com/IntelRealSense/librealsense/tags ,解壓之後,移動到系統的home根目錄下。
3、Prepare Linux Backend and the Dev. Environment:
注意事項:安裝時,不要將相機連在電腦上。
3.1 切換目錄到 librealsense 的根目錄下,然後安裝必要的packages
cd ~/librealsense
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
3.2 安裝對應版本的包:
Ubuntu 16:
sudo apt-get install libglfw3-dev
3.3 安裝 librealsense原文件目錄下的許可腳本
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
3.4 構建並應用修補的內核模塊
* Ubuntu 14/16/18 with LTS kernel script will download, patch and build realsense-affected kernel modules (drivers).
Then it will attempt to insert the patched module instead of the active one. If failed the original uvc modules will be restored.
./scripts/patch-realsense-ubuntu-lts.sh
注意事項:有可能會出現錯誤:Failed to unload module videobuf2_core,解決方法如下:
https://github.com/IntelRealSense/librealsense/issues/2846
sudo modprobe -r uvcvideo
sudo modprobe -r videobuf2_core (imho it unwinds automatically once you release uvcvideo)
sudo modprobe -r videodev
and reapply the patch. 還不行的話就重啓。
3.5 TM1-specific(可選的):
In order to accomplish this add the driver's name hid_sensor_custom to /etc/modules file, eg:
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
4、Building librealsense2 SDK
4.1、運行如下命令:
cd ~/librealsense
mkdir build && cd build
cmake ../
cmake ../ -DBUILD_EXAMPLES=true
4.2、重編譯並安裝 librealsense binaries:
sudo make uninstall && make clean && make && sudo make install
4.3、Install IDE (Optional): We use QtCreator as an IDE for Linux development on Ubuntu * Follow the link for QtCreator5 installation
4.4 運行如下命令驗證:
realsense-viewer
大概率是運行不成功的,需要更新firmware,見下文。
5、更新DFU(Device Firmware Update)firmware
這個是教程下載鏈接,第8-9頁:
https://www.intel.com/content/dam/support/us/en/documents/emerging-technologies/intel-realsense-technology/Linux-RealSense-D400-DFU-Guide.pdf
摘抄如下:
1)添加 Intel server 到 list of repositories:
echo 'deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main' | sudo tee /etc/apt/sources.list.d/realsense-public.list
2)註冊the servers public key:
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 6F3EFCDE
3)刷新資源庫安裝包列表:
sudo apt-get update
4)安裝the intel-realsense-dfu(有星號)包,鏈接手機熱點才安裝成功:
sudo apt-get install intel-realsense-dfu*
5)下載最新的D400系列的firmware .bin 文件 (Signed Binary),其中.bin文件下載地址:
https://downloadcenter.intel.com/download/28237/Latest-Firmware-for-Intel-RealSense-D400-Product-Family?v=t
6)將相機連接上電腦,USB3.0接口,輸入lsusb,查詢對應 “Intel Corp”的bus號和device號:
lsusb
7)升級D400系列的相機固件:
intel-realsense-dfu -b 002 -d 002 -f -i /home/intel/downloads/Signed_Image_UVC_5_9_2_0.bin
(This command specifies bus #, device #, -f flag to force upgrade, and –i flag for complete system path to downloaded FW.bin file,後面的鏈接是.bin文件的存放路徑)
8)驗證firmware:Check firmware with command:
intel-realsense-dfu –p
9)運行如下命令驗證:
realsense-viewer
如果還不顯示圖像,可以重啓電腦試一下。
6、ROS包安裝
1)Clone the latest Intel® RealSense™ ROS from here into 'catkin_ws/src/',然後編譯:
catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
2)關於怎麼在ROS中調用相機,請看下面鏈接中的內容
https://github.com/intel-ros/realsense