Move LocalSlamResultCallback to AddTrajectory (#724)

master
gaschler 2017-12-04 22:41:38 +01:00 committed by Christoph Schütte
parent 0315acf050
commit ee9c61a736
3 changed files with 11 additions and 15 deletions

View File

@ -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<mapping_2d::PoseGraph>(
options_.pose_graph_options(), &thread_pool_);
@ -75,7 +71,8 @@ MapBuilder::~MapBuilder() {}
int MapBuilder::AddTrajectoryBuilder(
const std::unordered_set<std::string>& 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;

View File

@ -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<std::string>& 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<mapping_3d::PoseGraph> pose_graph_3d_;
mapping::PoseGraph* pose_graph_;
LocalSlamResultCallback local_slam_result_callback_;
sensor::Collator sensor_collator_;
std::vector<std::unique_ptr<mapping::TrajectoryBuilder>> trajectory_builders_;
};

View File

@ -51,7 +51,8 @@ class MapBuilderInterface {
// Creates a new trajectory builder and returns its index.
virtual int AddTrajectoryBuilder(
const std::unordered_set<std::string>& 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'.