Vins-Moon配准运行

news2024/9/24 17:47:15

Vins-Moon运行

  • 源码地址
  • 电脑配置
  • 环境配置
  • 编译
  • 适配Kitti数据集
  • 运行结果
    • Euroc数据集
    • kitti数据集
  • evo评估(KITTI数据)
    • 输出轨迹(tum格式)
    • 结果

源码地址

源码链接:https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git

电脑配置

Ubuntu 18.04 + ROS Melodic + GTSAM 4.0.2 + CERES 1.14.0
pcl1.8+vtk8.2.0+opencv3.2.0

环境配置

之前已经配置过LVI-SAM的环境,所以没有什么额外需要配置的(可参考之前的博客)

编译

 cd ~/catkin_ws/src
 git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git
 cd ..
 catkin_make -j2

注:直接catkin_make会死机

适配Kitti数据集

在config文件夹下新建kitti文件夹
新建kitti_config.yaml文件
(具体参数设置的方式,可以参考之前LVI-SAM博客)

%YAML:1.0

#common parameters
imu_topic: "/imu_raw"   #"/kitti/oxts/imu"
image_topic: "/kitti/camera_gray_left/image_raw"
output_path: "/home/nssc/sbk/outputs/map/vinsmoon/"

#camera calibration 
model_type: PINHOLE
camera_name: camera
#10_03
# image_width: 1241
# image_height: 376
# 09_30
image_width: 1226
image_height: 370
distortion_parameters:
  k1: 0.0
  k2: 0.0
  p1: 0.0
  p2: 0.0
projection_parameters:
# 10_03
#   fx: 7.188560e+02
#   fy: 7.188560e+02
#   cx: 6.071928e+02
#   cy: 1.852157e+02
  # 09_30
  fx: 7.070912e+02
  fy: 7.070912e+02
  cx: 6.018873e+02
  cy: 1.831104e+02

# Extrinsic parameter between IMU and Camera.
estimate_extrinsic: 0   # 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.
                        # 2  Don't know anything about extrinsic parameters. You don't need to give R,T. We will try to calibrate it. Do some rotation movement at beginning.                        
#If you choose 0 or 1, you should write down the following matrix.
#Rotation from camera frame to imu frame, imu^R_cam
extrinsicRotation: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
  #  10_03
   # data: [0.00875116, -0.00479609,  0.99995027, -0.99986428, -0.01400249,  0.00868325, 0.01396015, -0.99989044, -0.00491798]
  #  09_30
   data: [0.00781298, -0.0042792,  0.99996033,-0.99985947, -0.01486805,  0.00774856, 0.0148343 , -0.99988023, -0.00439476]     

#Translation from camera frame to imu frame, imu^T_cam
extrinsicTranslation: !!opencv-matrix
   rows: 3
   cols: 1
   dt: d
  #  10_03
   # data: [1.10224312,-0.31907194,  0.74606588]
#09_30 
   data: [1.14389871,-0.31271847,  0.72654605]

#feature traker paprameters
max_cnt: 150            # max feature number in feature tracking
min_dist: 30            # min distance between two features 
freq: 10                # 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
equalize: 1             # if image is too dark or light, trun on equalize to find enough features
fisheye: 0              # if using fisheye, trun on it. A circle mask will be loaded to remove edge noisy points

#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.08          # accelerometer measurement noise standard deviation. #0.2   0.04
gyr_n: 0.004         # gyroscope measurement noise standard deviation.     #0.05  0.004
acc_w: 0.00004         # accelerometer bias random work noise standard deviation.  #0.02
gyr_w: 2.0e-6       # gyroscope bias random work noise standard deviation.     #4.0e-5
g_norm: 9.81007     # gravity magnitude

#loop closure parameters
loop_closure: 1                    # start loop closure
load_previous_pose_graph: 0        # load and reuse previous pose graph; load from 'pose_graph_save_path'
fast_relocalization: 0             # useful in real-time and large project
pose_graph_save_path: "/home/nssc/sbk/outputs/map/vinsmoon/pose_graph/" # save and load path

