VINS_mono编译运行测试(含evo)

1 安装依赖

1.1 opencv

这里用的之前安装的4.4.0版本 参考上一篇ORBSLAM3文章

1.2 Eigen3

建议源码安装,参考这篇文章和上一篇ORBSLAM3

1.3 Ceres

参考IMU标定,装的2.1.0

2 修改VINS-mono轨迹保存代码

如果需要用evo测评的话,就得改
一共三个地方
No.1 vins_estimator/src/utility/visualization.cpp 150多行

        // write result to file
        //ofstream foutC(VINS_RESULT_PATH, ios::app);
        //foutC.setf(ios::fixed, ios::floatfield);
        //foutC.precision(0);
        //foutC << header.stamp.toSec() * 1e9 << ",";
        //foutC.precision(5);
        //foutC << estimator.Ps[WINDOW_SIZE].x() << ","
        //      << estimator.Ps[WINDOW_SIZE].y() << ","
        //      << estimator.Ps[WINDOW_SIZE].z() << ","
        //      << tmp_Q.w() << ","
        //      << tmp_Q.x() << ","
        //      << tmp_Q.y() << ","
        //      << tmp_Q.z() << ","
        //      << estimator.Vs[WINDOW_SIZE].x() << ","
        //      << estimator.Vs[WINDOW_SIZE].y() << ","
        //      << estimator.Vs[WINDOW_SIZE].z() << "," << endl;
              
         // write result to file
	 ofstream foutC(VINS_RESULT_PATH, ios::app);
	 foutC.setf(ios::fixed, ios::floatfield);
	 foutC.precision(9);
	 foutC << header.stamp.toSec() << " ";
	 foutC.precision(5);
	 foutC << estimator.Ps[WINDOW_SIZE].x() << " "
	       << estimator.Ps[WINDOW_SIZE].y() << " "
	       << estimator.Ps[WINDOW_SIZE].z() << " "
	       << tmp_Q.x() << " "
	       << tmp_Q.y() << " "
	       << tmp_Q.z() << " "
	       << tmp_Q.w() << endl;
         
        foutC.close();

No.2 and 3 pose_graph/src/pose_graph.cpp
No.2 150多行addKeyFrame()函数里面

    if (SAVE_LOOP_PATH)
    {
        //ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
        //loop_path_file.setf(ios::fixed, ios::floatfield);
        //loop_path_file.precision(0);
        //loop_path_file << cur_kf->time_stamp * 1e9 << ",";
        //loop_path_file.precision(5);
        //loop_path_file  << P.x() << ","
         //     << P.y() << ","
        //      << P.z() << ","
        //      << Q.w() << ","
        //      << Q.x() << ","
        //      << Q.y() << ","
         //     << Q.z() << ","
         //     << endl;
        ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
        loop_path_file.setf(ios::fixed, ios::floatfield);
        loop_path_file.precision(0);
        loop_path_file << cur_kf->time_stamp << " ";
        loop_path_file.precision(5);
        loop_path_file  << P.x() << " "
                        << P.y() << " "
                        << P.z() << " "
                        << Q.x() << " "
                        << Q.y() << " "
                        << Q.z() << " "
                        << Q.w() << endl;     
        loop_path_file.close();
    }

No.3 600多行updatePath()函数里面

        if (SAVE_LOOP_PATH)
        {
            //ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
            //loop_path_file.setf(ios::fixed, ios::floatfield);
            //loop_path_file.precision(0);
            //loop_path_file << (*it)->time_stamp * 1e9 << ",";
            //loop_path_file.precision(5);
            //loop_path_file  << P.x() << ","
             //     << P.y() << ","
              //    << P.z() << ","
            //      << Q.w() << ","
             //     << Q.x() << ","
             //     << Q.y() << ","
              //    << Q.z() << ","
             //     << endl;
            ofstream loop_path_file(VINS_RESULT_PATH, ios::app);
            loop_path_file.setf(ios::fixed, ios::floatfield);
            loop_path_file.precision(0);
            loop_path_file << (*it)->time_stamp << " ";
            loop_path_file.precision(5);
            loop_path_file  << P.x() << " "
                            << P.y() << " "
                            << P.z() << " "
                            << Q.x() << " "
                            << Q.y() << " "
                            << Q.z() << " "
                            << Q.w() << endl;

            loop_path_file.close();
        }

2 编译VINS-Mono

1、CMake Error at /usr/local/lib/cmake/Ceres/CeresConfig.cmake:85 (message): Failed to find Ceres - Found Eigen dependency, but the version of Eigen found (3.3.90) does not exactly match the version of Eigen Ceres was compiled with (3.3.7). This can cause subtle bugs by triggering violations of the One Definition Rule. See the Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule for more details

试了各种方法,重新安装了一下ceres-solver

2、error: ‘std::integer_sequence’ has not been declared
改std为14

3、error:‘ CV_* ’was not declared in this scope
加头文件,参考文章
在这里插入图片描述
/VINS-Mono/camera_model/src/intrinsic_calib.cc

#include <opencv2/imgproc/imgproc_c.h>

/VINS-Mono/camera_model/src/chessboard/Chessboard.cc

 #include <opencv2/calib3d/calib3d_c.h>
 #include <opencv2/imgproc/types_c.h>

/VINS-Mono/camera_model/src/calib/CameraCalibration.cc

#include <opencv2/imgproc/types_c.h>
 #include <opencv2/imgproc/imgproc_c.h>

或236行修改为

cv::COLOR_GRAY2BGR

/VINS-Mono/pose_graph/src/ThirdParty/DVision/BRIEF.cpp

 #include <opencv2/imgproc/types_c.h>

/VINS-Mono/pose_graph/src/pose_graph.cpp/VINS-Mono/pose_graph/src/keyframe.cpp
CV_FONT_HERSHEY_SIMPLEX修改为

cv::FONT_HERSHEY_SIMPLEX

运行VINS-mono

roslaunch vins_estimator euroc.launch 
roslaunch vins_estimator vins_rviz.launch
rosbag play ~/catkin_ws/Dataset/MH_01_easy.bag

.yaml文件参数参考文章

evo安装

github官网地址
大概的使用方法

evo_traj tum vio.csv -p	//显示轨迹 -p画图
evo_traj bag 你的bag名 你的topic名 --save_as_tum	//bag转tum
evo_ape tum groundtruth.csv vio.csv -p -va --save_results results.zip //计算j绝对位姿误差,-v显示详细信息,-a对齐,--save_results保存结果
evo_rpe //使用方法同上,计算相对位姿误差
evo_res 1.zip 2.zip -p	//比较1和2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值