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 >,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