From 0190e7cd99b40df7ee10cddce95950f60c7ae974 Mon Sep 17 00:00:00 2001 From: Alexander Belyaev <32522095+pifon2a@users.noreply.github.com> Date: Wed, 14 Mar 2018 13:33:44 +0100 Subject: [PATCH] Clean-up dependencies of map_builder and put getters to the header. (#989) --- cartographer/mapping/map_builder.cc | 24 ------------------------ cartographer/mapping/map_builder.h | 21 ++++++++++++++------- cartographer/mapping/map_builder_test.cc | 9 ++------- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/cartographer/mapping/map_builder.cc b/cartographer/mapping/map_builder.cc index 08f92af..2eb78f1 100644 --- a/cartographer/mapping/map_builder.cc +++ b/cartographer/mapping/map_builder.cc @@ -16,12 +16,6 @@ #include "cartographer/mapping/map_builder.h" -#include -#include -#include -#include -#include - #include "cartographer/common/make_unique.h" #include "cartographer/common/time.h" #include "cartographer/mapping/internal/2d/local_trajectory_builder_2d.h" @@ -33,10 +27,8 @@ #include "cartographer/sensor/internal/collator.h" #include "cartographer/sensor/internal/trajectory_collator.h" #include "cartographer/sensor/internal/voxel_filter.h" -#include "cartographer/sensor/range_data.h" #include "cartographer/transform/rigid_transform.h" #include "cartographer/transform/transform.h" -#include "glog/logging.h" namespace cartographer { namespace mapping { @@ -142,11 +134,6 @@ int MapBuilder::AddTrajectoryForDeserialization( return trajectory_id; } -TrajectoryBuilderInterface* MapBuilder::GetTrajectoryBuilder( - const int trajectory_id) const { - return trajectory_builders_.at(trajectory_id).get(); -} - void MapBuilder::FinishTrajectory(const int trajectory_id) { sensor_collator_->FinishTrajectory(trajectory_id); pose_graph_->FinishTrajectory(trajectory_id); @@ -411,16 +398,5 @@ void MapBuilder::LoadState(io::ProtoStreamReaderInterface* const reader, CHECK(reader->eof()); } -int MapBuilder::num_trajectory_builders() const { - return trajectory_builders_.size(); -} - -PoseGraphInterface* MapBuilder::pose_graph() { return pose_graph_.get(); } - -const std::vector& -MapBuilder::GetAllTrajectoryBuilderOptions() const { - return all_trajectory_builder_options_; -} - } // namespace mapping } // namespace cartographer diff --git a/cartographer/mapping/map_builder.h b/cartographer/mapping/map_builder.h index 9659b97..6e5e92a 100644 --- a/cartographer/mapping/map_builder.h +++ b/cartographer/mapping/map_builder.h @@ -20,7 +20,6 @@ #include "cartographer/mapping/map_builder_interface.h" #include -#include #include "cartographer/common/thread_pool.h" #include "cartographer/mapping/pose_graph.h" @@ -52,9 +51,6 @@ class MapBuilder : public MapBuilderInterface { const proto::TrajectoryBuilderOptionsWithSensorIds& options_with_sensor_ids_proto) override; - mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder( - int trajectory_id) const override; - void FinishTrajectory(int trajectory_id) override; std::string SubmapToProto(const SubmapId& submap_id, @@ -65,12 +61,23 @@ class MapBuilder : public MapBuilderInterface { void LoadState(io::ProtoStreamReaderInterface* reader, bool load_frozen_state) override; - int num_trajectory_builders() const override; + mapping::PoseGraphInterface* pose_graph() override { + return pose_graph_.get(); + } - mapping::PoseGraphInterface* pose_graph() override; + int num_trajectory_builders() const override { + return trajectory_builders_.size(); + } + + mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder( + int trajectory_id) const override { + return trajectory_builders_.at(trajectory_id).get(); + } const std::vector& - GetAllTrajectoryBuilderOptions() const override; + GetAllTrajectoryBuilderOptions() const override { + return all_trajectory_builder_options_; + } private: const proto::MapBuilderOptions options_; diff --git a/cartographer/mapping/map_builder_test.cc b/cartographer/mapping/map_builder_test.cc index fbaec95..5922ca1 100644 --- a/cartographer/mapping/map_builder_test.cc +++ b/cartographer/mapping/map_builder_test.cc @@ -16,21 +16,16 @@ #include "cartographer/mapping/map_builder.h" -#include -#include -#include - #include "cartographer/common/config.h" #include "cartographer/mapping/internal/test_helpers.h" -#include "cartographer/mapping/trajectory_builder_interface.h" #include "gtest/gtest.h" -using SensorId = cartographer::mapping::TrajectoryBuilderInterface::SensorId; - namespace cartographer { namespace mapping { namespace { +using SensorId = cartographer::mapping::TrajectoryBuilderInterface::SensorId; + const SensorId kRangeSensorId{SensorId::SensorType::RANGE, "range"}; const SensorId kIMUSensorId{SensorId::SensorType::IMU, "imu"}; constexpr double kDuration = 4.; // Seconds.