Commit 09757399 authored by limingbo's avatar limingbo

reconfig code

parent 7e5f2995
......@@ -50,37 +50,6 @@ int main(int argc, char *argv[])
boost::filesystem::create_directory(FLAGS_log_dir);
}
string offlineResultDir = FLAGS_base_dir + "/result";
string pcdResultDir = offlineResultDir + "/pcd";
string basePcdResultDir = offlineResultDir + "/basePcd";
string guessPcdResultDir = offlineResultDir + "/guessPcd";
string rawFrameResultDir = offlineResultDir + "/raw_frame";
if(!boost::filesystem::exists(offlineResultDir)){
boost::filesystem::create_directory(offlineResultDir);
}
int unused;
unused = system(string("rm " + offlineResultDir + "/*").c_str());
if(!boost::filesystem::exists(pcdResultDir)){
boost::filesystem::create_directory(pcdResultDir);
}else{
unused = system(string("rm " + pcdResultDir + "/*").c_str());
}
if(!boost::filesystem::exists(basePcdResultDir)){
boost::filesystem::create_directory(basePcdResultDir);
}else{
unused = system(string("rm " + basePcdResultDir + "/*").c_str());
}
if(!boost::filesystem::exists(guessPcdResultDir)){
boost::filesystem::create_directory(guessPcdResultDir);
}else{
unused = system(string("rm " + guessPcdResultDir + "/*").c_str());
}
if(!boost::filesystem::exists(rawFrameResultDir)){
boost::filesystem::create_directory(rawFrameResultDir);
}else{
unused = system(string("rm " + rawFrameResultDir + "/*").c_str());
}
Parameter::Instance()->init(FLAGS_base_dir);
SysController::Ptr sysController(new SysController());
......
......@@ -19,33 +19,8 @@ Parameter::Ptr Parameter::Instance()
void Parameter::init(const string &baseDir)
{
baseDir_ = baseDir;
mapPath_ = baseDir_ + "/stream/";
Matrix4d m;
m << -0.043905, -0.999033, 00.002312, 00.54,
00.994052, -0.043455, 00.099861, 00.28,
-0.099664, 00.006683, 00.994999, 00.06,
00.0000000, 00.0000000, 00.0000000, 01.0000000;
calib_.translation() = m.block(0, 3, 3, 1);
calib_.linear() = m.block(0, 0, 3, 3);
Quaterniond calibQ(calib_.linear());
auto calibRpy = RotationQuaternionToEulerVector(calibQ);
LOG(INFO) << "calibRpy: " << calibRpy.transpose();
std::ifstream ifs(baseDir_ + "/stream.offset");
if(ifs) {
string line;
getline(ifs, line);
{
std::istringstream iss(line);
string subline;
getline(iss, subline, ',');
std::istringstream(subline) >> offset_.x();
getline(iss, subline, ',');
std::istringstream(subline) >> offset_.y();
}
ifs.close();
}
ifs.open(baseDir_ + "/imu2base.calib");
std::ifstream ifs(baseDir_ + "/imu2base.calib");
if(ifs) {
string line;
float r, p, y;
......@@ -62,42 +37,12 @@ void Parameter::init(const string &baseDir)
}
ifs.close();
// fprintf(stderr, "imu2base_ %f, %f, %f\n", r, p, y);
imu2base_.linear() =
Matrix3f(AngleAxisf(y, Vector3f::UnitZ())
* AngleAxisf(p, Vector3f::UnitY())
* AngleAxisf(r, Vector3f::UnitX())).cast<double>();
}
localToSlamstart_.x() = slamStart_.x() - offset_.x();
localToSlamstart_.y() = slamStart_.y() - offset_.y();
ifs.open(baseDir_ + "/init_pose.txt");
if(ifs) {
string line;
Vector3d rpy;
getline(ifs, line);
{
std::istringstream iss(line);
string subline;
getline(iss, subline, ',');
std::istringstream(subline) >> initPose_.translation().x();
getline(iss, subline, ',');
std::istringstream(subline) >> initPose_.translation().y();
getline(iss, subline, ',');
std::istringstream(subline) >> initPose_.translation().z();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.x();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.y();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.z();
}
ifs.close();
initPose_.linear() =
Matrix3d(AngleAxisd(rpy.z(), Vector3d::UnitZ())
* AngleAxisd(rpy.y(), Vector3d::UnitY())
* AngleAxisd(rpy.x(), Vector3d::UnitX()));
}
ifs.open(baseDir_ + "/imu2base_lever_arm.txt");
if(ifs) {
string line;
......@@ -115,34 +60,6 @@ void Parameter::init(const string &baseDir)
ifs.close();
LOG(INFO) << "arm_: " << arm_.transpose();
}
ifs.open(baseDir_ + "/eskf_init_pose.txt");
if(ifs) {
string line;
Vector3d rpy;
getline(ifs, line);
{
std::istringstream iss(line);
string subline;
getline(iss, subline, ',');
std::istringstream(subline) >> eskf_init_pose_.translation().x();
getline(iss, subline, ',');
std::istringstream(subline) >> eskf_init_pose_.translation().y();
getline(iss, subline, ',');
std::istringstream(subline) >> eskf_init_pose_.translation().z();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.x();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.y();
getline(iss, subline, ',');
std::istringstream(subline) >> rpy.z();
}
LOG(INFO) << "eskf_init_rot_ rot: " << rpy.transpose();
ifs.close();
eskf_init_pose_.linear() =
Matrix3f(AngleAxisf(rpy.z(), Vector3f::UnitZ())
* AngleAxisf(rpy.y(), Vector3f::UnitY())
* AngleAxisf(rpy.x(), Vector3f::UnitX()));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment