-
大小: 118KB文件类型: .zip金币: 2下载: 0 次发布日期: 2021-05-18
- 语言: 其他
- 标签: SLAM trajectory c
资源简介
用于SLAM的,如何比较两断轨迹,以及如何将这两段轨迹用pangolin在界面中绘制出来

代码片段和文件信息
#include
#include
#include
#include
#include
// need pangolin for plotting trajectory
#include
using namespace std;
// path to trajectory file
string estimated_trajectory_file = “../data/estimated.txt“;
string groundtruth_trajectory_file = “../data/groundtruth.txt“;
// 读取位姿数据
void ReadPoses(vector> &poses string trajectory_file);
// 比较两个 pose
double CompareTwoPose(Sophus::SE3 estimated_pose Sophus::SE3 groundtruth_pose);
// 比较两组 pose
double ComparePoses(vector> estimated_poses
vector> groundtruth_poses);
// function for plotting trajectory don‘t edit this code
// start point is red and end point is blue
void DrawTrajectory(vector>);
// 重载一个绘图函数
void DrawTrajectory(vector> estimated_poses
vector> groundtruth_poses);
int main(int argc char **argv) {
vector> estimated_poses;
vector> groundtruth_poses;
// 读取位姿
ReadPoses(estimated_poses estimated_trajectory_file);
ReadPoses(groundtruth_poses groundtruth_trajectory_file);
// 比较两组位姿数据
double rmse(0);
rmse = ComparePoses(estimated_poses groundtruth_poses);
cout << “rmse = “ << rmse << endl;
// 把轨迹画出来
DrawTrajectory(estimated_poses groundtruth_poses);
return 0;
}
// 读取位姿数据
void ReadPoses(vector> &poses string trajectory_file)
{
ifstream fs(trajectory_file);
if(!fs.is_open())
{
cout << “Error: cannot open file “ << trajectory_file << “ !“ << endl;
return;
}
string sline;
double t tx ty tz qx qy qz qw;
while(getline(fs sline))
{
stringstream ss(sline);
ss >> t >> tx >> ty >> tz >> qx >> qy >> qz >> qw;
Sophus::SE3 SE3(Eigen::Quaterniond(qw qx qy qz) Eigen::Vector3d(tx ty tz));
poses.push_back(SE3);
}
fs.close();
}
// 比较两个 pose
double CompareTwoPose(Sophus::SE3 estimated_pose Sophus::SE3 groundtruth_pose)
{
Sophus::SE3 error = estimated_pose.inverse() * groundtruth_pose;
Sophus::Vector6d se3 = error.log();
double norm = se3.norm();
return norm*norm;
}
// 比较两组 pose
double ComparePoses(vector> estimated_poses
vector> groundtruth_poses)
{
if(estimated_poses.size() != groundtruth_poses.size())
{
cout << “Error! The size of estimated pose and ground truth pose does not match!“ << endl;
return -1;
}
d
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-10 20:22 ch3\
文件 1461 2018-07-01 16:30 ch3\CMakeLists.txt
目录 0 2018-07-10 20:08 ch3\data\
文件 104075 2017-12-10 15:08 ch3\data\estimated.txt
文件 103876 2017-12-10 15:08 ch3\data\groundtruth.txt
文件 65386 2017-12-10 14:13 ch3\data\trajectory.txt
目录 0 2018-06-16 10:54 ch3\include\
目录 0 2018-06-16 10:54 ch3\src\
目录 0 2018-07-10 20:22 ch3\test\
文件 7078 2018-06-23 11:35 ch3\test\compare_trajectory.cpp
文件 2872 2018-06-23 11:34 ch3\test\draw_trajectory.cpp
- 上一篇:极好的LTB转换工具~表错过哦~
- 下一篇:ARCGIS 批量裁剪插件
相关资源
- ModelGoon-4.4.1-site.zip
- AsyncTask文件控制暂停和继续,在状态
- Visio大全模具(含Cisco、IBM等常用拓扑
- 信号奇异点Lipschitz指数计算
- 基于STM32RCT6的步进电机驱动程序
- 酒店管理系统基于Qt Creator5)
- 用友NC开发API字典
- Navicat Premium 15汉化包.zip55438
- 登录注册界面.zip48872
- 条码字体barcode128
- Rational Rose Common破解文件
- res10_300x300_ssd_iter_140000.caffemodel与dep
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- 04741计算机网络原理知识点整理.docx(
- Wolfram Mathematica 矩阵初等变换函数(
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- 欧姆龙CP1系列单轴定位PLC程序.cxp
- 用Beckhoff(倍福)PLC读写巴鲁夫RFID
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- pfc 使用说明.doc
- Scratch 飞机大战.sb3
- STC8951系列单片机中方指南
评论
共有 条评论