Commit 91c83ae2 authored by wangdawei's avatar wangdawei

test

parent c54c23df
...@@ -23,8 +23,7 @@ AdjustPPK::AdjustPPK(const string &ieBaseDir, const string &mapDir) ...@@ -23,8 +23,7 @@ AdjustPPK::AdjustPPK(const string &ieBaseDir, const string &mapDir)
CalPPKPeriod(); CalPPKPeriod();
std::ofstream ofs(ieBaseDir_ + "/CloudPredictPose.txt", ios::out); std::ofstream ofs(ieBaseDir_ + "/CloudPredictPose.txt", ios::out);
ofs.close(); ofs.close();
// ofs.open(ieBaseDir_ + "/LocalPPK.txt", ios::out);
// ofs.close();
Matrix4d m; Matrix4d m;
/////////////// cpt /////////////// /////////////// cpt ///////////////
m << -0.9999146, 00.0128011, 00.0026317, 00.3097527, m << -0.9999146, 00.0128011, 00.0026317, 00.3097527,
...@@ -70,10 +69,14 @@ void AdjustPPK::ReadBag(const string &bagPath) ...@@ -70,10 +69,14 @@ void AdjustPPK::ReadBag(const string &bagPath)
continue; continue;
} }
PPointCloud cloud; PPointCloud cloud;
if(cloudCnt_ % 10 != 0){
cloudCnt_++;
continue;
}
if(convert_->processScan(m.instantiate<pandar_msgs::PandarScan>(), cloud)){ if(convert_->processScan(m.instantiate<pandar_msgs::PandarScan>(), cloud)){
OnReceivedCloud(cloud); OnReceivedCloud(cloud);
cloudCnt_++;
} }
cloudCnt_++;
} }
} }
...@@ -108,9 +111,6 @@ void AdjustPPK::OnReceivedCloud(const PPointCloud &cloud) ...@@ -108,9 +111,6 @@ void AdjustPPK::OnReceivedCloud(const PPointCloud &cloud)
double backPTime = cloud.back().timestamp; double backPTime = cloud.back().timestamp;
double frontPTime = cloud.front().timestamp; double frontPTime = cloud.front().timestamp;
vector<IsometryData> periodPose = HandleLocalPPK(backPTime, frontPTime); vector<IsometryData> periodPose = HandleLocalPPK(backPTime, frontPTime);
if(cloudCnt_ % 10 != 0){
return;
}
CloudPacket cloudPacket; CloudPacket cloudPacket;
ros::Time rosTime; ros::Time rosTime;
pcl_conversions::fromPCL(cloud.header.stamp, rosTime); pcl_conversions::fromPCL(cloud.header.stamp, rosTime);
...@@ -221,11 +221,11 @@ void AdjustPPK::LoadMapInfo() ...@@ -221,11 +221,11 @@ void AdjustPPK::LoadMapInfo()
void AdjustPPK::CalLocalPose() void AdjustPPK::CalLocalPose()
{ {
localPoseVec_.reserve(rawData_.size()); localPoseVec_.reserve(rawData_.size());
LocalCartesian proj(center_.y(), center_.x(), center_.z()); proj_.Reset(center_.y(), center_.x(), center_.z());
std::ofstream ofs(ieBaseDir_ + "/LocalPPK.txt", ios::out); std::ofstream ofs(ieBaseDir_ + "/LocalPPK.txt", ios::out);
for(const IERawData& rawPPK : rawData_){ for(const IERawData& rawPPK : rawData_){
IsometryData localPose; IsometryData localPose;
proj.Forward(rawPPK.latitude, rawPPK.longitude, rawPPK.height, proj_.Forward(rawPPK.latitude, rawPPK.longitude, rawPPK.height,
localPose.pose.translation().x(), localPose.pose.translation().x(),
localPose.pose.translation().y(), localPose.pose.translation().y(),
localPose.pose.translation().z()); localPose.pose.translation().z());
...@@ -282,6 +282,7 @@ vector<IsometryData> AdjustPPK::HandleLocalPPK( ...@@ -282,6 +282,7 @@ vector<IsometryData> AdjustPPK::HandleLocalPPK(
{ {
static bool isFst = true; static bool isFst = true;
vector<IsometryData> periodPose; vector<IsometryData> periodPose;
std::ofstream ofs(ieBaseDir_ + "/gnss_result.txt", ios::out);
periodPose.reserve(150); periodPose.reserve(150);
for(; ppkIndex_ < localPoseVec_.size(); ppkIndex_++){ for(; ppkIndex_ < localPoseVec_.size(); ppkIndex_++){
const auto &pose = localPoseVec_.at(ppkIndex_); const auto &pose = localPoseVec_.at(ppkIndex_);
...@@ -297,7 +298,19 @@ vector<IsometryData> AdjustPPK::HandleLocalPPK( ...@@ -297,7 +298,19 @@ vector<IsometryData> AdjustPPK::HandleLocalPPK(
}else{ }else{
mapPose_ = mapPose_ * (localPoseVec_.at(ppkIndex_ - 1).pose.inverse() * pose.pose); mapPose_ = mapPose_ * (localPoseVec_.at(ppkIndex_ - 1).pose.inverse() * pose.pose);
} }
periodPose.emplace_back(pose); periodPose.emplace_back(mapPose_);
Vector3d calibedBLH;
proj_.Reverse(mapPose_.translation().x(),
mapPose_.translation().y(),
mapPose_.translation().z(),
calibedBLH.x(), calibedBLH.y(), calibedBLH.z());
Quaterniond q(mapPose_.linear());
Vector3d rpy= RotationQuaternionToEulerVector(q);
auto rawData = rawData_.at(ppkIndex_);
ofs << setprecision(16) << "qx" << ", " << rawData.week << ", " << rawData.seconds
<< ", " << calibedBLH.x() << ", " << calibedBLH.y() << ", " << calibedBLH.z()
<< ", " << rawData.n_velocity << ", " << rawData.e_velocity << ", " << rawData.u_velocity
<< ", " << rpy.x() << ", " << rpy.y() << ", " << rpy.z() << ", " << rawData.status << endl;
} }
return periodPose; return periodPose;
} }
......
...@@ -86,6 +86,8 @@ private: ...@@ -86,6 +86,8 @@ private:
string mapDir_; string mapDir_;
LocalCartesian proj_;
vector<IERawData> rawData_; vector<IERawData> rawData_;
vector<PPKPeriod> ppkPeriodVec_; vector<PPKPeriod> ppkPeriodVec_;
......
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