3d/submaps.h
Go to the documentation of this file.
1 /*
2  * Copyright 2016 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 
17 #ifndef CARTOGRAPHER_MAPPING_3D_SUBMAPS_H_
18 #define CARTOGRAPHER_MAPPING_3D_SUBMAPS_H_
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "Eigen/Geometry"
27 #include "cartographer/mapping/proto/submap_visualization.pb.h"
32 #include "cartographer/mapping_3d/proto/submaps_options.pb.h"
37 
38 namespace cartographer {
39 namespace mapping_3d {
40 
42  const sensor::RangeData& range_data, const transform::Rigid3f& pose,
43  const float slice_z,
44  const mapping_2d::RangeDataInserter& range_data_inserter,
45  mapping_2d::ProbabilityGrid* result);
46 
47 proto::SubmapsOptions CreateSubmapsOptions(
48  common::LuaParameterDictionary* parameter_dictionary);
49 
50 class Submap : public mapping::Submap {
51  public:
52  Submap(float high_resolution, float low_resolution,
54 
57  }
60  }
61  const bool finished() const { return finished_; }
62 
63  void ToResponseProto(
64  const transform::Rigid3d& global_submap_pose,
65  mapping::proto::SubmapQuery::Response* response) const override;
66 
67  private:
68  // TODO(hrapp): Remove friend declaration.
69  friend class Submaps;
70 
73  bool finished_ = false;
74 };
75 
76 // A container of Submaps.
77 class Submaps : public mapping::Submaps {
78  public:
79  explicit Submaps(const proto::SubmapsOptions& options);
80 
81  Submaps(const Submaps&) = delete;
82  Submaps& operator=(const Submaps&) = delete;
83 
84  const Submap* Get(int index) const override;
85  int size() const override;
86 
87  // Inserts 'range_data' into the Submap collection. 'gravity_alignment' is
88  // used for the orientation of new submaps so that the z axis approximately
89  // aligns with gravity.
90  void InsertRangeData(const sensor::RangeData& range_data,
91  const Eigen::Quaterniond& gravity_alignment);
92 
93  private:
94  void AddSubmap(const transform::Rigid3d& local_pose);
95 
96  const proto::SubmapsOptions options_;
97 
98  // 'submaps_' contains pointers, so that resizing the vector does not
99  // invalidate handed out Submap* pointers.
100  std::vector<std::unique_ptr<Submap>> submaps_;
102 };
103 
104 } // namespace mapping_3d
105 } // namespace cartographer
106 
107 #endif // CARTOGRAPHER_MAPPING_3D_SUBMAPS_H_
void ToResponseProto(const transform::Rigid3d &global_submap_pose, mapping::proto::SubmapQuery::Response *response) const override
Definition: 3d/submaps.cc:329
const HybridGrid & high_resolution_hybrid_grid() const
Definition: 3d/submaps.h:55
RangeDataInserter range_data_inserter_
Definition: 3d/submaps.h:101
transform::Rigid3d local_pose() const
Definition: submaps.h:65
Submap(float high_resolution, float low_resolution, const transform::Rigid3d &local_pose)
Definition: 3d/submaps.cc:323
transform::Rigid3d pose
std::vector< std::unique_ptr< Submap > > submaps_
Definition: 3d/submaps.h:100
proto::SubmapsOptions CreateSubmapsOptions(common::LuaParameterDictionary *parameter_dictionary)
Definition: 3d/submaps.cc:306
const HybridGrid & low_resolution_hybrid_grid() const
Definition: 3d/submaps.h:58
const proto::SubmapsOptions options_
Definition: 3d/submaps.h:96
void InsertIntoProbabilityGrid(const sensor::RangeData &range_data, const transform::Rigid3f &pose, const float slice_z, const mapping_2d::RangeDataInserter &range_data_inserter, mapping_2d::ProbabilityGrid *result)
Definition: 3d/submaps.cc:292
const bool finished() const
Definition: 3d/submaps.h:61


cartographer
Author(s):
autogenerated on Wed Jun 5 2019 21:57:59