cd ORB_SLAM2
chmod +x build.sh
./build.sh
/home/hazyparker/project/ORB_SLAM2/src/System.cc: In member function ‘cv::Mat ORB_SLAM2::System::TrackStereo(const cv::Mat&, const cv::Mat&, const double&)’:
/home/hazyparker/project/ORB_SLAM2/src/System.cc:134:17: error: ‘usleep’ was not declared in this scope
usleep(1000);
^~~~~~
/home/hazyparker/project/ORB_SLAM2/src/System.cc:134:17: note: suggested alternative: ‘fseek’
usleep(1000);
^~~~~~
fseek
/home/hazyparker/project/ORB_SLAM2/src/System.cc: In member function ‘cv::Mat ORB_SLAM2::System::TrackRGBD(const cv::Mat&, const cv::Mat&, const double&)’:
/home/hazyparker/project/ORB_SLAM2/src/System.cc:185:17: error: ‘usleep’ was not declared in this scope
usleep(1000);
^~~~~~
/home/hazyparker/project/ORB_SLAM2/src/System.cc:185:17: note: suggested alternative: ‘fseek’
usleep(1000);
^~~~~~
fseek
/home/hazyparker/project/ORB_SLAM2/src/System.cc: In member function ‘cv::Mat ORB_SLAM2::System::TrackMonocular(const cv::Mat&, const double&)’:
/home/hazyparker/project/ORB_SLAM2/src/System.cc:236:17: error: ‘usleep’ was not declared in this scope
usleep(1000);
^~~~~~
/home/hazyparker/project/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::Run()’:
/home/hazyparker/project/ORB_SLAM2/src/LoopClosing.cc:84:9: error: ‘usleep’ was not declared in this scope
usleep(5000);
^~~~~~
CMakeFiles/ORB_SLAM2.dir/build.make:110: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LocalMapping.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
CMakeFiles/ORB_SLAM2.dir/build.make:86: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Tracking.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:494: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:134: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/LoopClosing.cc.o] Error 1
CMakeFiles/ORB_SLAM2.dir/build.make:62: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/System.cc.o' failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/System.cc.o] Error 1
CMakeFiles/Makefile2:252: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
search key: ‘usleep’ was not declared in this scope
result: 编译orbslam2出现的error: ‘usleep’ was not declared in this scope usleep(3000), fixed
[ 62%] Linking CXX shared library ../lib/libORB_SLAM2.so
/usr/bin/ld: 找不到 -lEigen3::Eigen
collect2: error: ld returned 1 exit status
CMakeFiles/ORB_SLAM2.dir/build.make:624: recipe for target '../lib/libORB_SLAM2.so' failed
make[2]: *** [../lib/libORB_SLAM2.so] Error 1
CMakeFiles/Makefile2:252: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
search key: /usr/bin/ld:找不到-lEigen3::Eigen
result: ORB SLAM2 编译报错 /usr/bin/ld:找不到 -lEigen3::Eigen
version of Pangolin
is 0.6, however, orb slam2
needs 0.5
change REQUIRED
to REQUIRED NO_MOUDLE
, NO_MODULE可以用来明确地跳过模块模式。它也隐含指定了不使用在精简格式中使用的那些选项。
end: change REQUIRED
to REQUIRED NO_MOUDLE
, fixed and finished
cd orb slam2
file, then
$ ./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
PATH_TO_SEQUENCE_FOLDER
, path to the dataset that unzippedTUMX.yaml
, X
depends on datasetORB_SLAM2
to catkin_ws/src
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/catkin_ws/src/ORB_SLAM2/Examples/ROS
to .bashrc
source ~/.bashrc
While using camera via USB, pay attention to Info below:
ORB-SLAM默认订阅的话题为
/camera/image_raw
,而usb_cam
节点发布的话题为/usb_cam/image_raw
,因此需要在ros_mono.cc
中修改订阅的话题,这点要特别注意。因为源文件的更改必须要重新编译,这非常耗时from https://blog.csdn.net/learning_tortosie/article/details/79881165
a more precise tutorial ROS编译ORB-SLAM2运行
If applied in gazebo
, then just build like this: (in file catkin_ws/src/ORB_SLAM2
)
chmod +x build_ros.sh
./build_ros.sh
/home/hazyparker/下载/Pangolin-master/components/pango_opengl/include/pangolin/gl/opengl_render_state.h:40:10: fatal error: Eigen/Core: 没有那个文件或目录
#include
^~~~~~~~~~~~
compilation terminated.
CMakeFiles/RGBD.dir/build.make:118: recipe for target 'CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o' failed
make[2]: *** [CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/RGBD.dir/all' failed
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
CMakeFiles/Stereo.dir/build.make:118: recipe for target 'CMakeFiles/Stereo.dir/src/ros_stereo.cc.o' failed
make[2]: *** [CMakeFiles/Stereo.dir/src/ros_stereo.cc.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
issue about Eigen
, no such file or directory
Be advised, I installed eigen3
on my own, so it exists in usr/local/include/eigen3
. According to the 2nd reference, I’ve uninstalled eigen3.2 so that there is nothing in path usr/include/eigen3
.
Aware of this, I shall use ln -s
method to create a link to usr/local/include/eigen3
.
sudo ln -s /usr/local/include/eigen3/Eigen /usr/include/Eigen
then I can find Eigen
in usr/include/
.
after ERROR 1
CMake Error at CMakeLists.txt:42 (find_package):
Found package configuration file:
/home/hazyparker/下载/Pangolin-master/build/PangolinConfig.cmake
but it set Pangolin_FOUND to FALSE so package "Pangolin" is considered to
be NOT FOUND. Reason given by package:
Pangolin could not be found because dependency Eigen3 could not be found.
-- Configuring incomplete, errors occurred!
See also "/home/hazyparker/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".
See also "/home/hazyparker/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeError.log".
Makefile:724: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Solution in ERROR 1 caused:Pangolin could not be found because dependency Eigen3 could not be found.
same issue with issue 1015 https://github.com/raulmur/ORB_SLAM2/issues/1015, same issue of Build and examples ERROR 1
firstly, I add include_directories("/usr/local/include/eigen3")
in CMakeList.txt
, but it won’t work
secondly, I revised find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
to find_package(Eigen3 3.1.0 REQUIRED)
, but it won’t work either
An idea, delete the link created in Build in ROS ERROR 1, use sudo apt-get install libeigen3-dev
instead(which means eigen3.2). When eigen 3.3 is needed, add include_directories("/usr/local/include/eigen3")
in CMakeList.txt
rather than find_package
.
failed.
It just occurred me that ROS owns a seperated CMakeList.txt
in ORB_SLAM2/Examples/ROS/ORB_SLAM2
So, changing find_package(Eigen3 3.1.0 REQUIRED)
to find_package(Eigen3 3.1.0 REQUIRED NO_MODULE)
in CmakeLists.txt
of ROS
fixed.
/usr/bin/ld: CMakeFiles/RGBD.dir/src/ros_rgbd.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: 无法添加符号: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/RGBD.dir/build.make:213: recipe for target '../RGBD' failed
make[2]: *** [../RGBD] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/RGBD.dir/all' failed
make[1]: *** [CMakeFiles/RGBD.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
/usr/bin/ld: CMakeFiles/Stereo.dir/src/ros_stereo.cc.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/x86_64-linux-gnu/libboost_system.so: 无法添加符号: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/Stereo.dir/build.make:213: recipe for target '../Stereo' failed
make[2]: *** [../Stereo] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/Stereo.dir/all' failed
make[1]: *** [CMakeFiles/Stereo.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2