22 #include <unordered_map> 33 #include "glog/logging.h" 40 proto::MapBuilderOptions options;
41 options.set_use_trajectory_builder_2d(
42 parameter_dictionary->
GetBool(
"use_trajectory_builder_2d"));
43 options.set_use_trajectory_builder_3d(
44 parameter_dictionary->
GetBool(
"use_trajectory_builder_3d"));
45 options.set_num_background_threads(
48 parameter_dictionary->
GetDictionary(
"sparse_pose_graph").get());
49 CHECK_NE(options.use_trajectory_builder_2d(),
50 options.use_trajectory_builder_3d());
56 if (options.use_trajectory_builder_2d()) {
61 if (options.use_trajectory_builder_3d()) {
71 const std::unordered_set<string>& expected_sensor_ids,
72 const proto::TrajectoryBuilderOptions& trajectory_options) {
74 if (
options_.use_trajectory_builder_3d()) {
75 CHECK(trajectory_options.has_trajectory_builder_3d_options());
77 common::make_unique<CollatedTrajectoryBuilder>(
79 common::make_unique<mapping_3d::GlobalTrajectoryBuilder>(
80 trajectory_options.trajectory_builder_3d_options(),
83 CHECK(trajectory_options.has_trajectory_builder_2d_options());
85 common::make_unique<CollatedTrajectoryBuilder>(
87 common::make_unique<mapping_2d::GlobalTrajectoryBuilder>(
88 trajectory_options.trajectory_builder_2d_options(),
95 const int trajectory_id)
const {
108 const int submap_index,
109 proto::SubmapQuery::Response*
const response) {
111 return "Requested submap from trajectory " + std::to_string(trajectory_id) +
117 if (submap_index < 0 || submap_index >= num_submaps) {
118 return "Requested submap " + std::to_string(submap_index) +
119 " from trajectory " + std::to_string(trajectory_id) +
120 " but there are only " + std::to_string(num_submaps) +
121 " submaps in this trajectory.";
124 const auto submap_data =
126 CHECK(submap_data.submap !=
nullptr);
127 submap_data.submap->ToResponseProto(submap_data.pose, response);
std::unique_ptr< mapping_3d::SparsePoseGraph > sparse_pose_graph_3d_
int AddTrajectoryBuilder(const std::unordered_set< string > &expected_sensor_ids, const proto::TrajectoryBuilderOptions &trajectory_options)
proto::RangeDataInserterOptions options_
bool GetBool(const string &key)
common::ThreadPool thread_pool_
std::vector< std::unique_ptr< mapping::TrajectoryBuilder > > trajectory_builders_
int GetNonNegativeInt(const string &key)
mapping::SparsePoseGraph * sparse_pose_graph()
sensor::Collator sensor_collator_
proto::MapBuilderOptions CreateMapBuilderOptions(common::LuaParameterDictionary *const parameter_dictionary)
int GetBlockingTrajectoryId() const
std::unique_ptr< mapping_2d::SparsePoseGraph > sparse_pose_graph_2d_
const proto::MapBuilderOptions options_
mapping::TrajectoryBuilder * GetTrajectoryBuilder(int trajectory_id) const
void FinishTrajectory(int trajectory_id)
string SubmapToProto(int trajectory_id, int submap_index, proto::SubmapQuery::Response *response)
common::ThreadPool thread_pool_
mapping::SparsePoseGraph * sparse_pose_graph_
int num_trajectory_builders() const
MapBuilder(const proto::MapBuilderOptions &options)
void FinishTrajectory(int trajectory_id)
std::unique_ptr< LuaParameterDictionary > GetDictionary(const string &key)
int GetBlockingTrajectoryId() const
proto::SparsePoseGraphOptions CreateSparsePoseGraphOptions(common::LuaParameterDictionary *const parameter_dictionary)