1. 程式人生 > >DSO程式碼執行常見問題解決辦法(一)

DSO程式碼執行常見問題解決辦法(一)

DSO程式碼的使用與拓展已經有不少優秀部落格可以參考,不再贅述。但對於安裝使用來說,評論區討論的問題都比較集中,且沒有人來相互解答。我研究了DSO的程式碼使用,遇到不少問題,在此做個記錄,也分享出來好讓大家少走彎路。這篇主要是整理dso_ros的編譯問題,基本策略就是哪有窟窿補哪,簡單粗暴。

dso_ros(catkin版本)編譯程式碼

$ cd ~/test
$ catkin_make
$ cd ./src/dso_ros
$ export DSO_PATH=PATH/dso //本機dso程式碼位置
$ rosmake

1.rosmake命令執行後可能出現問題:

[ rosmake ] rosmake starting...                                                 
[ rosmake ] No package or stack specified.  And current directory 'dso_ros' is not a package name or stack name.
[ rosmake ] Packages requested are: []                                          
[ rosmake ] Logging to directory /home/fjh/.ros/rosmake/rosmake_output-20181029-194736
[ rosmake ] Expanded args [] to:[]                                             
[ rosmake ] ERROR: No arguments could be parsed into valid package or stack names.

解決辦法:開啟ros工作空間下的devel資料夾,找到setup.bash,新增以下語句:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}

2.解決問題1後,再次執行rosmake命令可能出現問題:

/usr/bin/ld: CMakeFiles/dso_live.dir/src/main.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/dso_live.dir/build.make:198: recipe for target 'bin/dso_live' failed
make[3]: *** [bin/dso_live] Error 1
make[3]: Leaving directory '/home/fjh/test/src/dso_ros/build'
CMakeFiles/Makefile2:709: recipe for target 'CMakeFiles/dso_live.dir/all' failed
make[2]: *** [CMakeFiles/dso_live.dir/all] Error 2
make[2]: Leaving directory '/home/fjh/test/src/dso_ros/build'
Makefile:127: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/fjh/test/src/dso_ros/build'
/opt/ros/kinetic/share/mk/cmake.mk:7: recipe for target 'all' failed

解決辦法:開啟ros工作空間下的src資料夾,編輯修改./src/dso_ros/CMakeLists.txt:

原命令列:
target_link_libraries(dso_live ${DSO_LIBRARY} ${Pangolin_LIBRARIES} ${OpenCV_LIBS})

編輯後:
target_link_libraries(dso_live ${DSO_LIBRARY} ${Pangolin_LIBRARIES} ${OpenCV_LIBS} GL glut GLU boost_system)

3.rosmake順利編譯後,執行語句:

rosrun dso_ros dso_live image:=/usb_cam/image_raw calib=PATH/camera.txt mode=1

天啦嚕,可能又有麻煩了~問題如下:

[rosrun] Couldn't find executable named dso_live below /home/fjh/test/src/dso_ros
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun]   /home/fjh/test/src/dso_ros/build/bin/dso_live

解決辦法:如果你沒有對CMakeLists.txt進行過其他改動,dso_live的真實位置其實是:./src/dso_ros/build/bin 而不是 ./src/dso_ros/bin,直接移到相應目錄下就好了。