Split local_slam_result_data.h into base and 2d/3d parts. (#967)
parent
b29986f297
commit
bb4ba8b319
|
@ -19,6 +19,7 @@
|
|||
#include "cartographer/cloud/internal/sensor/serialization.h"
|
||||
#include "cartographer/cloud/proto/map_builder_service.pb.h"
|
||||
#include "cartographer/mapping/local_slam_result_data.h"
|
||||
#include "cartographer/transform/transform.h"
|
||||
#include "glog/logging.h"
|
||||
|
||||
namespace cartographer {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include "cartographer/cloud/internal/map_builder_context.h"
|
||||
|
||||
#include "cartographer/cloud/internal/map_builder_server.h"
|
||||
#include "cartographer/mapping/2d/local_slam_result_2d.h"
|
||||
#include "cartographer/mapping/3d/local_slam_result_3d.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace cloud {
|
||||
|
|
|
@ -14,10 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "local_slam_result_data.h"
|
||||
#include "cartographer/mapping/2d/local_slam_result_2d.h"
|
||||
#include "cartographer/mapping/2d/pose_graph_2d.h"
|
||||
#include "cartographer/mapping/3d/pose_graph_3d.h"
|
||||
#include "cartographer/mapping/trajectory_builder_interface.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace mapping {
|
||||
|
@ -31,21 +29,8 @@ void LocalSlamResult2D::AddToTrajectoryBuilder(
|
|||
void LocalSlamResult2D::AddToPoseGraph(int trajectory_id,
|
||||
PoseGraph* pose_graph) const {
|
||||
DCHECK(dynamic_cast<PoseGraph2D*>(pose_graph));
|
||||
PoseGraph2D* pose_graph_2d = static_cast<PoseGraph2D*>(pose_graph);
|
||||
pose_graph_2d->AddNode(node_data_, trajectory_id, insertion_submaps_);
|
||||
}
|
||||
|
||||
void LocalSlamResult3D::AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
trajectory_builder->AddLocalSlamResultData(
|
||||
common::make_unique<LocalSlamResult3D>(*this));
|
||||
}
|
||||
|
||||
void LocalSlamResult3D::AddToPoseGraph(int trajectory_id,
|
||||
PoseGraph* pose_graph) const {
|
||||
DCHECK(dynamic_cast<PoseGraph3D*>(pose_graph));
|
||||
PoseGraph3D* pose_graph_3d = static_cast<PoseGraph3D*>(pose_graph);
|
||||
pose_graph_3d->AddNode(node_data_, trajectory_id, insertion_submaps_);
|
||||
static_cast<PoseGraph2D*>(pose_graph)
|
||||
->AddNode(node_data_, trajectory_id, insertion_submaps_);
|
||||
}
|
||||
|
||||
} // namespace mapping
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2018 The Cartographer Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CARTOGRAPHER_MAPPING_2D_LOCAL_SLAM_RESULT_2D_H_
|
||||
#define CARTOGRAPHER_MAPPING_2D_LOCAL_SLAM_RESULT_2D_H_
|
||||
|
||||
#include "cartographer/mapping/2d/submap_2d.h"
|
||||
#include "cartographer/mapping/local_slam_result_data.h"
|
||||
#include "cartographer/mapping/trajectory_builder_interface.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace mapping {
|
||||
|
||||
class LocalSlamResult2D : public LocalSlamResultData {
|
||||
public:
|
||||
LocalSlamResult2D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const Submap2D>>& insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) override;
|
||||
void AddToPoseGraph(int trajectory_id, PoseGraph* pose_graph) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data_;
|
||||
std::vector<std::shared_ptr<const Submap2D>> insertion_submaps_;
|
||||
};
|
||||
|
||||
} // namespace mapping
|
||||
} // namespace cartographer
|
||||
|
||||
#endif // CARTOGRAPHER_MAPPING_2D_LOCAL_SLAM_RESULT_2D_H_
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright 2018 The Cartographer Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "cartographer/mapping/3d/local_slam_result_3d.h"
|
||||
#include "cartographer/mapping/3d/pose_graph_3d.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace mapping {
|
||||
|
||||
void LocalSlamResult3D::AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
trajectory_builder->AddLocalSlamResultData(
|
||||
common::make_unique<LocalSlamResult3D>(*this));
|
||||
}
|
||||
|
||||
void LocalSlamResult3D::AddToPoseGraph(int trajectory_id,
|
||||
PoseGraph* pose_graph) const {
|
||||
DCHECK(dynamic_cast<PoseGraph3D*>(pose_graph));
|
||||
static_cast<PoseGraph3D*>(pose_graph)
|
||||
->AddNode(node_data_, trajectory_id, insertion_submaps_);
|
||||
}
|
||||
|
||||
} // namespace mapping
|
||||
} // namespace cartographer
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright 2018 The Cartographer Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CARTOGRAPHER_MAPPING_3D_LOCAL_SLAM_RESULT_3D_H_
|
||||
#define CARTOGRAPHER_MAPPING_3D_LOCAL_SLAM_RESULT_3D_H_
|
||||
|
||||
#include "cartographer/mapping/3d/submap_3d.h"
|
||||
#include "cartographer/mapping/local_slam_result_data.h"
|
||||
#include "cartographer/mapping/trajectory_builder_interface.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace mapping {
|
||||
|
||||
class LocalSlamResult3D : public LocalSlamResultData {
|
||||
public:
|
||||
LocalSlamResult3D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const Submap3D>>& insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) override;
|
||||
void AddToPoseGraph(int trajectory_id, PoseGraph* pose_graph) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data_;
|
||||
std::vector<std::shared_ptr<const Submap3D>> insertion_submaps_;
|
||||
};
|
||||
|
||||
} // namespace mapping
|
||||
} // namespace cartographer
|
||||
|
||||
#endif // CARTOGRAPHER_MAPPING_3D_LOCAL_SLAM_RESULT_3D_H_
|
|
@ -17,16 +17,13 @@
|
|||
#ifndef CARTOGRAPHER_MAPPING_LOCAL_SLAM_RESULT_DATA_H
|
||||
#define CARTOGRAPHER_MAPPING_LOCAL_SLAM_RESULT_DATA_H
|
||||
|
||||
#include "cartographer/mapping/2d/submap_2d.h"
|
||||
#include "cartographer/mapping/3d/submap_3d.h"
|
||||
#include "cartographer/mapping/pose_graph.h"
|
||||
#include "cartographer/sensor/data.h"
|
||||
|
||||
namespace cartographer {
|
||||
namespace mapping {
|
||||
|
||||
class TrajectoryBuilderInterface;
|
||||
class LocalSlamResultData : public cartographer::sensor::Data {
|
||||
class LocalSlamResultData : public sensor::Data {
|
||||
public:
|
||||
LocalSlamResultData(const std::string& sensor_id, common::Time time)
|
||||
: Data(sensor_id), time_(time) {}
|
||||
|
@ -39,44 +36,6 @@ class LocalSlamResultData : public cartographer::sensor::Data {
|
|||
common::Time time_;
|
||||
};
|
||||
|
||||
class LocalSlamResult2D : public LocalSlamResultData {
|
||||
public:
|
||||
LocalSlamResult2D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const Submap2D>>& insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) override;
|
||||
void AddToPoseGraph(int trajectory_id, PoseGraph* pose_graph) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data_;
|
||||
std::vector<std::shared_ptr<const Submap2D>> insertion_submaps_;
|
||||
};
|
||||
|
||||
class LocalSlamResult3D : public LocalSlamResultData {
|
||||
public:
|
||||
LocalSlamResult3D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const Submap3D>>& insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void AddToTrajectoryBuilder(
|
||||
TrajectoryBuilderInterface* const trajectory_builder) override;
|
||||
void AddToPoseGraph(int trajectory_id, PoseGraph* pose_graph) const override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<const TrajectoryNode::Data> node_data_;
|
||||
std::vector<std::shared_ptr<const Submap3D>> insertion_submaps_;
|
||||
};
|
||||
|
||||
} // namespace mapping
|
||||
} // namespace cartographer
|
||||
|
||||
|
|
Loading…
Reference in New Issue