參考:
[1] Realsense-Ros: https://github.com/IntelRealSense/realsense-ros#installation-instructions
[2] librealsense: https://github.com/IntelRealSense/librealsense
注意:realsense-ros 要和 librealsense 版本匹配,realsense-ros 2.2.7 對應的 Realsense SDK 為 librealsense 2.24 .0
1. 源碼安裝 librealsense
參考:https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md
- 更新系統
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
- 下載源碼
- git 下載
git clone -b v2.24.0 https://github.com/IntelRealSense/librealsense.git
- 安裝依賴,若有 realsense 連接,先unplug
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev
- 安裝包根目錄,run Intel Realsense permissions script
./scripts/setup_udev_rules.sh
- Download, patch and build realsense-affected kernel modules (drivers)
./scripts/patch-realsense-ubuntu-lts.sh
- 編譯安裝
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
sudo make uninstall && make clean && make -j8 && sudo make install
The shared object will be installed in /usr/local/lib
, header files in /usr/local/include
.
The binary demos, tutorials and test files will be copied into /usr/local/bin
2. 源碼編譯 realsense-ros
- 創建工作空間
mkdir -p ~/catkin_ws/src && cd ~/catkin_ws/src
- 下載源碼,並檢查依賴
git clone -b 2.2.7 https://github.com/IntelRealSense/realsense-ros.git cd realsense-ros/realsense2_camera git checkout `git tag | sort -V | grep -P "^\d+\.\d+\.\d+" | tail -1`
sudo apt-get install ros-kinetic-ddynamic-reconfigure
- 編譯
cd ~/catkin_ws
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
- 啟動相機節點
roslaunch realsense2_camera rs_camera.launch