Clean-up dependencies of map_builder and put getters to the header. (#989)

master
Alexander Belyaev 2018-03-14 13:33:44 +01:00 committed by Wally B. Feed
parent c060a15670
commit 0190e7cd99
3 changed files with 16 additions and 38 deletions

View File

@ -16,12 +16,6 @@
#include "cartographer/mapping/map_builder.h"
#include <cmath>
#include <limits>
#include <memory>
#include <unordered_set>
#include <utility>
#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<proto::TrajectoryBuilderOptionsWithSensorIds>&
MapBuilder::GetAllTrajectoryBuilderOptions() const {
return all_trajectory_builder_options_;
}
} // namespace mapping
} // namespace cartographer

View File

@ -20,7 +20,6 @@
#include "cartographer/mapping/map_builder_interface.h"
#include <memory>
#include <set>
#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<proto::TrajectoryBuilderOptionsWithSensorIds>&
GetAllTrajectoryBuilderOptions() const override;
GetAllTrajectoryBuilderOptions() const override {
return all_trajectory_builder_options_;
}
private:
const proto::MapBuilderOptions options_;

View File

@ -16,21 +16,16 @@
#include "cartographer/mapping/map_builder.h"
#include <functional>
#include <string>
#include <vector>
#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.