trajectory_builder_interface.cc
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 
18 
22 
23 namespace cartographer {
24 namespace mapping {
25 namespace {
26 
27 void PopulateOverlappingSubmapsTrimmerOptions2D(
28  proto::TrajectoryBuilderOptions* const trajectory_builder_options,
29  common::LuaParameterDictionary* const parameter_dictionary) {
30  constexpr char kDictionaryKey[] = "overlapping_submaps_trimmer_2d";
31  if (!parameter_dictionary->HasKey(kDictionaryKey)) return;
32 
33  auto options_dictionary = parameter_dictionary->GetDictionary(kDictionaryKey);
34  auto* options =
35  trajectory_builder_options->mutable_overlapping_submaps_trimmer_2d();
36  options->set_fresh_submaps_count(
37  options_dictionary->GetInt("fresh_submaps_count"));
38  options->set_min_covered_area(
39  options_dictionary->GetDouble("min_covered_area"));
40  options->set_min_added_submaps_count(
41  options_dictionary->GetInt("min_added_submaps_count"));
42 }
43 
44 } // namespace
45 
46 proto::TrajectoryBuilderOptions CreateTrajectoryBuilderOptions(
47  common::LuaParameterDictionary* const parameter_dictionary) {
48  proto::TrajectoryBuilderOptions options;
49  *options.mutable_trajectory_builder_2d_options() =
51  parameter_dictionary->GetDictionary("trajectory_builder_2d").get());
52  *options.mutable_trajectory_builder_3d_options() =
54  parameter_dictionary->GetDictionary("trajectory_builder_3d").get());
55  options.set_pure_localization(
56  parameter_dictionary->GetBool("pure_localization"));
57  PopulateOverlappingSubmapsTrimmerOptions2D(&options, parameter_dictionary);
58  return options;
59 }
60 
62  proto::SensorId sensor_id_proto;
63  switch (sensor_id.type) {
65  sensor_id_proto.set_type(proto::SensorId::RANGE);
66  break;
68  sensor_id_proto.set_type(proto::SensorId::IMU);
69  break;
71  sensor_id_proto.set_type(proto::SensorId::ODOMETRY);
72  break;
74  sensor_id_proto.set_type(proto::SensorId::FIXED_FRAME_POSE);
75  break;
77  sensor_id_proto.set_type(proto::SensorId::LANDMARK);
78  break;
80  sensor_id_proto.set_type(proto::SensorId::LOCAL_SLAM_RESULT);
81  break;
82  default:
83  LOG(FATAL) << "Unsupported sensor type.";
84  }
85  sensor_id_proto.set_id(sensor_id.id);
86  return sensor_id_proto;
87 }
88 
90  const proto::SensorId& sensor_id_proto) {
92  switch (sensor_id_proto.type()) {
93  case proto::SensorId::RANGE:
95  break;
96  case proto::SensorId::IMU:
98  break;
99  case proto::SensorId::ODOMETRY:
100  sensor_id.type =
102  break;
103  case proto::SensorId::FIXED_FRAME_POSE:
104  sensor_id.type =
106  break;
107  case proto::SensorId::LANDMARK:
108  sensor_id.type =
110  break;
111  case proto::SensorId::LOCAL_SLAM_RESULT:
112  sensor_id.type =
114  break;
115  default:
116  LOG(FATAL) << "Unsupported sensor type.";
117  }
118  sensor_id.id = sensor_id_proto.id();
119  return sensor_id;
120 }
121 
122 } // namespace mapping
123 } // namespace cartographer
PoseGraph::Constraint::Tag FromProto(const proto::PoseGraph::Constraint::Tag &proto)
Definition: pose_graph.cc:38
proto::LocalTrajectoryBuilderOptions2D CreateLocalTrajectoryBuilderOptions2D(common::LuaParameterDictionary *const parameter_dictionary)
proto::TrajectoryBuilderOptions CreateTrajectoryBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
std::unique_ptr< LuaParameterDictionary > GetDictionary(const std::string &key)
proto::MapLimits ToProto(const MapLimits &map_limits)
Definition: map_limits.h:92
::cartographer::mapping::TrajectoryBuilderInterface::SensorId SensorId
proto::LocalTrajectoryBuilderOptions3D CreateLocalTrajectoryBuilderOptions3D(common::LuaParameterDictionary *parameter_dictionary)


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