直接给出例程序吧
#include<fstream>
#include<iomanip> //为使用setw();
// ROS_INFO("after the IMU Pre-integration out put the PVQ and bisas: Ps, Vs, Rs, Bas, Bgs");
std::ofstream out("/home/kwanwaipang/catkin_ws_dvs/src/EVIO/imu_pre_integration.txt",std::ios::app);
for(int i=0; i<=WINDOW_SIZE;i++){
out<<"the frame:"<<i<<curTime<<setw(3)<<"x"<<setw(3)<<"y"<<setw(3)<<"z"<<std::endl;
out<<"PsI"<<setw(16)<<Ps[i](0)<<setw(16)<<Ps[i](1)<<setw(16)<<Ps[i](2)<<std::endl;
out<<"VsI"<<setw(16)<<Vs[i](0)<<setw(16)<<Vs[i](1)<<setw(16)<<Vs[i](1)<<std::endl;
out<<"RsI"<<setw(16)<<Rs[i](0)<<setw(16)<<Rs[i](1)<<setw(16)<<Rs[i](1)<<std::endl;
out<<"Bas"<<setw(16)<<Bas[i](0)<<setw(16)<<Bas[i](1)<<setw(16)<<Bas[i](1)<<std::endl;
out<<"Bgs"<<setw(16)<<Bgs[i](0)<<setw(16)<<Bgs[i](1)<<setw(16)<<Bgs[i](1)<<std::endl;
}
out.close();