#unsynchronization parameters
estimate_td: 0                      # 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)

#rolling shutter parameters
rolling_shutter: 0                  # 0: global shutter camera, 1: rolling shutter camera
rolling_shutter_tr: 0               # unit: s. rolling shutter read out time per frame (from data sheet). 

#visualization parameters
save_image: 1                   # save image in pose graph for visualization prupose; you can close this function by setting 0 
visualize_imu_forward: 0        # output imu forward propogation to achieve low latency and high frequence results
visualize_camera_size: 0.4      # size of camera marker in RVIZ

在vins_estimator/launch/文件夹下新建文件kitti.launch
(主要修改一下config_path的路径)

<launch>
    <arg name="config_path" default = "$(find feature_tracker)/../config/kitti/kitti_config.yaml" />
	  <arg name="vins_path" default = "$(find feature_tracker)/../config/../" />
    
    <node name="feature_tracker" pkg="feature_tracker" type="feature_tracker" output="log">
        <param name="config_file" type="string" value="$(arg config_path)" />
        <param name="vins_folder" type="string" value="$(arg vins_path)" />
    </node>

    <node name="vins_estimator" pkg="vins_estimator" type="vins_estimator" output="screen">
       <param name="config_file" type="string" value="$(arg config_path)" />
       <param name="vins_folder" type="string" value="$(arg vins_path)" />
    </node>

    <node name="pose_graph" pkg="pose_graph" type="pose_graph" output="screen">
        <param name="config_file" type="string" value="$(arg config_path)" />
        <param name="visualization_shift_x" type="int" value="0" />
        <param name="visualization_shift_y" type="int" value="0" />
        <param name="skip_cnt" type="int" value="0" />
        <param name="skip_dis" type="double" value="0" />
    </node>

</launch>

运行结果

Euroc数据集

 roslaunch vins_estimator euroc.launch 
 roslaunch vins_estimator vins_rviz.launch
 rosbag play YOUR_PATH_TO_DATASET/MH_01_easy.bag 

在这里插入图片描述同时看到groundtrue:

roslaunch benchmark_publisher publish.launch sequence_name:=MH_01_easy

在这里插入图片描述

kitti数据集

有关kitti数据集生成bag包的方式,可参考之前生成LVI-SAM适配数据的博客

 roslaunch vins_estimator kitti.launch 
 roslaunch vins_estimator vins_rviz.launch
 rosbag play YOUR_PATH_TO_DATASET/ rosbag play kitti_2011_09_30_drive_0027_synced.bag

在这里插入图片描述

evo评估(KITTI数据)

输出轨迹(tum格式)

vins_estimator/src/utility/visualization.cpp
pubOdometry()函数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;

         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();

pose_graph/src/pose_graph.cpp
addKeyFrame()函数150+行

    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();
    }

updatePath()函数600+行

        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();
        }

pose_graph_node.cpp中的main()函数

       # VINS_RESULT_PATH = VINS_RESULT_PATH + "/vins_result_loop.csv";
        VINS_RESULT_PATH = VINS_RESULT_PATH + "/vins_result_loop.txt";

对输出的vins_result_loop.txt文件修改时间戳

# 读取txt文件
with open('vins_result_loop.txt', 'r') as file:
    lines = file.readlines()

# 处理数据
first_line = lines[0].strip().split()
first_num = int(first_line[0])
output_lines = []
for line in lines[0:]:
    parts = line.split()
    new_num = float(parts[0]) - first_num
    new_line = str(new_num)  +' '+ ' '.join(parts[1:]) + '\n'
    output_lines.append(new_line)

# 写入txt文件
with open('output.txt', 'w') as file:
    for line in output_lines:
        file.write(''.join(line))

结果

evo_traj tum output.txt 07_gt_tum.txt --ref=07_gt_tum.txt -a -p --plot_mode=xyz


在这里插入图片描述
在这里插入图片描述

参考链接:
https://blog.csdn.net/m0_49066914/article/details/131814856
https://blog.csdn.net/Hanghang_/article/details/104535370

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1483404.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

机器学习:模型评估和模型保存

