Introduce PoseGraphInterface::GetAllSubmapPoses() (#790)
parent
63a80c9340
commit
1a837ef3ab
|
@ -49,6 +49,11 @@ class PoseGraphInterface {
|
||||||
enum Tag { INTRA_SUBMAP, INTER_SUBMAP } tag;
|
enum Tag { INTRA_SUBMAP, INTER_SUBMAP } tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SubmapPose {
|
||||||
|
int version;
|
||||||
|
transform::Rigid3d pose;
|
||||||
|
};
|
||||||
|
|
||||||
struct SubmapData {
|
struct SubmapData {
|
||||||
std::shared_ptr<const Submap> submap;
|
std::shared_ptr<const Submap> submap;
|
||||||
transform::Rigid3d pose;
|
transform::Rigid3d pose;
|
||||||
|
@ -66,6 +71,9 @@ class PoseGraphInterface {
|
||||||
// Returns data for all submaps.
|
// Returns data for all submaps.
|
||||||
virtual MapById<SubmapId, SubmapData> GetAllSubmapData() = 0;
|
virtual MapById<SubmapId, SubmapData> GetAllSubmapData() = 0;
|
||||||
|
|
||||||
|
// Returns the global poses for all submaps.
|
||||||
|
virtual MapById<SubmapId, SubmapPose> GetAllSubmapPoses() = 0;
|
||||||
|
|
||||||
// Returns the transform converting data in the local map frame (i.e. the
|
// Returns the transform converting data in the local map frame (i.e. the
|
||||||
// continuous, non-loop-closed frame) into the global map frame (i.e. the
|
// continuous, non-loop-closed frame) into the global map frame (i.e. the
|
||||||
// discontinuous, loop-closed frame).
|
// discontinuous, loop-closed frame).
|
||||||
|
|
|
@ -652,10 +652,11 @@ mapping::PoseGraph::SubmapData PoseGraph::GetSubmapData(
|
||||||
return GetSubmapDataUnderLock(submap_id);
|
return GetSubmapDataUnderLock(submap_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData>
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
PoseGraph::GetAllSubmapData() {
|
PoseGraph::GetAllSubmapData() {
|
||||||
common::MutexLocker locker(&mutex_);
|
common::MutexLocker locker(&mutex_);
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData> submaps;
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
|
submaps;
|
||||||
for (const auto& submap_id_data : submap_data_) {
|
for (const auto& submap_id_data : submap_data_) {
|
||||||
submaps.Insert(submap_id_data.id,
|
submaps.Insert(submap_id_data.id,
|
||||||
GetSubmapDataUnderLock(submap_id_data.id));
|
GetSubmapDataUnderLock(submap_id_data.id));
|
||||||
|
@ -663,6 +664,20 @@ PoseGraph::GetAllSubmapData() {
|
||||||
return submaps;
|
return submaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapPose>
|
||||||
|
PoseGraph::GetAllSubmapPoses() {
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
|
mapping::MapById<mapping::SubmapId, SubmapPose> submap_poses;
|
||||||
|
for (const auto& submap_id_data : submap_data_) {
|
||||||
|
auto submap_data = GetSubmapDataUnderLock(submap_id_data.id);
|
||||||
|
submap_poses.Insert(
|
||||||
|
submap_id_data.id,
|
||||||
|
mapping::PoseGraph::SubmapPose{submap_data.submap->num_range_data(),
|
||||||
|
submap_data.pose});
|
||||||
|
}
|
||||||
|
return submap_poses;
|
||||||
|
}
|
||||||
|
|
||||||
transform::Rigid3d PoseGraph::ComputeLocalToGlobalTransform(
|
transform::Rigid3d PoseGraph::ComputeLocalToGlobalTransform(
|
||||||
const mapping::MapById<mapping::SubmapId, pose_graph::SubmapData>&
|
const mapping::MapById<mapping::SubmapId, pose_graph::SubmapData>&
|
||||||
global_submap_poses,
|
global_submap_poses,
|
||||||
|
|
|
@ -102,8 +102,10 @@ class PoseGraph : public mapping::PoseGraph {
|
||||||
std::vector<std::vector<int>> GetConnectedTrajectories() override;
|
std::vector<std::vector<int>> GetConnectedTrajectories() override;
|
||||||
mapping::PoseGraph::SubmapData GetSubmapData(
|
mapping::PoseGraph::SubmapData GetSubmapData(
|
||||||
const mapping::SubmapId& submap_id) EXCLUDES(mutex_) override;
|
const mapping::SubmapId& submap_id) EXCLUDES(mutex_) override;
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData>
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
GetAllSubmapData() EXCLUDES(mutex_) override;
|
GetAllSubmapData() EXCLUDES(mutex_) override;
|
||||||
|
mapping::MapById<mapping::SubmapId, SubmapPose> GetAllSubmapPoses()
|
||||||
|
EXCLUDES(mutex_) override;
|
||||||
transform::Rigid3d GetLocalToGlobalTransform(int trajectory_id)
|
transform::Rigid3d GetLocalToGlobalTransform(int trajectory_id)
|
||||||
EXCLUDES(mutex_) override;
|
EXCLUDES(mutex_) override;
|
||||||
mapping::MapById<mapping::NodeId, mapping::TrajectoryNode>
|
mapping::MapById<mapping::NodeId, mapping::TrajectoryNode>
|
||||||
|
|
|
@ -671,10 +671,11 @@ mapping::PoseGraph::SubmapData PoseGraph::GetSubmapData(
|
||||||
return GetSubmapDataUnderLock(submap_id);
|
return GetSubmapDataUnderLock(submap_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData>
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
PoseGraph::GetAllSubmapData() {
|
PoseGraph::GetAllSubmapData() {
|
||||||
common::MutexLocker locker(&mutex_);
|
common::MutexLocker locker(&mutex_);
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData> submaps;
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
|
submaps;
|
||||||
for (const auto& submap_id_data : submap_data_) {
|
for (const auto& submap_id_data : submap_data_) {
|
||||||
submaps.Insert(submap_id_data.id,
|
submaps.Insert(submap_id_data.id,
|
||||||
GetSubmapDataUnderLock(submap_id_data.id));
|
GetSubmapDataUnderLock(submap_id_data.id));
|
||||||
|
@ -682,6 +683,20 @@ PoseGraph::GetAllSubmapData() {
|
||||||
return submaps;
|
return submaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapPose>
|
||||||
|
PoseGraph::GetAllSubmapPoses() {
|
||||||
|
common::MutexLocker locker(&mutex_);
|
||||||
|
mapping::MapById<mapping::SubmapId, SubmapPose> submap_poses;
|
||||||
|
for (const auto& submap_id_data : submap_data_) {
|
||||||
|
auto submap_data = GetSubmapDataUnderLock(submap_id_data.id);
|
||||||
|
submap_poses.Insert(
|
||||||
|
submap_id_data.id,
|
||||||
|
mapping::PoseGraph::SubmapPose{submap_data.submap->num_range_data(),
|
||||||
|
submap_data.pose});
|
||||||
|
}
|
||||||
|
return submap_poses;
|
||||||
|
}
|
||||||
|
|
||||||
transform::Rigid3d PoseGraph::ComputeLocalToGlobalTransform(
|
transform::Rigid3d PoseGraph::ComputeLocalToGlobalTransform(
|
||||||
const mapping::MapById<mapping::SubmapId, pose_graph::SubmapData>&
|
const mapping::MapById<mapping::SubmapId, pose_graph::SubmapData>&
|
||||||
global_submap_poses,
|
global_submap_poses,
|
||||||
|
|
|
@ -102,8 +102,10 @@ class PoseGraph : public mapping::PoseGraph {
|
||||||
std::vector<std::vector<int>> GetConnectedTrajectories() override;
|
std::vector<std::vector<int>> GetConnectedTrajectories() override;
|
||||||
mapping::PoseGraph::SubmapData GetSubmapData(
|
mapping::PoseGraph::SubmapData GetSubmapData(
|
||||||
const mapping::SubmapId& submap_id) EXCLUDES(mutex_) override;
|
const mapping::SubmapId& submap_id) EXCLUDES(mutex_) override;
|
||||||
mapping::MapById<mapping::SubmapId, mapping::PoseGraph::SubmapData>
|
mapping::MapById<mapping::SubmapId, mapping::PoseGraphInterface::SubmapData>
|
||||||
GetAllSubmapData() EXCLUDES(mutex_) override;
|
GetAllSubmapData() EXCLUDES(mutex_) override;
|
||||||
|
mapping::MapById<mapping::SubmapId, SubmapPose> GetAllSubmapPoses()
|
||||||
|
EXCLUDES(mutex_) override;
|
||||||
transform::Rigid3d GetLocalToGlobalTransform(int trajectory_id)
|
transform::Rigid3d GetLocalToGlobalTransform(int trajectory_id)
|
||||||
EXCLUDES(mutex_) override;
|
EXCLUDES(mutex_) override;
|
||||||
mapping::MapById<mapping::NodeId, mapping::TrajectoryNode>
|
mapping::MapById<mapping::NodeId, mapping::TrajectoryNode>
|
||||||
|
|
|
@ -34,6 +34,13 @@ PoseGraphStub::GetAllSubmapData() {
|
||||||
LOG(FATAL) << "Not implemented";
|
LOG(FATAL) << "Not implemented";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cartographer::mapping::MapById<
|
||||||
|
cartographer::mapping::SubmapId,
|
||||||
|
cartographer::mapping::PoseGraphInterface::SubmapPose>
|
||||||
|
PoseGraphStub::GetAllSubmapPoses() {
|
||||||
|
LOG(FATAL) << "Not implemented";
|
||||||
|
}
|
||||||
|
|
||||||
cartographer::transform::Rigid3d PoseGraphStub::GetLocalToGlobalTransform(
|
cartographer::transform::Rigid3d PoseGraphStub::GetLocalToGlobalTransform(
|
||||||
int trajectory_id) {
|
int trajectory_id) {
|
||||||
LOG(FATAL) << "Not implemented";
|
LOG(FATAL) << "Not implemented";
|
||||||
|
|
|
@ -35,6 +35,8 @@ class PoseGraphStub : public cartographer::mapping::PoseGraphInterface {
|
||||||
void RunFinalOptimization() override;
|
void RunFinalOptimization() override;
|
||||||
cartographer::mapping::MapById<cartographer::mapping::SubmapId, SubmapData>
|
cartographer::mapping::MapById<cartographer::mapping::SubmapId, SubmapData>
|
||||||
GetAllSubmapData() override;
|
GetAllSubmapData() override;
|
||||||
|
cartographer::mapping::MapById<cartographer::mapping::SubmapId, SubmapPose>
|
||||||
|
GetAllSubmapPoses() override;
|
||||||
cartographer::transform::Rigid3d GetLocalToGlobalTransform(
|
cartographer::transform::Rigid3d GetLocalToGlobalTransform(
|
||||||
int trajectory_id) override;
|
int trajectory_id) override;
|
||||||
cartographer::mapping::MapById<cartographer::mapping::NodeId,
|
cartographer::mapping::MapById<cartographer::mapping::NodeId,
|
||||||
|
|
Loading…
Reference in New Issue