PoseGraph2D:AddNode 调用之处:global_trajectory_builder.cc 的AddSensorData函数中.
显示进行扫描匹配,匹配成功后把匹配后的结果加入到结点中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 void AddSensorData ( const std::string& sensor_id, const sensor::TimedPointCloudData& timed_point_cloud_data) override { CHECK (local_trajectory_builder_) << "Cannot add TimedPointCloudData without a LocalTrajectoryBuilder." ; std::unique_ptr<typename LocalTrajectoryBuilder::MatchingResult> matching_result = local_trajectory_builder_->AddRangeData ( sensor_id, timed_point_cloud_data); if (matching_result == nullptr ) { return ; } kLocalSlamMatchingResults->Increment (); std::unique_ptr<InsertionResult> insertion_result; if (matching_result->insertion_result != nullptr ) { kLocalSlamInsertionResults->Increment (); auto node_id = pose_graph_->AddNode ( matching_result->insertion_result->constant_data, trajectory_id_, matching_result->insertion_result->insertion_submaps); CHECK_EQ (node_id.trajectory_id, trajectory_id_); insertion_result = absl::make_unique<InsertionResult>(InsertionResult{ node_id, matching_result->insertion_result->constant_data, std::vector<std::shared_ptr<const Submap>>( matching_result->insertion_result->insertion_submaps.begin (), matching_result->insertion_result->insertion_submaps.end ())}); }
总体调用流程