首先,安装相关环境依赖ceres solver、eigen以及ros-noetic版本(教程很多,此处省略)。
注:ubuntu 20.04会自带一个opencv 4.2版本。
一、下载编译Vins-fusion
1. 创建工作空间vins_ws,并在src目录下git源码并编译:
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
cd ..
catkin_make
此时,编译会出现一系列错误:
make[2]: *** [VINS-Fusion/camera_models/CMakeFiles/Calibrations.dir/build.make:128:VINS-Fusion/camera_models/CMakeFiles/Calibrations.dir/src/camera_models/CostFunctionFactory.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:843:VINS-Fusion/camera_models/CMakeFiles/Calibrations.dir/all] 错误 2
In file included from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.cpp:12:
/usr/local/include/ceres/internal/autodiff.h: In instantiation of ‘bool ceres::internal::AutoDifferentiate(const Functor&, const T* const*, int, T*, T**) [with int kNumResiduals = 6; ParameterDims = ceres::internal::ParameterDims<false, 4, 3, 4, 3>; Functor = RelativeRTError; T = double]’:
/usr/local/include/ceres/autodiff_cost_function.h:194:69: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, Ns>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = RelativeRTError; int kNumResiduals = 6; int ...Ns = {4, 3, 4, 3}]’
/usr/local/include/ceres/autodiff_cost_function.h:184:8: required from here
/usr/local/include/ceres/internal/autodiff.h:313:9: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3, 4, 3>’
313 | using Parameters = typename ParameterDims::Parameters;
| ^~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:346:47: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3, 4, 3>’
346 | Make1stOrderPerturbations<Parameters>::Apply(parameters,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
347 | parameters_as_jets.data());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:355:39: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 4, 3, 4, 3>’
355 | Take1stOrderParts<Parameters>::Apply(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
356 | num_outputs, residuals_as_jets.data(), jacobians);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h: In instantiation of ‘bool ceres::internal::AutoDifferentiate(const Functor&, const T* const*, int, T*, T**) [with int kNumResiduals = 3; ParameterDims = ceres::internal::ParameterDims<false, 3>; Functor = TError; T = double]’:
/usr/local/include/ceres/autodiff_cost_function.h:194:69: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, Ns>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = TError; int kNumResiduals = 3; int ...Ns = {3}]’
/usr/local/include/ceres/autodiff_cost_function.h:184:8: required from here
/usr/local/include/ceres/internal/autodiff.h:313:9: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 3>’
313 | using Parameters = typename ParameterDims::Parameters;
| ^~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:346:47: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 3>’
346 | Make1stOrderPerturbations<Parameters>::Apply(parameters,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
347 | parameters_as_jets.data());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:355:39: error: no type named ‘Parameters’ in ‘class ceres::internal::ParameterDims<false, 3>’
355 | Take1stOrderParts<Parameters>::Apply(
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
356 | num_outputs, residuals_as_jets.data(), jacobians);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/ceres/internal/autodiff.h:152,
from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.cpp:12:
/usr/local/include/ceres/internal/variadic_evaluate.h: In instantiation of ‘bool ceres::internal::VariadicEvaluateImpl(const Functor&, const T* const*, T*, const void*) [with ParameterDims = ceres::internal::ParameterDims<false, 4, 3, 4, 3>; Functor = RelativeRTError; T = double]’:
/usr/local/include/ceres/internal/variadic_evaluate.h:100:45: required from ‘bool ceres::internal::VariadicEvaluate(const Functor&, const T* const*, T*) [with ParameterDims = ceres::internal::ParameterDims<false, 4, 3, 4, 3>; Functor = RelativeRTError; T = double]’
/usr/local/include/ceres/autodiff_cost_function.h:191:55: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, Ns>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = RelativeRTError; int kNumResiduals = 6; int ...Ns = {4, 3, 4, 3}]’
/usr/local/include/ceres/autodiff_cost_function.h:184:8: required from here
/usr/local/include/ceres/internal/variadic_evaluate.h:74:52: error: ‘ParameterBlockIndices’ was not declared in this scope
74 | ParameterBlockIndices());
| ~~~~~~~~~~~~~~~~~~~~~^~
/usr/local/include/ceres/internal/variadic_evaluate.h: In instantiation of ‘bool ceres::internal::VariadicEvaluateImpl(const Functor&, const T* const*, T*, const void*) [with ParameterDims = ceres::internal::ParameterDims<false, 3>; Functor = TError; T = double]’:
/usr/local/include/ceres/internal/variadic_evaluate.h:100:45: required from ‘bool ceres::internal::VariadicEvaluate(const Functor&, const T* const*, T*) [with ParameterDims = ceres::internal::ParameterDims<false, 3>; Functor = TError; T = double]’
/usr/local/include/ceres/autodiff_cost_function.h:191:55: required from ‘bool ceres::AutoDiffCostFunction<CostFunctor, kNumResiduals, Ns>::Evaluate(const double* const*, double*, double**) const [with CostFunctor = TError; int kNumResiduals = 3; int ...Ns = {3}]’
/usr/local/include/ceres/autodiff_cost_function.h:184:8: required from here
/usr/local/include/ceres/internal/variadic_evaluate.h:74:52: error: ‘ParameterBlockIndices’ was not declared in this scope
make[2]: *** [VINS-Fusion/global_fusion/CMakeFiles/global_fusion_node.dir/build.make:76:VINS-Fusion/global_fusion/CMakeFiles/global_fusion_node.dir/src/globalOpt.cpp.o] 错误 1
make[2]: *** 正在等待未完成的任务....
In file included from /usr/local/include/ceres/internal/parameter_dims.h:37,
from /usr/local/include/ceres/internal/autodiff.h:151,
from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:46: error: wrong number of template arguments (3, should be 1)
64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
| ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
60 | struct SumImpl;
| ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:64:49: error: expected unqualified-id before ‘>’ token
64 | struct SumImpl<std::integer_sequence<T, N, Ns...>> {
| ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:21: error: ‘integer_sequence’ is not a member of ‘std’
70 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:51: error: wrong number of template arguments (4, should be 1)
70 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
| ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
60 | struct SumImpl;
| ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:70:54: error: expected unqualified-id before ‘>’ token
70 | struct SumImpl<std::integer_sequence<T, N1, N2, Ns...>> {
| ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:21: error: ‘integer_sequence’ is not a member of ‘std’
77 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:59: error: wrong number of template arguments (6, should be 1)
77 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
| ^~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
60 | struct SumImpl;
| ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:77:62: error: expected unqualified-id before ‘>’ token
77 | struct SumImpl<std::integer_sequence<T, N1, N2, N3, N4, Ns...>> {
| ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:21: error: ‘integer_sequence’ is not a member of ‘std’
84 | struct SumImpl<std::integer_sequence<T, N>> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:41: error: wrong number of template arguments (2, should be 1)
84 | struct SumImpl<std::integer_sequence<T, N>> {
| ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:60:8: note: provided for ‘template<class Seq> struct ceres::internal::SumImpl’
60 | struct SumImpl;
| ^~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:84:42: error: expected unqualified-id before ‘>’ token
84 | struct SumImpl<std::integer_sequence<T, N>> {
| ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:90:21: error: ‘integer_sequence’ is not a member of ‘std’
90 | struct SumImpl<std::integer_sequence<T>> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:90:21: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:90:38: error: template argument 1 is invalid
90 | struct SumImpl<std::integer_sequence<T>> {
| ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:90:39: error: expected unqualified-id before ‘>’ token
90 | struct SumImpl<std::integer_sequence<T>> {
| ^~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:132:39: error: ‘integer_sequence’ is not a member of ‘std’
132 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T, N, Ns...>,
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:132:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:132:67: error: template argument 3 is invalid
132 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T, N, Ns...>,
| ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:132:67: error: type/value mismatch at argument 4 in template parameter list for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:132:67: note: expected a type, got ‘N’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:141:39: error: ‘integer_sequence’ is not a member of ‘std’
141 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:141:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:141:57: error: wrong number of template arguments (3, should be 4)
141 | struct ExclusiveScanImpl<T, Sum, std::integer_sequence<T>, SeqOut> {
| ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:129:8: note: provided for ‘template<class T, T Sum, class SeqIn, class SeqOut> struct ceres::internal::ExclusiveScanImpl’
129 | struct ExclusiveScanImpl;
| ^~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:155:53: error: ‘integer_sequence’ is not a member of ‘std’
155 | typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:155:53: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:155:70: error: template argument 4 is invalid
155 | typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;
| ^
/usr/local/include/ceres/internal/integer_sequence_algorithm.h:155:16: error: expected nested-name-specifier
155 | typename ExclusiveScanImpl<T, T(0), Seq, std::integer_sequence<T>>::Type;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/ceres/internal/autodiff.h:151,
from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/internal/parameter_dims.h:44:55: error: ‘integer_sequence’ is not a member of ‘std’
44 | constexpr bool IsValidParameterDimensionSequence(std::integer_sequence<int>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:44:72: error: expected primary-expression before ‘int’
44 | constexpr bool IsValidParameterDimensionSequence(std::integer_sequence<int>) {
| ^~~
/usr/local/include/ceres/internal/parameter_dims.h:50:10: error: ‘template<int N, int ...Ts> constexpr const bool ceres::internal::IsValidParameterDimensionSequence’ redeclared as different kind of entity
50 | std::integer_sequence<int, N, Ts...>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:44:16: note: previous declaration ‘constexpr const bool ceres::internal::IsValidParameterDimensionSequence’
44 | constexpr bool IsValidParameterDimensionSequence(std::integer_sequence<int>) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:50:10: error: ‘integer_sequence’ is not a member of ‘std’
50 | std::integer_sequence<int, N, Ts...>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:50:27: error: expected primary-expression before ‘int’
50 | std::integer_sequence<int, N, Ts...>) {
| ^~~
/usr/local/include/ceres/internal/parameter_dims.h:50:40: error: expected ‘)’ before ‘>’ token
50 | std::integer_sequence<int, N, Ts...>) {
| ^
| )
/usr/local/include/ceres/internal/parameter_dims.h:49:49: note: to match this ‘(’
49 | constexpr bool IsValidParameterDimensionSequence(
| ^
/usr/local/include/ceres/internal/parameter_dims.h:69:27: error: ‘integer_sequence’ in namespace ‘std’ does not name a template type
69 | using Parameters = std::integer_sequence<int, Ns...>;
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:74:41: error: there are no arguments to ‘Parameters’ that depend on a template parameter, so a declaration of ‘Parameters’ must be available [-fpermissive]
74 | IsValidParameterDimensionSequence(Parameters());
| ^~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:74:41: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/local/include/ceres/internal/parameter_dims.h:85:16: error: ‘integer_sequence’ is not a member of ‘std’
85 | Sum<std::integer_sequence<int, Ns...>>::Value;
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:85:16: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/parameter_dims.h:85:43: error: template argument 1 is invalid
85 | Sum<std::integer_sequence<int, Ns...>>::Value;
| ^~
/usr/local/include/ceres/internal/parameter_dims.h:101:20: error: ‘std::integer_sequence’ has not been declared
101 | T* ptr, std::integer_sequence<int, Indices...>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/parameter_dims.h:101:36: error: expected ‘,’ or ‘...’ before ‘<’ token
101 | T* ptr, std::integer_sequence<int, Indices...>) {
| ^
/usr/local/include/ceres/internal/parameter_dims.h: In static member function ‘static std::array<T*, ceres::internal::ParameterDims<IsDynamic, Ns>::kNumParameterBlocks> ceres::internal::ParameterDims<IsDynamic, Ns>::GetUnpackedParameters(T*)’:
/usr/local/include/ceres/internal/parameter_dims.h:94:35: error: ‘Parameters’ was not declared in this scope; did you mean ‘ParameterDims’?
94 | using Offsets = ExclusiveScan<Parameters>;
| ^~~~~~~~~~
| ParameterDims
/usr/local/include/ceres/internal/parameter_dims.h:94:45: error: template argument 1 is invalid
94 | using Offsets = ExclusiveScan<Parameters>;
| ^
/usr/local/include/ceres/internal/parameter_dims.h:95:39: error: there are no arguments to ‘Offsets’ that depend on a template parameter, so a declaration of ‘Offsets’ must be available [-fpermissive]
95 | return GetUnpackedParameters(ptr, Offsets());
| ^~~~~~~
In file included from /usr/local/include/ceres/internal/autodiff.h:152,
from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/internal/variadic_evaluate.h: At global scope:
/usr/local/include/ceres/internal/variadic_evaluate.h:51:39: error: ‘std::integer_sequence’ has not been declared
51 | std::integer_sequence<int, Indices...>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/variadic_evaluate.h:51:55: error: expected ‘,’ or ‘...’ before ‘<’ token
51 | std::integer_sequence<int, Indices...>) {
| ^
/usr/local/include/ceres/internal/variadic_evaluate.h:62:39: error: ‘std::integer_sequence’ has not been declared
62 | std::integer_sequence<int>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/variadic_evaluate.h:62:55: error: expected ‘,’ or ‘...’ before ‘<’ token
62 | std::integer_sequence<int>) {
| ^
/usr/local/include/ceres/internal/variadic_evaluate.h: In function ‘bool ceres::internal::VariadicEvaluateImpl(const Functor&, const T* const*, T*, const void*)’:
/usr/local/include/ceres/internal/variadic_evaluate.h:71:12: error: ‘make_integer_sequence’ in namespace ‘std’ does not name a template type
71 | std::make_integer_sequence<int, ParameterDims::kNumParameterBlocks>;
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/variadic_evaluate.h:74:31: error: there are no arguments to ‘ParameterBlockIndices’ that depend on a template parameter, so a declaration of ‘ParameterBlockIndices’ must be available [-fpermissive]
74 | ParameterBlockIndices());
| ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/ceres/autodiff_cost_function.h:130,
from /usr/local/include/ceres/ceres.h:37,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/internal/autodiff.h: At global scope:
/usr/local/include/ceres/internal/autodiff.h:217:39: error: ‘integer_sequence’ is not a member of ‘std’
217 | struct Make1stOrderPerturbations<std::integer_sequence<int, N, Ns...>,
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:217:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/autodiff.h:217:69: error: template argument 1 is invalid
217 | struct Make1stOrderPerturbations<std::integer_sequence<int, N, Ns...>,
| ^
/usr/local/include/ceres/internal/autodiff.h:232:39: error: ‘integer_sequence’ is not a member of ‘std’
232 | struct Make1stOrderPerturbations<std::integer_sequence<int>, ParameterIdx, Total> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:232:39: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/autodiff.h:232:59: error: template argument 1 is invalid
232 | struct Make1stOrderPerturbations<std::integer_sequence<int>, ParameterIdx, Total> {
| ^
/usr/local/include/ceres/internal/autodiff.h:280:31: error: ‘integer_sequence’ is not a member of ‘std’
280 | struct Take1stOrderParts<std::integer_sequence<int, N, Ns...>,
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:280:31: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/autodiff.h:280:61: error: template argument 1 is invalid
280 | struct Take1stOrderParts<std::integer_sequence<int, N, Ns...>,
| ^
/usr/local/include/ceres/internal/autodiff.h:296:31: error: ‘integer_sequence’ is not a member of ‘std’
296 | struct Take1stOrderParts<std::integer_sequence<int>, ParameterIdx, Offset> {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/autodiff.h:296:31: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/autodiff.h:296:51: error: template argument 1 is invalid
296 | struct Take1stOrderParts<std::integer_sequence<int>, ParameterIdx, Offset> {
| ^
In file included from /usr/local/include/ceres/ceres.h:42,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/cost_function_to_functor.h:161:29: error: ‘std::integer_sequence’ has not been declared
161 | std::integer_sequence<int, Indices...>) {
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/cost_function_to_functor.h:161:45: error: expected ‘,’ or ‘...’ before ‘<’ token
161 | std::integer_sequence<int, Indices...>) {
| ^
/usr/local/include/ceres/cost_function_to_functor.h: In member function ‘bool ceres::CostFunctionToFunctor<kNumResiduals, Ns>::operator()(const T*, Ts* ...) const’:
/usr/local/include/ceres/cost_function_to_functor.h:147:14: error: ‘make_integer_sequence’ in namespace ‘std’ does not name a template type
147 | std::make_integer_sequence<int,
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ceres/cost_function_to_functor.h:150:41: error: there are no arguments to ‘Indices’ that depend on a template parameter, so a declaration of ‘Indices’ must be available [-fpermissive]
150 | GetParameterPointers<T>(params, Indices());
| ^~~~~~~
In file included from /usr/local/include/ceres/dynamic_numeric_diff_cost_function.h:44,
from /usr/local/include/ceres/ceres.h:48,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOpt.h:20,
from /home/fastpx4/dai_ws/src/VINS-Fusion/global_fusion/src/globalOptNode.cpp:13:
/usr/local/include/ceres/internal/numeric_diff.h: At global scope:
/usr/local/include/ceres/internal/numeric_diff.h:441:48: error: ‘integer_sequence’ is not a member of ‘std’
441 | std::integer_sequence<int, N, Ns...>,
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/numeric_diff.h:441:48: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/numeric_diff.h:441:78: error: template argument 2 is invalid
441 | std::integer_sequence<int, N, Ns...>,
| ^
/usr/local/include/ceres/internal/numeric_diff.h:485:63: error: ‘integer_sequence’ is not a member of ‘std’
485 | struct EvaluateJacobianForParameterBlocks<ParameterDims, std::integer_sequence<int>,
| ^~~~~~~~~~~~~~~~
/usr/local/include/ceres/internal/numeric_diff.h:485:63: error: ‘integer_sequence’ is not a member of ‘std’
/usr/local/include/ceres/internal/numeric_diff.h:485:83: error: template argument 2 is invalid
485 | struct EvaluateJacobianForParameterBlocks<ParameterDims, std::integer_sequence<int>,
| ^
make[2]: *** [VINS-Fusion/global_fusion/CMakeFiles/global_fusion_node.dir/build.make:63:VINS-Fusion/global_fusion/CMakeFiles/global_fusion_node.dir/src/globalOptNode.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1167:VINS-Fusion/global_fusion/CMakeFiles/global_fusion_node.dir/all] 错误 2
make: *** [Makefile:141:all] 错误 2
Invoking "make -j8 -l8" failed
2. 修改Cmakelist (四个文件夹)
1). 将c++11 修改为c++14
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-std=c++14")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC")
2). 明确指定find_package中的OpenCV的版本:
#find_package(OpenCV REQUIRED)
find_package(OpenCV 4 REQUIRED)
3. 添加头文件
1). camera_models>include>camodocal>chessboard>Chessboard.h中添加
#include <opencv2/imgproc/types_c.h> #include <opencv2/calib3d/calib3d_c.h>
2). 在以下几个文件中添加:
camera_models/include/camodocal/calib/CameraCalibration.h
loop_fusion/src/pose_graph.h
vins_estimator/src/featureTracker/feature_tracker.h
loop_fusion/src/ThirdParty/DVision/BRIEF.h
#include <opencv2/imgproc/types_c.h> #include <opencv2/imgproc/imgproc_c.h>
4. 仍然有一部分错误:
error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
122 | imLeft = cv::imread(leftImagePath, CV_LOAD_IMAGE_GRAYSCALE );
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/fastpx4/dai_ws/src/VINS-Fusion/vins_estimator/src/KITTIOdomTest.cpp: In function ‘int main(int, char**)’:
/home/fastpx4/dai_ws/src/VINS-Fusion/vins_estimator/src/KITTIOdomTest.cpp:95:39: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
95 | imLeft = cv::imread(leftImagePath, CV_LOAD_IMAGE_GRAYSCALE );
|
处理:将报错文件中的
CV_LOAD_IMAGE_GRAYSCALE
修改为
cv::IMREAD_GRAYSCALE
1). 修改报错文件:VINS-Fusion/vins_estimator/src/KITTIGPSTest.cpp
122 imLeft = cv::imread(leftImagePath, CV_LOAD_IMAGE_GRAYSCALE );
123 imRight = cv::imread(rightImagePath, CV_LOAD_IMAGE_GRAYSCALE );
修改后:
imLeft = cv::imread(leftImagePath, cv::IMREAD_GRAYSCALE );
imRight = cv::imread(rightImagePath, cv::IMREAD_GRAYSCALE );
2). 修改文件:VINS-Fusion/vins_estimator/src/KITTIOdomTest.cpp
imLeft = cv::imread(leftImagePath, CV_LOAD_IMAGE_GRAYSCALE );
sensor_msgs::ImagePtr imLeftMsg = cv_bridge::CvImage(std_msgs::Header(), "mono8", imLeft).toImageMsg();
imLeftMsg->header.stamp = ros::Time(imageTimeList[i]);
pubLeftImage.publish(imLeftMsg);
imRight = cv::imread(rightImagePath, CV_LOAD_IMAGE_GRAYSCALE );
sensor_msgs::ImagePtr imRightMsg = cv_bridge::CvImage(std_msgs::Header(), "mono8", imRight).toImageMsg();
imRightMsg->header.stamp = ros::Time(imageTimeList[i]);
pubRightImage.publish(imRightMsg);
修改后:
imLeft = cv::imread(leftImagePath, cv::IMREAD_GRAYSCALE );
sensor_msgs::ImagePtr imLeftMsg = cv_bridge::CvImage(std_msgs::Header(), "mono8", imLeft).toImageMsg();
imLeftMsg->header.stamp = ros::Time(imageTimeList[i]);
pubLeftImage.publish(imLeftMsg);
imRight = cv::imread(rightImagePath, cv::IMREAD_GRAYSCALE );
sensor_msgs::ImagePtr imRightMsg = cv_bridge::CvImage(std_msgs::Header(), "mono8", imRight).toImageMsg();
imRightMsg->header.stamp = ros::Time(imageTimeList[i]);
pubRightImage.publish(imRightMsg);
二、编译通过!测试运行:
source devel/setup.bash
1. 运行数据集Euroc:
roslaunch vins vins_rviz.launch
rosrun vins vins_node src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
rosrun loop_fusion loop_fusion_node src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
cd ../data/
rosbag play MH_01_easy.bag
运行成功
2. 运行OAK-D 双目相机:(教程网址)
1.4. ubuntu 18.04 OAK-D系列相机 运行VINS-Fusion 双目+IMU — DepthAI Docs 0.3.0.0 documentationhttps://docs.oakchina.cn/en/latest/pages/HighLevel/ros/ros_VINS_Fusion.html按照官网教程安装相机驱动,可以使用系统自带的opencv4.2版本进行编译。
roslaunch depthai_examples stereo_inertial_node.launch enableRviz:=false depth_aligned:=false
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/dai_ws/src/VINS-Fusion/config/oak_d/config.yaml
(optional) rosrun loop_fusion loop_fusion_node ~/dai_ws/src/VINS-Fusion/config/oak_d/config.yaml
注意:直接使用官网配置文件可能导致无法运行
在官网教程中使用的是OAK-D-S2相机,我使用的是OAK-D-PRO相机,配置参数有一些区别,需要对配置文件进行针对性的修改(在left.yaml和right.yaml文件中修改相机畸变参数),才可以正常运行VINS-Fusion程序。
- 启动相机驱动,确认相机正常运行:
roslaunch depthai_examples stereo_inertial_node.launch depth_aligned:=false
*depth_aligned:=false 此参数控制是否输出深度映射图像,这里是不输出
2.查看话题输出
rostopic list
/clicked_point /initialpose /joint_states /move_base_simple/goal /nodelet_manager/bond /rosout /rosout_agg /stereo_inertial_publisher/right/camera_info /stereo_inertial_publisher/right/image_rect /stereo_inertial_publisher/stereo/camera_info /stereo_inertial_publisher/stereo/depth /stereo_inertial_publisher/stereo/image /stereo_inertial_publisher/stereo/image/compressed /stereo_inertial_publisher/stereo/image/compressed/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressed/parameter_updates /stereo_inertial_publisher/stereo/image/compressedDepth /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_updates /stereo_inertial_publisher/stereo/image/theora /stereo_inertial_publisher/stereo/image/theora/parameter_descriptions /stereo_inertial_publisher/stereo/image/theora/parameter_updates /stereo_inertial_publisher/stereo/points /tf /tf_static
- 输出话题数据,并将参数写入left.yaml和right.yaml中:
rostopic echo /stereo_inertial_publisher/left/camera_info
header: seq: 7 stamp: secs: 1711676690 nsecs: 777232861 frame_id: "oak_left_camera_optical_frame" height: 720 width: 1280 distortion_model: "rational_polynomial" D: [-11.679576873779297, 105.025146484375, -0.0006934021948836744, 0.0018576113507151604, -51.34315490722656, -11.695950508117676, 104.31090545654297, -49.294837951660156] K: [798.2916259765625, 0.0, 651.572265625, 0.0, 798.2916259765625, 361.30743408203125, 0.0, 0.0, 1.0] R: [0.9997826814651489, 0.002714010654017329, -0.020668860524892807, -0.00276787206530571, 0.999992847442627, -0.00257775466889143, 0.020661717280745506, 0.002634403295814991, 0.9997830390930176] P: [799.2300415039062, 0.0, 654.2191772460938, 59.83273947490379, 0.0, 799.2300415039062, 359.2149658203125, 0.0, 0.0, 0.0, 1.0, 0.0] binning_x: 0 binning_y: 0 roi: x_offset: 0 y_offset: 0 height: 0 width: 0 do_rectify: False ---
将K矩阵对应填入文件left.yaml中
%YAML:1.0 --- model_type: PINHOLE camera_name: camera image_width: 640 image_height: 400 distortion_parameters: k1: 0.011099142353676499 k2: -0.05769482092275897 p1: -0.0009757653113701839 p2: 0.0025548857914714745 projection_parameters: fx: 798.2916259765625 fy: 798.2916259765625 cx: 651.572265625 cy: 361.30743408203125
rostopic echo /stereo_inertial_publisher/right/camera_info
header: seq: 291 stamp: secs: 1711676701 nsecs: 243829779 frame_id: "oak_right_camera_optical_frame" height: 720 width: 1280 distortion_model: "rational_polynomial" D: [-6.891867160797119, 81.7864990234375, -0.00016954877355601639, 0.0002883463748730719, -11.735593795776367, -6.942117691040039, 81.16423034667969, -9.775546073913574] K: [799.2300415039062, 0.0, 654.2191772460938, 0.0, 799.2300415039062, 359.2149658203125, 0.0, 0.0, 1.0] R: [0.999980092048645, -0.0040285540744662285, 0.004851967561990023, 0.004015895072370768, 0.9999884963035583, 0.002615976147353649, -0.0048624505288898945, -0.0025964390952140093, 0.9999848008155823] P: [799.2300415039062, 0.0, 654.2191772460938, 0.0, 0.0, 799.2300415039062, 359.2149658203125, 0.0, 0.0, 0.0, 1.0, 0.0] binning_x: 0 binning_y: 0 roi: x_offset: 0 y_offset: 0 height: 0 width: 0 do_rectify: False ---
%YAML:1.0 --- model_type: PINHOLE camera_name: camera image_width: 640 image_height: 400 distortion_parameters: k1: 0.005536021298200547 k2: -0.048229113205249675 p1: -0.0002985290327403832 p2: 0.0037187807087799125 projection_parameters: fx: 799.2300415039062 fy: 799.2300415039062 cx: 654.2191772460938 cy: 359.2149658203125
修改完成后,重新启动相机驱动及VIns-Fusion程序,即可成功运行。
*补充:
在文件(depthai-ros/depthai_examples/launch/stereo_inertial_node.launch)中可以发现,参数depth_aligned会决定输出话题是左右目图像还是深度图映射。
<node if="$(eval arg('depth_aligned') == true)" pkg="nodelet" type="nodelet" name="depth_image_to_rgb_pointcloud" args="load depth_image_proc/point_cloud_xyzrgb nodelet_manager"> <param name="queue_size" value="10"/> <remap from="rgb/camera_info" to="/stereo_inertial_publisher/color/camera_info"/> <remap from="rgb/image_rect_color" to="/stereo_inertial_publisher/color/image"/> <remap from="depth_registered/image_rect" to="/stereo_inertial_publisher/stereo/image"/> <remap from="depth_registered/points" to="/stereo_inertial_publisher/stereo/points"/> </node> <node if="$(eval arg('depth_aligned') == false)" pkg="nodelet" type="nodelet" name="depth_image_to_pointcloud" args="load depth_image_proc/point_cloud_xyz nodelet_manager"> <param name="queue_size" value="10"/> <remap from="camera_info" to="/stereo_inertial_publisher/stereo/camera_info"/> <remap from="image_rect" to="/stereo_inertial_publisher/stereo/image"/> <remap from="points" to="/stereo_inertial_publisher/stereo/points"/> </node>
如果启动相机驱动时不关闭这个参数,话题输出会不同。
/clicked_point /initialpose /joint_states /move_base_simple/goal /nodelet_manager/bond /rosout /rosout_agg /stereo_inertial_publisher/color/camera_info /stereo_inertial_publisher/color/image /stereo_inertial_publisher/color/image/compressed /stereo_inertial_publisher/color/image/compressed/parameter_descriptions /stereo_inertial_publisher/color/image/compressed/parameter_updates /stereo_inertial_publisher/color/image/compressedDepth /stereo_inertial_publisher/color/image/compressedDepth/parameter_descriptions /stereo_inertial_publisher/color/image/compressedDepth/parameter_updates /stereo_inertial_publisher/color/image/theora /stereo_inertial_publisher/color/image/theora/parameter_descriptions /stereo_inertial_publisher/color/image/theora/parameter_updates /stereo_inertial_publisher/color/preview/camera_info /stereo_inertial_publisher/color/preview/image /stereo_inertial_publisher/color/preview/image/compressed /stereo_inertial_publisher/color/preview/image/compressed/parameter_descriptions /stereo_inertial_publisher/color/preview/image/compressed/parameter_updates /stereo_inertial_publisher/color/preview/image/compressedDepth /stereo_inertial_publisher/color/preview/image/compressedDepth/parameter_descriptions /stereo_inertial_publisher/color/preview/image/compressedDepth/parameter_updates /stereo_inertial_publisher/color/preview/image/theora /stereo_inertial_publisher/color/preview/image/theora/parameter_descriptions /stereo_inertial_publisher/color/preview/image/theora/parameter_updates /stereo_inertial_publisher/color/yolov4_Spatial_detections /stereo_inertial_publisher/imu /stereo_inertial_publisher/stereo/camera_info /stereo_inertial_publisher/stereo/depth /stereo_inertial_publisher/stereo/depth/compressed /stereo_inertial_publisher/stereo/depth/compressed/parameter_descriptions /stereo_inertial_publisher/stereo/depth/compressed/parameter_updates /stereo_inertial_publisher/stereo/depth/compressedDepth /stereo_inertial_publisher/stereo/depth/compressedDepth/parameter_descriptions /stereo_inertial_publisher/stereo/depth/compressedDepth/parameter_updates /stereo_inertial_publisher/stereo/depth/theora /stereo_inertial_publisher/stereo/depth/theora/parameter_descriptions /stereo_inertial_publisher/stereo/depth/theora/parameter_updates /stereo_inertial_publisher/stereo/image /stereo_inertial_publisher/stereo/image/compressed /stereo_inertial_publisher/stereo/image/compressed/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressed/parameter_updates /stereo_inertial_publisher/stereo/image/compressedDepth /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_updates /stereo_inertial_publisher/stereo/image/theora /stereo_inertial_publisher/stereo/image/theora/parameter_descriptions /stereo_inertial_publisher/stereo/image/theora/parameter_updates /stereo_inertial_publisher/stereo/points /tf /tf_static
三、VIns-Fusion配置参数矫正
参考浙江大学Fast-Lab教程
【完结】从0制作自主空中机器人 | 开源 | 浙江大学Fast-Lab_哔哩哔哩_bilibilihttps://www.bilibili.com/video/BV1WZ4y167me/?spm_id_from=333.1007.top_right_bar_window_custom_collection.content.click&vd_source=7efc9d03142aa088952c10884de6dadfZJU-FAST-Lab/Fast-Drone-250: hardware and software design of the 250mm autonomous drone (github.com)https://github.com/ZJU-FAST-Lab/Fast-Drone-250
1)启动Vins程序,查看输出话题;
/clicked_point /feature_tracker/feature /globalEstimator/car_model /globalEstimator/global_path /initialpose /joint_states /loop_fusion/base_path /loop_fusion/camera_pose_visual /loop_fusion/margin_cloud_loop_rect /loop_fusion/pose_graph /move_base_simple/goal /nodelet_manager/bond /rosout /rosout_agg /stereo_inertial_publisher/imu /stereo_inertial_publisher/left/camera_info /stereo_inertial_publisher/left/image_rect /stereo_inertial_publisher/left/image_rect/compressed /stereo_inertial_publisher/left/image_rect/compressed/parameter_descriptions /stereo_inertial_publisher/left/image_rect/compressed/parameter_updates /stereo_inertial_publisher/left/image_rect/compressedDepth /stereo_inertial_publisher/left/image_rect/compressedDepth/parameter_descriptions /stereo_inertial_publisher/left/image_rect/compressedDepth/parameter_updates /stereo_inertial_publisher/left/image_rect/theora /stereo_inertial_publisher/left/image_rect/theora/parameter_descriptions /stereo_inertial_publisher/left/image_rect/theora/parameter_updates /stereo_inertial_publisher/right/camera_info /stereo_inertial_publisher/right/image_rect /stereo_inertial_publisher/right/image_rect/compressed /stereo_inertial_publisher/right/image_rect/compressed/parameter_descriptions /stereo_inertial_publisher/right/image_rect/compressed/parameter_updates /stereo_inertial_publisher/right/image_rect/compressedDepth /stereo_inertial_publisher/right/image_rect/compressedDepth/parameter_descriptions /stereo_inertial_publisher/right/image_rect/compressedDepth/parameter_updates /stereo_inertial_publisher/right/image_rect/theora /stereo_inertial_publisher/right/image_rect/theora/parameter_descriptions /stereo_inertial_publisher/right/image_rect/theora/parameter_updates /stereo_inertial_publisher/stereo/camera_info /stereo_inertial_publisher/stereo/depth /stereo_inertial_publisher/stereo/depth/compressed /stereo_inertial_publisher/stereo/depth/compressed/parameter_descriptions /stereo_inertial_publisher/stereo/depth/compressed/parameter_updates /stereo_inertial_publisher/stereo/depth/compressedDepth /stereo_inertial_publisher/stereo/depth/compressedDepth/parameter_descriptions /stereo_inertial_publisher/stereo/depth/compressedDepth/parameter_updates /stereo_inertial_publisher/stereo/depth/theora /stereo_inertial_publisher/stereo/depth/theora/parameter_descriptions /stereo_inertial_publisher/stereo/depth/theora/parameter_updates /stereo_inertial_publisher/stereo/image /stereo_inertial_publisher/stereo/image/compressed /stereo_inertial_publisher/stereo/image/compressed/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressed/parameter_updates /stereo_inertial_publisher/stereo/image/compressedDepth /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_descriptions /stereo_inertial_publisher/stereo/image/compressedDepth/parameter_updates /stereo_inertial_publisher/stereo/image/theora /stereo_inertial_publisher/stereo/image/theora/parameter_descriptions /stereo_inertial_publisher/stereo/image/theora/parameter_updates /stereo_inertial_publisher/stereo/points /tf /tf_static /vins_cam_switch /vins_fusion/camera_pose /vins_fusion/camera_pose_visual /vins_fusion/extrinsic /vins_fusion/image_track /vins_fusion/imu_propagate /vins_fusion/key_poses /vins_fusion/keyframe_point /vins_fusion/keyframe_pose /vins_fusion/margin_cloud /vins_fusion/odometry /vins_fusion/path /vins_fusion/point_cloud /vins_imu_switch /vins_restart
2)终端输入,查看程序输出position的漂移情况
rostopic echo /vins_fusion/imu_propagate
header: seq: 30359 stamp: secs: 1711678556 nsecs: 905394554 frame_id: "world" child_frame_id: '' pose: pose: position: x: -0.0018558396542408368 y: 0.0006243309409628052 z: 0.002800527454180711 orientation: x: 0.8243210546283225 y: 0.009086388930822076 z: -0.5658114242209056 w: 0.01642161438402998 covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] twist: twist: linear: x: 0.0003866194433702027 y: 0.0008024273412679251 z: 0.00022701032056310962 angular: x: 0.0 y: 0.0 z: 0.0 covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] ---
3)(将相机与板载计算机固定在无人机上之后)抱起无人机在场地内缓慢走动,在vins的输出文件夹下打开extrinsic_parameter.txt
将文件内容替换在config.yaml文件中对应位置。
%YAML:1.0 #common parameters #support: 1 imu 1 cam; 1 imu 2 cam: 2 cam; imu: 1 num_of_cam: 2 #imu_topic: "/mavros/imu/data_raw" imu_topic: "/stereo_inertial_publisher/imu" #/stereo_inertial_publisher/imu image0_topic: "/stereo_inertial_publisher/left/image_rect" image1_topic: "/stereo_inertial_publisher/right/image_rect" output_path: "/home/fastpx4/abc/vins_output" cam0_calib: "left.yaml" cam1_calib: "right.yaml" image_width: 640 #640 image_height: 400 #400 # Extrinsic parameter between IMU and Camera. estimate_extrinsic: 1 # 0 Have an accurate extrinsic parameters. We will trust the following imu^R_cam, imu^T_cam, don't change it. # 1 Have an initial guess about extrinsic parameters. We will optimize around your initial guess. body_T_cam0: !!opencv-matrix rows: 4 cols: 4 dt: d data: [ 1.1582253353211946e-02, 9.9992842406279825e-01, 2.9996930761942851e-03, -1.5936022004130995e-02, 9.9992731716619121e-01, -1.1572090774962351e-02, -3.3833563099195255e-03, -8.4883987362590493e-02, -3.3484014224460091e-03, 3.0386619399666269e-03, -9.9998977731851335e-01, -3.4809993558054787e-02, 0., 0., 0., 1. ] body_T_cam1: !!opencv-matrix rows: 4 cols: 4 dt: d data: [ 1.1352436793192977e-02, 9.9993544249239663e-01, 4.8272807242477774e-04, -1.5103709396341888e-02, 9.9993074772788504e-01, -1.1350883268602896e-02, -3.1076031560835337e-03, -9.5661037692648648e-03, -3.1019231469685844e-03, 5.1797351081671458e-04, -9.9999505487588936e-01, -3.3604401456376665e-02, 0., 0., 0., 1. ] #Multiple thread support multiple_thread: 1 #feature traker paprameters max_cnt: 130 # max feature number in feature tracking min_dist: 30 # min distance between two features freq: 0 # frequence (Hz) of publish tracking result. At least 10Hz for good estimation. If set 0, the frequence will be same as raw image F_threshold: 1.0 # ransac threshold (pixel) show_track: 1 # publish tracking image as topic flow_back: 1 # perform forward and backward optical flow to improve feature tracking accuracy #optimization parameters max_solver_time: 0.04 # max solver itration time (ms), to guarantee real time max_num_iterations: 8 # max solver itrations, to guarantee real time keyframe_parallax: 10.0 # keyframe selection threshold (pixel) #imu parameters The more accurate parameters you provide, the better performance acc_n: 0.1 # accelerometer measurement noise standard deviation. gyr_n: 0.01 # gyroscope measurement noise standard deviation. acc_w: 0.001 # accelerometer bias random work noise standard deviation. gyr_w: 0.0001 # gyroscope bias random work noise standard deviation. g_norm: 9.81007 # gravity magnitude #unsynchronization parameters estimate_td: 1 # online estimate time offset between camera and imu td: 0.0 # initial value of time offset. unit: s. readed image clock + td = real image clock (IMU clock) #loop closure parameters load_previous_pose_graph: 0 # load and reuse previous pose graph; load from 'pose_graph_save_path' pose_graph_save_path: "/home/fastpx4/abc/vins_output" # save and load path save_image: 1 # save image in pose graph for visualization prupose; you can close this function by setting 0
*重复上述过程,覆盖配置参数,直到话题中位置输出收敛到满意程度。
ego-planner程序还在调试中,后续更新!
刚发现,直接下载港科大的vinsfusion功能包,链接ego-planner功能包会有一定话题差别,如果后期要用ego进行导航,推荐直接下载浙大的功能包进行修改哦!
版权归原作者 求上进的小怪兽 所有, 如有侵权,请联系我们删除。