【死磕slam14】slambook2第四讲 详解trajectoryError.cpp

本文详细探讨了《slambook2》中关于trajectoryError.cpp的内容,涉及slam(同时定位与建图)的核心算法,重点讲解了如何计算轨迹误差,并介绍了与C++, OpenCV和计算机视觉算法的关联。" 107477934,8765397,"Java CSV解析:OpenCSV, Apache Commons CSV 和 Super CSV

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

trajectoryError.cpp

#include<iostream>
#include<fstream>
#include<unistd.h>
#include<pangolin/pangolin.h>
#include<sophus/se3.hpp>

using namespace std;
using namespace Sophus;
using namespace Eigen;

string groundtruth_file="/home/zhangyuanbo/Slam14_2/ch4-1/src/groundtruth.txt";// groundtruth_file 存储位置
string estimated_file="/home/zhangyuanbo/Slam14_2/ch4-1/src/estimated.txt";

typedef vector<Sophus::SE3d,Eigen::aligned_allocator<Sophus::SE3d>>  TrajectoryType;//容器中元素是SE3d,内存管理方法是Eigen::aligned_allocator<Sophus::SE3d>
void DrawTrajectory(const TrajectoryType &gt,const TrajectoryType &esti);//提前声明函数1

TrajectoryType  ReadTrajectory(const string &path);//提前声明函数2

int main(int argc, char **argv)
{
   
   
    TrajectoryType groundtruth= ReadTrajectory(groundtruth_file);//读取轨迹文件
    TrajectoryType estimated= ReadTrajectory(estimated_file);//读取

    //assert()为断言函数,如果它的条件返回错误,那么终止程序执行
    assert(!groundtruth.empty()&&!estimated.empty());
    assert(groundtruth.size()==estimated.size());

    //compute rmse
    //计算绝对轨迹误差,即为李代数的均方根误差
    double rmse=0;
    for(size_t i=0;i<estimated.size();i++)//    size_t size() const
    {
   
   
        S
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山风不在岚

你的鼓励是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值