optimization_problem_3d.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_3D_H_
18 #define CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_OPTIMIZATION_PROBLEM_3D_H_
19 
20 #include <array>
21 #include <map>
22 #include <set>
23 #include <vector>
24 
25 #include "Eigen/Core"
26 #include "Eigen/Geometry"
33 #include "cartographer/mapping/proto/pose_graph/optimization_problem_options.pb.h"
39 
40 namespace cartographer {
41 namespace mapping {
42 namespace optimization {
43 
44 struct NodeSpec3D {
48 };
49 
50 struct SubmapSpec3D {
52 };
53 
55  : public OptimizationProblemInterface<NodeSpec3D, SubmapSpec3D,
56  transform::Rigid3d> {
57  public:
58  explicit OptimizationProblem3D(
59  const optimization::proto::OptimizationProblemOptions& options);
61 
63  OptimizationProblem3D& operator=(const OptimizationProblem3D&) = 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 NodeSpec3D& node_data) override;
70  void InsertTrajectoryNode(const NodeId& node_id,
71  const NodeSpec3D& node_data) override;
72  void TrimTrajectoryNode(const NodeId& node_id) override;
73  void AddSubmap(int trajectory_id,
74  const transform::Rigid3d& global_submap_pose) override;
75  void InsertSubmap(const SubmapId& submap_id,
76  const transform::Rigid3d& 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, NodeSpec3D>& node_data() const override {
86  return node_data_;
87  }
88  const MapById<SubmapId, SubmapSpec3D>& 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  void AddFixedFramePoseData(
104  int trajectory_id,
105  const sensor::FixedFramePoseData& fixed_frame_pose_data);
106  void SetTrajectoryData(
107  int trajectory_id,
108  const PoseGraphInterface::TrajectoryData& trajectory_data);
110  const {
111  return fixed_frame_pose_data_;
112  }
113  const std::map<int, PoseGraphInterface::TrajectoryData>& trajectory_data()
114  const {
115  return trajectory_data_;
116  }
117 
118  private:
119  // Computes the relative pose between two nodes based on odometry data.
120  std::unique_ptr<transform::Rigid3d> CalculateOdometryBetweenNodes(
121  int trajectory_id, const NodeSpec3D& first_node_data,
122  const NodeSpec3D& second_node_data) const;
123 
124  optimization::proto::OptimizationProblemOptions options_;
127  std::map<std::string, transform::Rigid3d> landmark_data_;
131  std::map<int, PoseGraphInterface::TrajectoryData> trajectory_data_;
132 };
133 
134 } // namespace optimization
135 } // namespace mapping
136 } // namespace cartographer
137 
138 #endif // CARTOGRAPHER_MAPPING_INTERNAL_OPTIMIZATION_OPTIMIZATION_PROBLEM_3D_H_
const sensor::MapByTime< sensor::OdometryData > & odometry_data() const override
const sensor::MapByTime< sensor::ImuData > & imu_data() const override
std::map< std::string, transform::Rigid3d > landmark_data_
const MapById< SubmapId, SubmapSpec3D > & submap_data() const override
UniversalTimeScaleClock::time_point Time
Definition: time.h:44
const std::map< int, PoseGraphInterface::TrajectoryData > & trajectory_data() const
sensor::MapByTime< sensor::FixedFramePoseData > fixed_frame_pose_data_
std::map< int, PoseGraphInterface::TrajectoryData > trajectory_data_
const sensor::MapByTime< sensor::FixedFramePoseData > & fixed_frame_pose_data() const
const MapById< NodeId, NodeSpec3D > & node_data() const override
int32_t int32
Definition: port.h:32
const std::map< std::string, transform::Rigid3d > & landmark_data() const override
optimization::proto::OptimizationProblemOptions options_


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