optimization_problem_2d.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_INTERNAL_OPTIMIZATION_OPTIMIZATION_PROBLEM_2D_H_
18 #define CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_OPTIMIZATION_PROBLEM_2D_H_
19 
20 #include <array>
21 #include <deque>
22 #include <map>
23 #include <set>
24 #include <vector>
25 
26 #include "Eigen/Core"
27 #include "Eigen/Geometry"
33 #include "cartographer/mapping/proto/pose_graph/optimization_problem_options.pb.h"
38 
39 namespace cartographer {
40 namespace mapping {
41 namespace optimization {
42 
43 struct NodeSpec2D {
47  Eigen::Quaterniond gravity_alignment;
48 };
49 
50 struct SubmapSpec2D {
52 };
53 
55  : public OptimizationProblemInterface<NodeSpec2D, SubmapSpec2D,
56  transform::Rigid2d> {
57  public:
58  explicit OptimizationProblem2D(
59  const optimization::proto::OptimizationProblemOptions& options);
61 
63  OptimizationProblem2D& operator=(const OptimizationProblem2D&) = delete;
64 
65  void AddImuData(int trajectory_id, const sensor::ImuData& imu_data) override;
66  void AddOdometryData(int trajectory_id,
67  const sensor::OdometryData& odometry_data) override;
68  void AddTrajectoryNode(int trajectory_id,
69  const NodeSpec2D& node_data) override;
70  void InsertTrajectoryNode(const NodeId& node_id,
71  const NodeSpec2D& node_data) override;
72  void TrimTrajectoryNode(const NodeId& node_id) override;
73  void AddSubmap(int trajectory_id,
74  const transform::Rigid2d& global_submap_pose) override;
75  void InsertSubmap(const SubmapId& submap_id,
76  const transform::Rigid2d& global_submap_pose) override;
77  void TrimSubmap(const SubmapId& submap_id) override;
78  void SetMaxNumIterations(int32 max_num_iterations) override;
79 
80  void Solve(
81  const std::vector<Constraint>& constraints,
82  const std::set<int>& frozen_trajectories,
83  const std::map<std::string, LandmarkNode>& landmark_nodes) override;
84 
85  const MapById<NodeId, NodeSpec2D>& node_data() const override {
86  return node_data_;
87  }
88  const MapById<SubmapId, SubmapSpec2D>& submap_data() const override {
89  return submap_data_;
90  }
91  const std::map<std::string, transform::Rigid3d>& landmark_data()
92  const override {
93  return landmark_data_;
94  }
95  const sensor::MapByTime<sensor::ImuData>& imu_data() const override {
96  return imu_data_;
97  }
99  const override {
100  return odometry_data_;
101  }
102 
103  private:
104  std::unique_ptr<transform::Rigid3d> InterpolateOdometry(
105  int trajectory_id, common::Time time) const;
106  // Computes the relative pose between two nodes based on odometry data.
107  std::unique_ptr<transform::Rigid3d> CalculateOdometryBetweenNodes(
108  int trajectory_id, const NodeSpec2D& first_node_data,
109  const NodeSpec2D& second_node_data) const;
110 
111  optimization::proto::OptimizationProblemOptions options_;
114  std::map<std::string, transform::Rigid3d> landmark_data_;
117 };
118 
119 } // namespace optimization
120 } // namespace mapping
121 } // namespace cartographer
122 
123 #endif // CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_OPTIMIZATION_PROBLEM_2D_H_
std::map< std::string, transform::Rigid3d > landmark_data_
const MapById< SubmapId, SubmapSpec2D > & submap_data() const override
const MapById< NodeId, NodeSpec2D > & node_data() const override
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
const sensor::MapByTime< sensor::OdometryData > & odometry_data() const override
const std::map< std::string, transform::Rigid3d > & landmark_data() const override
optimization::proto::OptimizationProblemOptions options_
int32_t int32
Definition: port.h:32
const sensor::MapByTime< sensor::ImuData > & imu_data() const override


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