Clean-up dependencies of map_builder and put getters to the header. (#989)
parent
c060a15670
commit
0190e7cd99
|
@ -16,12 +16,6 @@
|
||||||
|
|
||||||
#include "cartographer/mapping/map_builder.h"
|
#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/make_unique.h"
|
||||||
#include "cartographer/common/time.h"
|
#include "cartographer/common/time.h"
|
||||||
#include "cartographer/mapping/internal/2d/local_trajectory_builder_2d.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/collator.h"
|
||||||
#include "cartographer/sensor/internal/trajectory_collator.h"
|
#include "cartographer/sensor/internal/trajectory_collator.h"
|
||||||
#include "cartographer/sensor/internal/voxel_filter.h"
|
#include "cartographer/sensor/internal/voxel_filter.h"
|
||||||
#include "cartographer/sensor/range_data.h"
|
|
||||||
#include "cartographer/transform/rigid_transform.h"
|
#include "cartographer/transform/rigid_transform.h"
|
||||||
#include "cartographer/transform/transform.h"
|
#include "cartographer/transform/transform.h"
|
||||||
#include "glog/logging.h"
|
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace mapping {
|
namespace mapping {
|
||||||
|
@ -142,11 +134,6 @@ int MapBuilder::AddTrajectoryForDeserialization(
|
||||||
return trajectory_id;
|
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) {
|
void MapBuilder::FinishTrajectory(const int trajectory_id) {
|
||||||
sensor_collator_->FinishTrajectory(trajectory_id);
|
sensor_collator_->FinishTrajectory(trajectory_id);
|
||||||
pose_graph_->FinishTrajectory(trajectory_id);
|
pose_graph_->FinishTrajectory(trajectory_id);
|
||||||
|
@ -411,16 +398,5 @@ void MapBuilder::LoadState(io::ProtoStreamReaderInterface* const reader,
|
||||||
CHECK(reader->eof());
|
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 mapping
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "cartographer/mapping/map_builder_interface.h"
|
#include "cartographer/mapping/map_builder_interface.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <set>
|
|
||||||
|
|
||||||
#include "cartographer/common/thread_pool.h"
|
#include "cartographer/common/thread_pool.h"
|
||||||
#include "cartographer/mapping/pose_graph.h"
|
#include "cartographer/mapping/pose_graph.h"
|
||||||
|
@ -52,9 +51,6 @@ class MapBuilder : public MapBuilderInterface {
|
||||||
const proto::TrajectoryBuilderOptionsWithSensorIds&
|
const proto::TrajectoryBuilderOptionsWithSensorIds&
|
||||||
options_with_sensor_ids_proto) override;
|
options_with_sensor_ids_proto) override;
|
||||||
|
|
||||||
mapping::TrajectoryBuilderInterface* GetTrajectoryBuilder(
|
|
||||||
int trajectory_id) const override;
|
|
||||||
|
|
||||||
void FinishTrajectory(int trajectory_id) override;
|
void FinishTrajectory(int trajectory_id) override;
|
||||||
|
|
||||||
std::string SubmapToProto(const SubmapId& submap_id,
|
std::string SubmapToProto(const SubmapId& submap_id,
|
||||||
|
@ -65,12 +61,23 @@ class MapBuilder : public MapBuilderInterface {
|
||||||
void LoadState(io::ProtoStreamReaderInterface* reader,
|
void LoadState(io::ProtoStreamReaderInterface* reader,
|
||||||
bool load_frozen_state) override;
|
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>&
|
const std::vector<proto::TrajectoryBuilderOptionsWithSensorIds>&
|
||||||
GetAllTrajectoryBuilderOptions() const override;
|
GetAllTrajectoryBuilderOptions() const override {
|
||||||
|
return all_trajectory_builder_options_;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const proto::MapBuilderOptions options_;
|
const proto::MapBuilderOptions options_;
|
||||||
|
|
|
@ -16,21 +16,16 @@
|
||||||
|
|
||||||
#include "cartographer/mapping/map_builder.h"
|
#include "cartographer/mapping/map_builder.h"
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "cartographer/common/config.h"
|
#include "cartographer/common/config.h"
|
||||||
#include "cartographer/mapping/internal/test_helpers.h"
|
#include "cartographer/mapping/internal/test_helpers.h"
|
||||||
#include "cartographer/mapping/trajectory_builder_interface.h"
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
using SensorId = cartographer::mapping::TrajectoryBuilderInterface::SensorId;
|
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace mapping {
|
namespace mapping {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
using SensorId = cartographer::mapping::TrajectoryBuilderInterface::SensorId;
|
||||||
|
|
||||||
const SensorId kRangeSensorId{SensorId::SensorType::RANGE, "range"};
|
const SensorId kRangeSensorId{SensorId::SensorType::RANGE, "range"};
|
||||||
const SensorId kIMUSensorId{SensorId::SensorType::IMU, "imu"};
|
const SensorId kIMUSensorId{SensorId::SensorType::IMU, "imu"};
|
||||||
constexpr double kDuration = 4.; // Seconds.
|
constexpr double kDuration = 4.; // Seconds.
|
||||||
|
|
Loading…
Reference in New Issue