1. 下载LearnVIORB
$ cd catkin_ws/src $ git clone https://github.com/jingpang/LearnVIORB
2.进入LearnVIORB目录,运行 ./build.sh,出现“ error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY” 如下
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);
解决:
在LearnVIORB项目下,进入到Thirdparty/g2o/g2o/solvers,修改linear_solver_eigen.h文件
//1.找到line 57: typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix; //2.修改为: typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;
3.继续运行 ./build.sh,出现
[ 33%] Linking CXX executable ../VIO /usr/bin/ld: CMakeFiles/VIO.dir/src/ros_vio.cc.o: undefined reference to symbol '_ZN2cv6String10deallocateEv' /opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status CMakeFiles/VIO.dir/build.make:278: recipe for target '../VIO' failed make[2]: *** [../VIO] Error 1 CMakeFiles/Makefile2:356: recipe for target 'CMakeFiles/VIO.dir/all' failed make[1]: *** [CMakeFiles/VIO.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2 Launch file in Examples/ROS/ORB_VIO/launch. Modify the configuration file config/euroc.yaml Run as: roslaunch ORB_VIO testeuroc.launch
针对“undefined reference to symbol '_ZN2cv6String10deallocateEv'
/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_core3.so.3.3.1: error adding symbols: DSO missing from command line”
解决:
打开Example/ROS/ORB_VIO/CMakeList.txt 在line51 后加上 -lboost_system 即可,如下
set(LIBS ${OpenCV_LIBS} ${EIGEN3_LIBS} ${Pangolin_LIBRARIES} ${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so ${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so ${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so -lboost_system )
3. run ./build.sh 通过
4. 运行euroc demo,下载rosbag from http://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets,run
Open a terminal run $ roscore Open another terminal run $ rosbag play MH_01_easy.bag Open another terminal run $ roslaunch ORB_VIO testeuroc.launch
5. 编写 ros_orb_vio_stereo.cc