Commit f47c2d44 authored by wangdawei's avatar wangdawei

test

parent 41d1cc40
...@@ -388,16 +388,17 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo) ...@@ -388,16 +388,17 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
return false; return false;
} }
static std::ofstream ofs(ieBaseDir_ + "/CloudPredictPose.txt", ios::app); static std::ofstream ofs(ieBaseDir_ + "/CloudPredictPose.txt", ios::app);
auto guess = cloudInfo.filterPoseInfo.filterPose;
Quaterniond q(mapPose_.linear()); Quaterniond q(guess.linear());
Vector3d rpy= RotationQuaternionToEulerVector(q); Vector3d rpy= RotationQuaternionToEulerVector(q);
LOG(INFO) << setprecision(15) << "cloud time: " << cloudInfo.timestamp LOG(INFO) << setprecision(15) << "cloud time: " << cloudInfo.timestamp
<< " guessPose: " << mapPose_.translation().transpose() << " guessPose: " << guess.translation().transpose()
<< " rpy: " << rpy.transpose(); << " rpy: " << rpy.transpose();
// pcl::io::savePCDFileBinary(ieBaseDir_ + "/baseCloud/" + to_string(cloudInfo.timestamp) + ".pcd", *cloudInfo.frame); // pcl::io::savePCDFileBinary(ieBaseDir_ + "/baseCloud/" + to_string(cloudInfo.timestamp) + ".pcd", *cloudInfo.frame);
GnssPoint finalGnssPose; GnssPoint finalGnssPose;
GuessPose guessPose; GuessPose guessPose;
guessPose.map_point = mapPose_; guessPose.map_point = guess;
// auto increaseRpy = RotationQuaternionToEulerVector( // auto increaseRpy = RotationQuaternionToEulerVector(
// Quaterniond(cloudInfo.filterPoseInfo.increasePose.linear())); // Quaterniond(cloudInfo.filterPoseInfo.increasePose.linear()));
// guessPose.movement = cloudInfo.filterPoseInfo.increasePose.translation().norm(); // guessPose.movement = cloudInfo.filterPoseInfo.increasePose.translation().norm();
...@@ -405,30 +406,30 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo) ...@@ -405,30 +406,30 @@ bool AdjustPPK::LocateCloud(const CloudInfoForMatch &cloudInfo)
guessPose.movement = 0.6; guessPose.movement = 0.6;
guessPose.rotation = 0.003; guessPose.rotation = 0.003;
guessPose.use_gnss = false; guessPose.use_gnss = false;
if(!currMatcher_->IsMapLoaded(mapPose_.translation())){ if(!currMatcher_->IsMapLoaded(guess.translation())){
currMatcher_->loadArea(mapPose_.translation()); currMatcher_->loadArea(guess.translation());
} }
double avgGridCnt = currMatcher_->AreaAvgGridCnt(mapPose_.translation()); double avgGridCnt = currMatcher_->AreaAvgGridCnt(guess.translation());
LOG(INFO) << "avgGridCnt: " << avgGridCnt; LOG(INFO) << "avgGridCnt: " << avgGridCnt;
if(avgGridCnt < 20000){ if(avgGridCnt < 20000){
return false; return false;
} }
ofs << setprecision(16) << cloudInfo.timestamp << ", " << mapPose_.translation().x() ofs << setprecision(16) << cloudInfo.timestamp << ", " << guess.translation().x()
<< ", " << mapPose_.translation().y() << ", " << mapPose_.translation().z() << endl; << ", " << guess.translation().y() << ", " << guess.translation().z() << endl;
guessPose.precision_type = MATCH_PRECISION_FAST; guessPose.precision_type = MATCH_PRECISION_FAST;
Isometry3f finalPose; Isometry3f finalPose;
float score = currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose); float score = currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose);
if(score < 0){ if(score < 0){
guessPose.precision_type = MATCH_PRECISION_INIT; guessPose.precision_type = MATCH_PRECISION_INIT;
currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose); currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose);
mapPose_ = finalPose.cast<double>(); mapPose_ = mapPose_ * (guess.inverse() * finalPose.cast<double>());
return true; return true;
} }
guessPose.map_point = finalPose.cast<double>(); guessPose.map_point = finalPose.cast<double>();
guessPose.precision_type = MATCH_PRECISION_HIGH; guessPose.precision_type = MATCH_PRECISION_HIGH;
currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose); currMatcher_->MatchPointCloud(cloudInfo.frame, guessPose, finalGnssPose, finalPose);
mapPose_ = finalPose.cast<double>(); mapPose_ = mapPose_ * (guess.inverse() * finalPose.cast<double>());
return true; return true;
} }
......
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