From 3f4d795c3eb6b250d455b95ad89c5217c0e4bf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20M=C3=BCnst?= Date: Wed, 5 Jul 2017 16:55:07 +0200 Subject: [PATCH] Add pure localization parameter to trajectory builder options. (#389) --- cartographer/mapping/map_builder.cc | 5 +++++ cartographer/mapping/proto/trajectory_builder_options.proto | 1 + cartographer/mapping/trajectory_builder.cc | 2 ++ configuration_files/trajectory_builder.lua | 1 + 4 files changed, 9 insertions(+) diff --git a/cartographer/mapping/map_builder.cc b/cartographer/mapping/map_builder.cc index 9644060..8b46045 100644 --- a/cartographer/mapping/map_builder.cc +++ b/cartographer/mapping/map_builder.cc @@ -88,6 +88,11 @@ int MapBuilder::AddTrajectoryBuilder( trajectory_options.trajectory_builder_2d_options(), trajectory_id, sparse_pose_graph_2d_.get()))); } + if (trajectory_options.pure_localization()) { + constexpr int kSubmapsToKeep = 3; + sparse_pose_graph_->AddTrimmer(common::make_unique( + trajectory_id, kSubmapsToKeep)); + } return trajectory_id; } diff --git a/cartographer/mapping/proto/trajectory_builder_options.proto b/cartographer/mapping/proto/trajectory_builder_options.proto index 98d50f5..5366a6f 100644 --- a/cartographer/mapping/proto/trajectory_builder_options.proto +++ b/cartographer/mapping/proto/trajectory_builder_options.proto @@ -24,4 +24,5 @@ message TrajectoryBuilderOptions { trajectory_builder_2d_options = 1; optional mapping_3d.proto.LocalTrajectoryBuilderOptions trajectory_builder_3d_options = 2; + optional bool pure_localization = 3; } diff --git a/cartographer/mapping/trajectory_builder.cc b/cartographer/mapping/trajectory_builder.cc index 0eee6ed..a223804 100644 --- a/cartographer/mapping/trajectory_builder.cc +++ b/cartographer/mapping/trajectory_builder.cc @@ -31,6 +31,8 @@ proto::TrajectoryBuilderOptions CreateTrajectoryBuilderOptions( *options.mutable_trajectory_builder_3d_options() = mapping_3d::CreateLocalTrajectoryBuilderOptions( parameter_dictionary->GetDictionary("trajectory_builder_3d").get()); + options.set_pure_localization( + parameter_dictionary->GetBool("pure_localization")); return options; } diff --git a/configuration_files/trajectory_builder.lua b/configuration_files/trajectory_builder.lua index 75d91ad..52338a0 100644 --- a/configuration_files/trajectory_builder.lua +++ b/configuration_files/trajectory_builder.lua @@ -18,4 +18,5 @@ include "trajectory_builder_3d.lua" TRAJECTORY_BUILDER = { trajectory_builder_2d = TRAJECTORY_BUILDER_2D, trajectory_builder_3d = TRAJECTORY_BUILDER_3D, + pure_localization = false, }