VINS_Mono - yuhannah/skills_map GitHub Wiki
VINS_Mono
编译运行
-
安装ubuntu16.04
OPEN_VINS、VINS_Mono、ORB_SLAM2都支持ubuntu16.04,但SVO2.0支持ubuntu18.04和ubuntu20.04,选择大部分算法支持的ubuntu16.04。
-
安装ROS Kinetic(自带OpenCV和Eigen3)
-
sources.list
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list' -
set up keys
sudo apt install curl # if you haven't already installed curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -网络不好时报错,多试几次会OK。
gpg: no valid OpenPGP data found. -
up date package
sudo apt-get update -
install,安装需要很长时间
sudo apt-get install ros-kinetic-desktop-full -
environment setup
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc source ~/.bashrc -
dependencies
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential -
initialize rosdep
sudo apt install python-rosdep sudo rosdep init rosdep update网络不好时会报错,多试几次会OK。
ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list Website may be down. -
additional package(已安装,跳过)
sudo apt-get install ros-kinetic-cv-bridge ros-kinetic-tf ros-kinetic-message-filters ros-kinetic-image-transport -
查看Eigen3版本,ros安装了Eigen3.2.92
pkg-config --modversion eigen3 3.2.92 -
查看OpenCV版本,ros安装了OpenCV3.3.1
sudo find / -iname "*opencv*" /opt/ros/kinetic/include/opencv-3.3.1-dev
-
-
安装Eigen3(已有3.2.92>3.1.0,跳过)
-
安装OpenCV(已有3.3.1>2.4.3,跳过)
-
安装Ceres Solver1.14.0(指定版本)
-
安装依赖库
# CMake (已有3.5.1>2.8.12,跳过) sudo apt-get install cmake # google-glog + gflags sudo apt-get install libgoogle-glog-dev libgflags-dev # Use ATLAS for BLAS & LAPACK sudo apt-get install libatlas-base-dev # Eigen3(已有3.2.92>3.1.0,跳过) sudo apt-get install libeigen3-dev # SuiteSparse (optional) sudo apt-get install libsuitesparse-dev -
安装Ceres Solver
mkdir ceres-bin cmake ../ceres-solver make -j3 make test make install编译通过,安装到
/usr/local/下:Install the project... -- Install configuration: "Release" -- Installing: /usr/local/include/ceres/tiny_solver_cost_function_adapter.h -- Installing: /usr/local/include/ceres/dynamic_cost_function.h -- Installing: /usr/local/include/ceres/cubic_interpolation.h -- Installing: /usr/local/include/ceres/evaluation_callback.h -- Installing: /usr/local/include/ceres/fpclassify.h -- Installing: /usr/local/include/ceres/numeric_diff_options.h -- Installing: /usr/local/include/ceres/context.h -- Installing: /usr/local/include/ceres/autodiff_cost_function.h -- Installing: /usr/local/include/ceres/loss_function.h -- Installing: /usr/local/include/ceres/gradient_checker.h -- Installing: /usr/local/include/ceres/iteration_callback.h -- Installing: /usr/local/include/ceres/ordered_groups.h -- Installing: /usr/local/include/ceres/problem.h -- Installing: /usr/local/include/ceres/gradient_problem.h -- Installing: /usr/local/include/ceres/rotation.h -- Installing: /usr/local/include/ceres/dynamic_autodiff_cost_function.h -- Installing: /usr/local/include/ceres/local_parameterization.h -- Installing: /usr/local/include/ceres/c_api.h -- Installing: /usr/local/include/ceres/types.h -- Installing: /usr/local/include/ceres/gradient_problem_solver.h -- Installing: /usr/local/include/ceres/tiny_solver.h -- Installing: /usr/local/include/ceres/version.h -- Installing: /usr/local/include/ceres/jet.h -- Installing: /usr/local/include/ceres/dynamic_numeric_diff_cost_function.h -- Installing: /usr/local/include/ceres/tiny_solver_autodiff_function.h -- Installing: /usr/local/include/ceres/cost_function_to_functor.h -- Installing: /usr/local/include/ceres/ceres.h -- Installing: /usr/local/include/ceres/sized_cost_function.h -- Installing: /usr/local/include/ceres/numeric_diff_cost_function.h -- Installing: /usr/local/include/ceres/dynamic_cost_function_to_functor.h -- Installing: /usr/local/include/ceres/crs_matrix.h -- Installing: /usr/local/include/ceres/autodiff_local_parameterization.h -- Installing: /usr/local/include/ceres/cost_function.h -- Installing: /usr/local/include/ceres/conditioned_cost_function.h -- Installing: /usr/local/include/ceres/normal_prior.h -- Installing: /usr/local/include/ceres/covariance.h -- Installing: /usr/local/include/ceres/solver.h -- Installing: /usr/local/include/ceres/internal/eigen.h -- Installing: /usr/local/include/ceres/internal/autodiff.h -- Installing: /usr/local/include/ceres/internal/fixed_array.h -- Installing: /usr/local/include/ceres/internal/numeric_diff.h -- Installing: /usr/local/include/ceres/internal/manual_constructor.h -- Installing: /usr/local/include/ceres/internal/port.h -- Installing: /usr/local/include/ceres/internal/reenable_warnings.h -- Installing: /usr/local/include/ceres/internal/scoped_ptr.h -- Installing: /usr/local/include/ceres/internal/macros.h -- Installing: /usr/local/include/ceres/internal/disable_warnings.h -- Installing: /usr/local/include/ceres/internal/variadic_evaluate.h -- Installing: /usr/local/include/ceres/internal/config.h -- Installing: /usr/local/lib/cmake/Ceres/CeresTargets.cmake -- Installing: /usr/local/lib/cmake/Ceres/CeresTargets-release.cmake -- Installing: /usr/local/lib/cmake/Ceres/CeresConfig.cmake -- Installing: /usr/local/lib/cmake/Ceres/CeresConfigVersion.cmake -- Installing: /usr/local/lib/cmake/Ceres/FindEigen.cmake -- Installing: /usr/local/lib/cmake/Ceres/FindGlog.cmake -- Installing: /usr/local/lib/cmake/Ceres/FindGflags.cmake -- Installing: /usr/local/lib/libceres.a -
测试Ceres Solver
bin/simple_bundle_adjuster ../ceres-solver/data/problem-16-22106-pre.txt正常输出所有数据:
iter cost cost_change |gradient| |step| tr_ratio tr_radius ls_iter iter_time total_time 0 4.185660e+06 0.00e+00 1.09e+08 0.00e+00 0.00e+00 1.00e+04 0 7.39e-02 1.74e-01 1 1.062590e+05 4.08e+06 8.99e+06 5.36e+02 9.82e-01 3.00e+04 1 1.47e-01 3.21e-01 2 4.992817e+04 5.63e+04 8.32e+06 3.19e+02 6.52e-01 3.09e+04 1 1.40e-01 4.61e-01 3 1.899774e+04 3.09e+04 1.60e+06 1.24e+02 9.77e-01 9.26e+04 1 1.40e-01 6.02e-01 4 1.808729e+04 9.10e+02 3.97e+05 6.39e+01 9.51e-01 2.78e+05 1 1.40e-01 7.42e-01 5 1.803399e+04 5.33e+01 1.48e+04 1.23e+01 9.99e-01 8.33e+05 1 1.40e-01 8.82e-01 6 1.803390e+04 9.02e-02 6.35e+01 8.00e-01 1.00e+00 2.50e+06 1 1.40e-01 1.02e+00 Solver Summary (v 1.14.0-eigen-(3.2.92)-lapack-suitesparse-(4.4.6)-cxsparse-(3.1.4)-eigensparse-openmp-no_tbb) Original Reduced Parameter blocks 22122 22122 Parameters 66462 66462 Residual blocks 83718 83718 Residuals 167436 167436 Minimizer TRUST_REGION Dense linear algebra library EIGEN Trust region strategy LEVENBERG_MARQUARDT Given Used Linear solver DENSE_SCHUR DENSE_SCHUR Threads 1 1 Linear solver ordering AUTOMATIC 22106,16 Schur structure 2,3,9 2,3,9 Cost: Initial 4.185660e+06 Final 1.803390e+04 Change 4.167626e+06 Minimizer iterations 7 Successful steps 7 Unsuccessful steps 0 Time (in seconds): Preprocessor 0.099875 Residual only evaluation 0.098404 (7) Jacobian & residual evaluation 0.425679 (7) Linear solver 0.393505 (7) Minimizer 1.000414 Postprocessor 0.004102 Total 1.104392 Termination: CONVERGENCE (Function tolerance reached. |cost_change|/cost: 1.769759e-09 <= 1.000000e-06)
-
-
编译VINS_Mono
cd ~/catkin_ws/src git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git cd ../ catkin_make source ~/catkin_ws/devel/setup.bash报错:
c++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. VINS-Mono/vins_estimator/CMakeFiles/vins_estimator.dir/build.make:62: recipe for target 'VINS-Mono/vins_estimator/CMakeFiles/vins_estimator.dir/src/estimator_node.cpp.o' failed make[2]: *** [VINS-Mono/vins_estimator/CMakeFiles/vins_estimator.dir/src/estimator_node.cpp.o] Error 4 make[2]: *** Waiting for unfinished jobs.... c++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions. VINS-Mono/camera_model/CMakeFiles/camera_model.dir/build.make:158: recipe for target 'VINS-Mono/camera_model/CMakeFiles/camera_model.dir/src/camera_models/CostFunctionFactory.cc.o' failed make[2]: *** [VINS-Mono/camera_model/CMakeFiles/camera_model.dir/src/camera_models/CostFunctionFactory.cc.o] Error 4 CMakeFiles/Makefile2:1954: recipe for target 'VINS-Mono/camera_model/CMakeFiles/camera_model.dir/all' failed make[1]: *** [VINS-Mono/camera_model/CMakeFiles/camera_model.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... CMakeFiles/Makefile2:2596: recipe for target 'VINS-Mono/vins_estimator/CMakeFiles/vins_estimator.dir/all' failed make[1]: *** [VINS-Mono/vins_estimator/CMakeFiles/vins_estimator.dir/all] Error 2是虚拟机系统内存不足导致的,再次编译通过。
-
运行VINS_Mono
运行双目数据集,只采用其中的一个摄像头数据:
# 终端1 source ~/ros_projects/catkin_ws_vins_mono/devel/setup.bash roslaunch vins_estimator euroc.launch # 终端2 source ~/ros_projects/catkin_ws_vins_mono/devel/setup.bash roslaunch vins_estimator vins_rviz.launch # 终端3 source ~/ros_projects/catkin_ws_vins_mono/devel/setup.bash rosbag play /home/yu/datas/V1_01_easy.bag正常输出所有数据:
``` [ INFO] [1766562560.361117844]: IMU excitation not enouth! [ INFO] [1766562560.361333429]: Not enough features or parallax; Move device around [ WARN] [1766562560.725228536]: gyroscope bias initial calibration -0.00217371 0.0209758 0.0779102 [ INFO] [1766562560.840907685]: Initialization finish! position: -1.optimize pose graph .3328837 position: -1optimize pose graph 0.142774 position: -optimize pose graph 0.270178 posoptimize pose graph .977074, 0.435990 optimize pose graph position: -0.508290, -2.445170, 0.11optimize pose graph position: -0.034843, -1.582805, 0.2optimize pose graph position: -1.861889, -0.4optimize pose graph position: -2.181846, -1.optimize pose graph position: -1.938657, -3optimize pose graph position: -0.887557, optimize pose graph position: -0.302115,optimize pose graph positionoptimize pose graph , 0.66757793 posoptimize pose graph 219197, 0.769092 positionoptimize pose graph 81, 0.655759 positiooptimize pose graph 857, 0.645838 positioptimize pose graph 0095, 0.787641 positoptimize pose graph 64833, 0.502407 posioptimize pose graph 013152, 0.304323 position: -1.697763, 0.855084optimize pose graph position: -0.optimize pose graph 386692 position: -0.450556, 0.04optimize pose graph position: -0.46^C[pose_graph-4] killing on exit [vins_estimator-3] killing on exit [feature_tracker-2] killing on exit terminate called without an active exception terminate called without an active exception [rosout-1] killing on exit [master] killing on exit shutting down processing monitor... ... shutting down processing monitor complete done[RUNNING] Bag Time: 1403715418.868382 Duration: 147.151562 / 147.166583 [RUNNING] Bag Time: 1403715418.873461 Duration: 147.156642 / 147.166583 [RUNNING] Bag Time: 1403715418.878394 Duration: 147.161575 / 147.166583 Done.