首先在此網址下載電腦對應的驅動Ubuntu Linux 16.04 LTS (64bit) – gcc5.4並安裝.
然後在phoxi_camera的github網址上下載包並編譯,安裝步驟見文件README,使用的branch是master.
注意!!!:在README中你會發現安裝的gcc版本是4.9,這與我們下載的Ubuntu16.04對應的PhoXi Control Software的gcc版本5.4不符,需要額外操作.
解決方法:
這一步就是按照README中的步驟來:
cd catkin_ws/src
git clone https://github.com/photoneo/phoxi_camera.git
cd phoxi_camera
chmod +x install_prerequisities.sh
./install_prerequisities.sh
然後執行:
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 120 --slave /usr/bin/g++ g++ /usr/bin/g++-5
$ sudo update-alternatives --config gcc
顯示:
有 2 個候選項可用於替換 gcc (提供 /usr/bin/gcc)。
選擇 路徑 優先級 狀態
------------------------------------------------------------
* 0 /usr/bin/gcc-5 120 自動模式
1 /usr/bin/gcc-4.9 60 手動模式
2 /usr/bin/gcc-5 120 手動模式
要維持當前值[*]請按<回車鍵>,或者鍵入選擇的編號:
輸入編號gcc-5的版本然後按回車,這一步非常重要,在帖子上說是用4.9,經測試這樣是行不通的,請務必使用gcc-5,然後繼續執行如下步驟:
cd ../..
catkin build
這時會有如下報錯:
Errors << phoxi_camera:cmake /home/zzz/phoxi_camera-master/logs/phoxi_camera/build.cmake.000.log
CMake Error at /opt/PhotoneoPhoXiControl/PhoXiConfig.cmake:25 (include):
include could not find load file:
/opt/PhotoneoPhoXiControl/cmake/PhoXiConfig_.cmake
Call Stack (most recent call first):
CMakeLists.txt:4 (find_package)
CMake Warning (dev) at CMakeLists.txt:77 (target_link_libraries):
Link library type specifier "optimized" is followed by specifier "debug"
instead of a library name. The first specifier will be ignored.
This warning is for project developers. Use -Wno-dev to suppress it.
好的,此時我們與成功只有一步之遙了,觀察報錯信息發現編譯過程中在目錄/opt/PhotoneoPhoXiControl/cmake/
下找不到PhoXiConfig_.cmake
文件,我們cd到這個目錄下,將文件名更改爲PhoXiConfig_.cmake
即可.可能會碰到文件無法重命名的情況,使用命令sudo chmod -R 777 [文件名]
即可對文件修改了.
在我們原來編譯的空間內使用catkin clean
和catkin clean -b
確保之前的編譯內容被刪除,然後重新編譯catkin build
或者catkin_make
即可編譯成功了.
然後在workspace中運行:
roslaunch phoxi_camera phoxi_camera_test.launch
即可看到和github教程上一樣的結果.
打開phoxi_camera_test.launch
文件可以看到這個文件訂閱了兩個node,分別是phoxi_camera.cpp
和phoxi_camera_example.py
着重看phoxi_camera_example.py
文件,其中name = ""
這一行將""中的內容改爲你自己的相機在phoxi control軟件中顯示的ID,到此你就可以順利的在ROS中使用photoneo的深度相機了!
如果仍舊有問題,請參考此網頁:https://github.com/BerkeleyAutomation/manuals/blob/master/phoxi_camera_setup.md