local_slam_result_2d.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2018 The Cartographer Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 
20 namespace cartographer {
21 namespace mapping {
22 
24  TrajectoryBuilderInterface* const trajectory_builder) {
25  trajectory_builder->AddLocalSlamResultData(
26  common::make_unique<LocalSlamResult2D>(*this));
27 }
28 
29 void LocalSlamResult2D::AddToPoseGraph(int trajectory_id,
30  PoseGraph* pose_graph) const {
31  DCHECK(dynamic_cast<PoseGraph2D*>(pose_graph));
32  CHECK_GE(local_slam_result_data_.submaps().size(), 1);
33  CHECK(local_slam_result_data_.submaps(0).has_submap_2d());
34  std::vector<std::shared_ptr<const mapping::Submap2D>> submaps;
35  for (const auto& submap_proto : local_slam_result_data_.submaps()) {
36  submaps.push_back(submap_controller_->UpdateSubmap(submap_proto));
37  }
38  static_cast<PoseGraph2D*>(pose_graph)
39  ->AddNode(std::make_shared<const mapping::TrajectoryNode::Data>(
41  trajectory_id, submaps);
42 }
43 
44 } // namespace mapping
45 } // namespace cartographer
PoseGraph::Constraint::Tag FromProto(const proto::PoseGraph::Constraint::Tag &proto)
Definition: pose_graph.cc:38
SubmapController< mapping::Submap2D > * submap_controller_
const mapping::proto::LocalSlamResultData local_slam_result_data_
void AddToTrajectoryBuilder(TrajectoryBuilderInterface *const trajectory_builder) override
virtual void AddLocalSlamResultData(std::unique_ptr< mapping::LocalSlamResultData > local_slam_result_data)=0
void AddToPoseGraph(int trajectory_id, PoseGraph *pose_graph) const override


cartographer
Author(s): The Cartographer Authors
autogenerated on Mon Feb 28 2022 22:00:58