Remove 'pose_graph_*d.h' from local_slam_result_data.h. (#965)
parent
256b5a6ff0
commit
20a980aade
|
@ -15,54 +15,34 @@
|
|||
*/
|
||||
|
||||
#include "local_slam_result_data.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 {
|
||||
|
||||
LocalSlamResultData::LocalSlamResultData(const std::string& sensor_id,
|
||||
common::Time time)
|
||||
: Data(sensor_id), time_(time) {}
|
||||
|
||||
LocalSlamResult2D::LocalSlamResult2D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const mapping::TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const mapping::Submap2D>>&
|
||||
insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void LocalSlamResult2D::AddToTrajectoryBuilder(
|
||||
mapping::TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
trajectory_builder->AddLocalSlamResultData(
|
||||
common::make_unique<LocalSlamResult2D>(*this));
|
||||
}
|
||||
|
||||
void LocalSlamResult2D::AddToPoseGraph(int trajectory_id,
|
||||
mapping::PoseGraph* pose_graph) const {
|
||||
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_);
|
||||
}
|
||||
|
||||
LocalSlamResult3D::LocalSlamResult3D(
|
||||
const std::string& sensor_id, common::Time time,
|
||||
std::shared_ptr<const mapping::TrajectoryNode::Data> node_data,
|
||||
const std::vector<std::shared_ptr<const mapping::Submap3D>>&
|
||||
insertion_submaps)
|
||||
: LocalSlamResultData(sensor_id, time),
|
||||
node_data_(node_data),
|
||||
insertion_submaps_(insertion_submaps) {}
|
||||
|
||||
void LocalSlamResult3D::AddToTrajectoryBuilder(
|
||||
mapping::TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
TrajectoryBuilderInterface* const trajectory_builder) {
|
||||
trajectory_builder->AddLocalSlamResultData(
|
||||
common::make_unique<LocalSlamResult3D>(*this));
|
||||
}
|
||||
|
||||
void LocalSlamResult3D::AddToPoseGraph(int trajectory_id,
|
||||
mapping::PoseGraph* pose_graph) const {
|
||||
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_);
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
#ifndef CARTOGRAPHER_MAPPING_LOCAL_SLAM_RESULT_DATA_H
|
||||
#define CARTOGRAPHER_MAPPING_LOCAL_SLAM_RESULT_DATA_H
|
||||
|
||||
#include "cartographer/mapping/2d/pose_graph_2d.h"
|
||||
#include "cartographer/mapping/3d/pose_graph_3d.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 {
|
||||
|
@ -27,7 +28,8 @@ namespace mapping {
|
|||
class TrajectoryBuilderInterface;
|
||||
class LocalSlamResultData : public cartographer::sensor::Data {
|
||||
public:
|
||||
LocalSlamResultData(const std::string& sensor_id, common::Time time);
|
||||
LocalSlamResultData(const std::string& sensor_id, common::Time time)
|
||||
: Data(sensor_id), time_(time) {}
|
||||
|
||||
common::Time GetTime() const override { return time_; }
|
||||
virtual void AddToPoseGraph(int trajectory_id,
|
||||
|
@ -42,7 +44,10 @@ class LocalSlamResult2D : public LocalSlamResultData {
|
|||
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);
|
||||
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;
|
||||
|
@ -58,7 +63,10 @@ class LocalSlamResult3D : public LocalSlamResultData {
|
|||
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);
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue