|
|
@@ -1,5 +1,5 @@
|
|
|
#include "Estimator.h"
|
|
|
-
|
|
|
+#include "utils/TimerRecord.h"
|
|
|
|
|
|
Estimator::Estimator(const float& filter_corner, const float& filter_surf,
|
|
|
int ivox_nearby_type,int max_ivox_node,float resolution){
|
|
|
@@ -85,7 +85,8 @@ void Estimator::processPointToLine(std::vector<ceres::CostFunction *>& edges,
|
|
|
int debug_num2 = 0;
|
|
|
int debug_num12 = 0;
|
|
|
int debug_num22 = 0;
|
|
|
- for (int i = 0; i < laserCloudCornerStackNum; i++) {
|
|
|
+ for (int i = 0; i < laserCloudCornerStackNum; i++)
|
|
|
+ {
|
|
|
_pointOri = laserCloudCorner->points[i];
|
|
|
LocalMapIvox::pointAssociateToMap(&_pointOri, &_pointSel, m4d);
|
|
|
|
|
|
@@ -875,32 +876,35 @@ void Estimator::Estimate(std::list<LidarFrame>& lidarFrameList,
|
|
|
transformTobeMapped.topRightCorner(3, 1) = frame_curr->Q * exPbl + frame_curr->P;
|
|
|
|
|
|
|
|
|
- threads[0] = std::thread(&Estimator::processPointToLine, this,
|
|
|
- std::ref(edgesLine[f]),
|
|
|
- std::ref(vLineFeatures[f]),
|
|
|
- std::ref(laserCloudCornerStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
+ TimerRecord::Execute(
|
|
|
+ [&,this]() {
|
|
|
+ threads[0] = std::thread(&Estimator::processPointToLine, this,
|
|
|
+ std::ref(edgesLine[f]),
|
|
|
+ std::ref(vLineFeatures[f]),
|
|
|
+ std::ref(laserCloudCornerStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
|
|
|
|
|
|
- threads[1] = std::thread(&Estimator::processPointToPlanVec, this,
|
|
|
- std::ref(edgesPlan[f]),
|
|
|
- std::ref(vPlanFeatures[f]),
|
|
|
- std::ref(laserCloudSurfStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
+ threads[1] = std::thread(&Estimator::processPointToPlanVec, this,
|
|
|
+ std::ref(edgesPlan[f]),
|
|
|
+ std::ref(vPlanFeatures[f]),
|
|
|
+ std::ref(laserCloudSurfStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
|
|
|
|
|
|
- threads[2] = std::thread(&Estimator::processNonFeatureICP, this,
|
|
|
- std::ref(edgesNon[f]),
|
|
|
- std::ref(vNonFeatures[f]),
|
|
|
- std::ref(laserCloudNonFeatureStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
+ threads[2] = std::thread(&Estimator::processNonFeatureICP, this,
|
|
|
+ std::ref(edgesNon[f]),
|
|
|
+ std::ref(vNonFeatures[f]),
|
|
|
+ std::ref(laserCloudNonFeatureStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
|
|
|
- threads[0].join();
|
|
|
- threads[1].join();
|
|
|
- threads[2].join();
|
|
|
+ threads[0].join();
|
|
|
+ threads[1].join();
|
|
|
+ threads[2].join();
|
|
|
+ },"Estimator::FMatch");
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1069,8 +1073,12 @@ void Estimator::Estimate(std::list<LidarFrame>& lidarFrameList,
|
|
|
options.minimizer_progress_to_stdout = false;
|
|
|
options.num_threads = 6;
|
|
|
ceres::Solver::Summary summary;
|
|
|
-
|
|
|
- ceres::Solve(options, &problem, &summary);
|
|
|
+ TimerRecord::Execute(
|
|
|
+ [&,this]()
|
|
|
+ {
|
|
|
+ ceres::Solve(options, &problem, &summary);
|
|
|
+ },"Estimator::solve"
|
|
|
+ );
|
|
|
final_cost_ = summary.final_cost;
|
|
|
|
|
|
//将优化的结果赋值到lidarFrameList的每一帧数据
|
|
|
@@ -1125,31 +1133,34 @@ void Estimator::Estimate(std::list<LidarFrame>& lidarFrameList,
|
|
|
edgesPlan[f].clear();
|
|
|
edgesNon[f].clear();
|
|
|
|
|
|
-
|
|
|
- threads[0] = std::thread(&Estimator::processPointToLine, this,
|
|
|
- std::ref(edgesLine[f]),
|
|
|
- std::ref(vLineFeatures[f]),
|
|
|
- std::ref(laserCloudCornerStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
-
|
|
|
- threads[1] = std::thread(&Estimator::processPointToPlanVec, this,
|
|
|
- std::ref(edgesPlan[f]),
|
|
|
- std::ref(vPlanFeatures[f]),
|
|
|
- std::ref(laserCloudSurfStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
-
|
|
|
- threads[2] = std::thread(&Estimator::processNonFeatureICP, this,
|
|
|
- std::ref(edgesNon[f]),
|
|
|
- std::ref(vNonFeatures[f]),
|
|
|
- std::ref(laserCloudNonFeatureStack[f]),
|
|
|
- std::ref(exTlb),
|
|
|
- std::ref(transformTobeMapped));
|
|
|
-
|
|
|
- threads[0].join();
|
|
|
- threads[1].join();
|
|
|
- threads[2].join();
|
|
|
+ TimerRecord::Execute(
|
|
|
+ [&,this]() {
|
|
|
+
|
|
|
+ threads[0] = std::thread(&Estimator::processPointToLine, this,
|
|
|
+ std::ref(edgesLine[f]),
|
|
|
+ std::ref(vLineFeatures[f]),
|
|
|
+ std::ref(laserCloudCornerStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
+
|
|
|
+ threads[1] = std::thread(&Estimator::processPointToPlanVec, this,
|
|
|
+ std::ref(edgesPlan[f]),
|
|
|
+ std::ref(vPlanFeatures[f]),
|
|
|
+ std::ref(laserCloudSurfStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
+
|
|
|
+ threads[2] = std::thread(&Estimator::processNonFeatureICP, this,
|
|
|
+ std::ref(edgesNon[f]),
|
|
|
+ std::ref(vNonFeatures[f]),
|
|
|
+ std::ref(laserCloudNonFeatureStack[f]),
|
|
|
+ std::ref(exTlb),
|
|
|
+ std::ref(transformTobeMapped));
|
|
|
+
|
|
|
+ threads[0].join();
|
|
|
+ threads[1].join();
|
|
|
+ threads[2].join();
|
|
|
+ },"Estimator::FMatch");
|
|
|
int cntFtu = 0;
|
|
|
for (auto &e : edgesLine[f])
|
|
|
{
|