diff --git a/cartographer/mapping/map_builder.cc b/cartographer/mapping/map_builder.cc index 6c7109d..9d0b484 100644 --- a/cartographer/mapping/map_builder.cc +++ b/cartographer/mapping/map_builder.cc @@ -53,12 +53,8 @@ proto::MapBuilderOptions CreateMapBuilderOptions( return options; } -MapBuilder::MapBuilder( - const proto::MapBuilderOptions& options, - const LocalSlamResultCallback& local_slam_result_callback) - : options_(options), - thread_pool_(options.num_background_threads()), - local_slam_result_callback_(local_slam_result_callback) { +MapBuilder::MapBuilder(const proto::MapBuilderOptions& options) + : options_(options), thread_pool_(options.num_background_threads()) { if (options.use_trajectory_builder_2d()) { pose_graph_2d_ = common::make_unique( options_.pose_graph_options(), &thread_pool_); @@ -75,7 +71,8 @@ MapBuilder::~MapBuilder() {} int MapBuilder::AddTrajectoryBuilder( const std::unordered_set& expected_sensor_ids, - const proto::TrajectoryBuilderOptions& trajectory_options) { + const proto::TrajectoryBuilderOptions& trajectory_options, + LocalSlamResultCallback local_slam_result_callback) { const int trajectory_id = trajectory_builders_.size(); if (options_.use_trajectory_builder_3d()) { CHECK(trajectory_options.has_trajectory_builder_3d_options()); @@ -88,7 +85,7 @@ int MapBuilder::AddTrajectoryBuilder( mapping_3d::PoseGraph>>( trajectory_options.trajectory_builder_3d_options(), trajectory_id, pose_graph_3d_.get(), - local_slam_result_callback_))); + local_slam_result_callback))); } else { CHECK(trajectory_options.has_trajectory_builder_2d_options()); trajectory_builders_.push_back( @@ -100,7 +97,7 @@ int MapBuilder::AddTrajectoryBuilder( mapping_2d::PoseGraph>>( trajectory_options.trajectory_builder_2d_options(), trajectory_id, pose_graph_2d_.get(), - local_slam_result_callback_))); + local_slam_result_callback))); } if (trajectory_options.pure_localization()) { constexpr int kSubmapsToKeep = 3; diff --git a/cartographer/mapping/map_builder.h b/cartographer/mapping/map_builder.h index 1b16b9e..18bdba0 100644 --- a/cartographer/mapping/map_builder.h +++ b/cartographer/mapping/map_builder.h @@ -38,8 +38,7 @@ proto::MapBuilderOptions CreateMapBuilderOptions( // and a PoseGraph for loop closure. class MapBuilder : public MapBuilderInterface { public: - MapBuilder(const proto::MapBuilderOptions& options, - const LocalSlamResultCallback& local_slam_result_callback); + MapBuilder(const proto::MapBuilderOptions& options); ~MapBuilder() override; MapBuilder(const MapBuilder&) = delete; @@ -47,7 +46,8 @@ class MapBuilder : public MapBuilderInterface { int AddTrajectoryBuilder( const std::unordered_set& expected_sensor_ids, - const proto::TrajectoryBuilderOptions& trajectory_options) override; + const proto::TrajectoryBuilderOptions& trajectory_options, + LocalSlamResultCallback local_slam_result_callback) override; int AddTrajectoryForDeserialization() override; @@ -75,8 +75,6 @@ class MapBuilder : public MapBuilderInterface { std::unique_ptr pose_graph_3d_; mapping::PoseGraph* pose_graph_; - LocalSlamResultCallback local_slam_result_callback_; - sensor::Collator sensor_collator_; std::vector> trajectory_builders_; }; diff --git a/cartographer/mapping/map_builder_interface.h b/cartographer/mapping/map_builder_interface.h index 473adf7..7e174ea 100644 --- a/cartographer/mapping/map_builder_interface.h +++ b/cartographer/mapping/map_builder_interface.h @@ -51,7 +51,8 @@ class MapBuilderInterface { // Creates a new trajectory builder and returns its index. virtual int AddTrajectoryBuilder( const std::unordered_set& expected_sensor_ids, - const proto::TrajectoryBuilderOptions& trajectory_options) = 0; + const proto::TrajectoryBuilderOptions& trajectory_options, + LocalSlamResultCallback local_slam_result_callback) = 0; // Creates a new trajectory and returns its index. Querying the trajectory // builder for it will return 'nullptr'.