一、模型评估 from sklearn.metrics import accuracy_score, confusion_matrix, classification_report# 使用测试集进行预测 y_pred model.predict(X_test)# 计算准确率 accuracy accuracy_score(y_test, y_pred) print(f"Accuracy: {accuracy*100:.2f}%")# 打印…

MySQL 表的基本操作,结合项目的表自动初始化来讲

有了数据库以后&#xff0c;我们就可以在数据库中对表进行增删改查了&#xff0c;这也就意味着&#xff0c;一名真正的 CRUD Boy 即将到来&#xff08;&#x1f601;&#xff09;。 查表 查看当前数据库中所有的表&#xff0c;使用 show tables; 命令 由于当前数据库中还没有…

CrossOver2024电脑虚拟机软件详细介绍概述

CrossOver是由CodeWeavers开发的一款系统兼容软件&#xff0c;它能够在Mac和Linux操作系统上直接运行Windows应用程序&#xff0c;而无需创建或启动完整的Windows虚拟机。CrossOver通过模拟Windows应用程序所需的运行环境&#xff0c;实现了跨平台的无缝集成和高效运行。 Cross…

界面控件Telerik UI for ASP. NET Core教程 - 如何为网格添加上下文菜单?

Telerik UI for ASP.NET Core是用于跨平台响应式Web和云开发的最完整的UI工具集&#xff0c;拥有超过60个由Kendo UI支持的ASP.NET核心组件。它的响应式和自适应的HTML5网格&#xff0c;提供从过滤、排序数据到分页和分层数据分组等100多项高级功能。 上下文菜单允许开发者为应…

如何恢复edge的自动翻译功能

介绍&#xff1a;对于英文不好的小伙伴&#xff0c;把英语翻译成中文是有帮助的&#xff0c;而edge可以直接对英文页面翻译这一功能更是受人喜爱&#xff0c;但是&#xff0c;最近发现这一项功能消失了。 原始界面&#xff1a; 下面展示如何恢复该功能。 1.打开edge&#xff…

软考中级 软件设计师备考经验

考试介绍 软考中级的软件设计师需要考两个部分&#xff0c;选择题和大题&#xff0c;每科满分75&#xff0c;需要在同一次考试中两科同时大于等于45分才算通过。考试的内容包括计算机组成原理、数据结构、数据库、专业英语、信息安全、计算机网络等&#xff0c;范围比较广但考…

外卖店优先级

题目描述 ”饱了么”外卖系统中维护着N 家外卖店&#xff0c;编号1~N。每家外卖店都有一个优先级&#xff0c;初始时(0时刻)优先级都为0。 每经过1个时间单位&#xff0c;如果外卖店没有订单&#xff0c;则优先级会减少1&#xff0c;最低减到0;而如果外卖店有订单&#xff0c;则…

mysql8.0安装(zip版本)最详细

下载 https://dev.mysql.com/downloads/mysql/ 解压 [mysqld] # 设置3306端口 port3306 # 设置mysql的安装目录 basedirD:\Atools\mysql-8.0.30-winx64 # 切记此处一定要用双斜杠\\&#xff0c;单斜杠我这里会出错&#xff0c;不过看别人的教程&#xff0c;有的是单斜杠。自己…

Java基于SpringBoot的在线文档管理系统的设计与实现论文

摘 要 随着科学技术的飞速发展&#xff0c;社会的方方面面、各行各业都在努力与现代的先进技术接轨&#xff0c;通过科技手段来提高自身的优势&#xff0c;在线文档管理当然也不能排除在外。在线文档管理系统是以实际运用为开发背景&#xff0c;运用软件工程原理和开发方法&am…

基于springboot+vue的乐享田园系统

博主主页&#xff1a;猫头鹰源码 博主简介&#xff1a;Java领域优质创作者、CSDN博客专家、阿里云专家博主、公司架构师、全网粉丝5万、专注Java技术领域和毕业设计项目实战&#xff0c;欢迎高校老师\讲师\同行交流合作 ​主要内容&#xff1a;毕业设计(Javaweb项目|小程序|Pyt…

