OpenVINS - yuhannah/skills_map GitHub Wiki
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.
-
install tools
sudo apt-get install python-catkin-tools python-vcstool
-
查看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(VINS_Mono指定版本)
-
安装依赖库
# 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)
-
-
编译OpenVINS
mkdir -p ~/workspace/catkin_ws_ov/src/ cd ~/workspace/catkin_ws_ov/src/ git clone https://github.com/rpng/open_vins/ cd .. catkin build # ROS1 colcon build # ROS2 colcon build --event-handlers console_cohesion+ --packages-select ov_core ov_init ov_msckf ov_eval # ROS2 with verbose output
报错:
_______________________________________________________________________________ Errors << ov_msckf:make /home/yu/ros_projects/catkin_ws_open_vins/logs/ov_msckf/build.make.000.log 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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/ros/ROS1Visualizer.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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/core/VioManagerHelper.cpp.o] Error 4 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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/ros/ROSVisualizerHelper.cpp.o] Error 4 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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/core/VioManager.cpp.o] Error 4 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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/update/UpdaterHelper.cpp.o] Error 4 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. make[2]: *** [CMakeFiles/ov_msckf_lib.dir/src/state/Propagator.cpp.o] Error 4 make[1]: *** [CMakeFiles/ov_msckf_lib.dir/all] Error 2 make: *** [all] Error 2 cd /home/yu/ros_projects/catkin_ws_open_vins/build/ov_msckf; catkin build --get-env ov_msckf | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd - ............................................................................... Failed << ov_msckf:make [ Exited with code 2 ] Failed <<< ov_msckf [ 53.9 seconds ] [build] Summary: 5 of 6 packages succeeded. [build] Ignored: None. [build] Warnings: None. [build] Abandoned: None. [build] Failed: 1 packages failed. [build] Runtime: 3 minutes and 26.3 seconds total. [build] Note: Workspace packages have changed, please re-source setup files to use them. ```` 是虚拟机系统内存不足导致的,再次编译通过。 - 运行OpenVINS 运行双目数据集: ```bash roscore # term 0 source devel/setup.bash # term 1 roslaunch ov_msckf subscribe.launch config:=euroc_mav rviz -d ov_msckf/launch/display.rviz # term 2 rosbag play V1_01_easy.bag # term 3正常输出所有数据:
q_GtoI = 0.767,-0.280,0.538,0.209 | p_IinG = -0.529,-0.176,-0.001 | dist = 57.19 (meters) bg = -0.0026,0.0205,0.0768 | ba = -0.0089,0.1023,0.0377 camera-imu timeoffset = 0.00002 cam0 intrinsics = 459.908,460.133,367.904,247.832 | -0.277,0.068,0.000,-0.000 cam1 intrinsics = 458.892,459.071,379.777,254.755 | -0.277,0.069,-0.000,-0.000 cam0 extrinsics = -0.007,0.010,0.702,0.712 | 0.057,-0.013,0.016 cam1 extrinsics = -0.001,0.014,0.702,0.712 | -0.052,-0.013,0.015 [TIME]: 0.0177 seconds total (56.6 hz, 0.50 ms behind) ^C[ov_msckf-1] killing on exit camera-imu timeoffset = 0.00002 cam0 intrinsics: 459.908,460.133,367.904,247.832 -0.27709,0.06847,0.00018,-0.00014 cam1 intrinsics: 458.892,459.071,379.777,254.755 -0.27714,0.06859,-0.00013,-0.00014 T_C0toI: 0.015,-1.000,0.004,-0.014, 1.000,0.015,0.024,-0.057, -0.024,0.004,1.000,-0.015, 0.000,0.000,0.000,1.000 T_C1toI: 0.013,-1.000,0.018,-0.012, 1.000,0.014,0.022,0.052, -0.022,0.018,1.000,-0.016, 0.000,0.000,0.000,1.000 TIME: 179.394 seconds
[RUNNING] Bag Time: 1403715418.863788 Duration: 147.146969 / 147.166583 [RUNNING] Bag Time: 1403715418.868416 Duration: 147.151596 / 147.166583 [RUNNING] Bag Time: 1403715418.873765 Duration: 147.156945 / 147.166583 Done.