QT编写的程序需要打开远程主机的GUI的配置事项

1.首先通过输入指令进行远程登录: ssh -X 主机名主机地址或者ssh -Y 主机名主机地址 ​编辑 2.在远程主机上输入指令: env |grep DISPLAY ​编辑 3.得到DISPLAY参数值后进入到QT的RUN Environment参数配置栏配置如下图所示: ​编辑 在工具包的“运行”选项中&#xff0c;进…

现货商品国际挂牌撮合系统功能说明书

现货商品国际挂牌撮合系统功能说明书 一、系统概述 现货商品国际挂牌撮合系统是一个基于互联网技术的电子交易平台&#xff0c;旨在为全球现货商品买卖双方提供高效、透明、公正的撮合服务。该系统通过先进的撮合算法和交易规则&#xff0c;确保交易的快速匹配和成交&#xf…

基于pytorch实现手写数字识别

1&#xff0c;先安装pytorch&#xff0c;在pytorch环境中安装库&#xff1a; 1&#xff09;进入所安装的pytorch环境&#xff0c;我的是pytorch 所以激活它&#xff1a; conda activate pytorch 2&#xff09;使用pip安装numpy,torch,torchvision,matplotlib库 pip instal…

鸿蒙开发案例:进京赶考(4)

系列文章目录 鸿蒙开发案例&#xff1a;进京赶考&#xff08;1&#xff09; 鸿蒙开发案例&#xff1a;进京赶考&#xff08;2&#xff09; 鸿蒙开发案例&#xff1a;进京赶考&#xff08;3&#xff09; 鸿蒙开发案例&#xff1a;进京赶考&#xff08;4&#xff09; 案例介绍…

计算机服务器中了mallox勒索病毒怎么解密,mallox勒索病毒解密流程

科技技术的第一生产力&#xff0c;网络技术的不断发展与应用&#xff0c;让企业逐步走向数字化时代&#xff0c;通过网络的力量可以为企业更好地开展各项业务工作&#xff0c;网络数据安全问题也由此成为众多企业关心的主要话题。近日&#xff0c;云天数据恢复中心接到某化工集…

Python + Appium 自动化操作微信入门看这一篇就够了

Appium 是一个开源的自动化测试工具&#xff0c;支持 Android、iOS 平台上的原生应用&#xff0c;支持 Java、Python、PHP 等多种语言。 Appium 封装了 Selenium&#xff0c;能够为用户提供所有常见的 JSON 格式的 Selenium 命令以及额外的移动设备相关的控制命令&#xff0c;…

5GC SBA架构

协议标准&#xff1a;Directory Listing /ftp/Specs/archive/23_series/23.501/ (3gpp.org) NF描述说明NSSFNetwork Slice Selection Function网络切片选择&#xff0c;根据UE的切片选择辅助信息、签约信息等确定UE允许接入的网络切片实例。NEF Network Exposure Function网络开…

Docker与虚拟机比较

在对比Docker和虚拟机前&#xff0c;先简单了解下虚拟化&#xff0c;明确Docker和虚拟机分别对应的虚拟化级别&#xff0c;然后对Docker和虚拟机进行比较。需要注意的是&#xff0c;Docker和虚拟机并没有什么可比性&#xff0c;而是Docker使用的容器技术和虚拟机使用的虚拟化技…

git介绍4.2

git(版本控制工具) 一、git 介绍 1、git是目前世界上最先进的分布式版本控制系统&#xff0c;可以有效&#xff0c;高速的处理从小到大的项目版本管理。 2、git是linux torvalds 为了帮助管理linux内核开发二开发的一个开放源码的版本控制软件。 3、git作用&#xff1a;更好…

【深度学习笔记】计算机视觉——图像增广

图像增广 sec_alexnet提到过大型数据集是成功应用深度神经网络的先决条件。 图像增广在对训练图像进行一系列的随机变化之后&#xff0c;生成相似但不同的训练样本&#xff0c;从而扩大了训练集的规模。 此外&#xff0c;应用图像增广的原因是&#xff0c;随机改变训练样本可以…