Rename proto::SparsePoseGraph. (#680)
[RFC=0001](https://github.com/googlecartographer/rfcs/blob/master/text/0001-renaming-sparse-pose-graph.md)master
parent
c866707013
commit
bdca2095c0
|
@ -21,7 +21,7 @@
|
||||||
#include "cartographer/common/port.h"
|
#include "cartographer/common/port.h"
|
||||||
#include "cartographer/ground_truth/proto/relations.pb.h"
|
#include "cartographer/ground_truth/proto/relations.pb.h"
|
||||||
#include "cartographer/io/proto_stream.h"
|
#include "cartographer/io/proto_stream.h"
|
||||||
#include "cartographer/mapping/proto/sparse_pose_graph.pb.h"
|
#include "cartographer/mapping/proto/pose_graph.pb.h"
|
||||||
#include "cartographer/transform/transform.h"
|
#include "cartographer/transform/transform.h"
|
||||||
#include "gflags/gflags.h"
|
#include "gflags/gflags.h"
|
||||||
#include "glog/logging.h"
|
#include "glog/logging.h"
|
||||||
|
@ -66,11 +66,11 @@ std::vector<double> ComputeCoveredDistance(
|
||||||
// TODO(whess): Should we consider all nodes inserted into the submap and
|
// TODO(whess): Should we consider all nodes inserted into the submap and
|
||||||
// exclude, e.g. based on large relative linear or angular distance?
|
// exclude, e.g. based on large relative linear or angular distance?
|
||||||
std::vector<int> ComputeSubmapRepresentativeNode(
|
std::vector<int> ComputeSubmapRepresentativeNode(
|
||||||
const mapping::proto::SparsePoseGraph& pose_graph) {
|
const mapping::proto::PoseGraph& pose_graph) {
|
||||||
std::vector<int> submap_to_node_index;
|
std::vector<int> submap_to_node_index;
|
||||||
for (const auto& constraint : pose_graph.constraint()) {
|
for (const auto& constraint : pose_graph.constraint()) {
|
||||||
if (constraint.tag() !=
|
if (constraint.tag() !=
|
||||||
mapping::proto::SparsePoseGraph::Constraint::INTRA_SUBMAP) {
|
mapping::proto::PoseGraph::Constraint::INTRA_SUBMAP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CHECK_EQ(constraint.submap_id().trajectory_id(), 0);
|
CHECK_EQ(constraint.submap_id().trajectory_id(), 0);
|
||||||
|
@ -89,7 +89,7 @@ std::vector<int> ComputeSubmapRepresentativeNode(
|
||||||
}
|
}
|
||||||
|
|
||||||
proto::GroundTruth GenerateGroundTruth(
|
proto::GroundTruth GenerateGroundTruth(
|
||||||
const mapping::proto::SparsePoseGraph& pose_graph,
|
const mapping::proto::PoseGraph& pose_graph,
|
||||||
const double min_covered_distance, const double outlier_threshold_meters,
|
const double min_covered_distance, const double outlier_threshold_meters,
|
||||||
const double outlier_threshold_radians) {
|
const double outlier_threshold_radians) {
|
||||||
const mapping::proto::Trajectory& trajectory = pose_graph.trajectory(0);
|
const mapping::proto::Trajectory& trajectory = pose_graph.trajectory(0);
|
||||||
|
@ -104,7 +104,7 @@ proto::GroundTruth GenerateGroundTruth(
|
||||||
for (const auto& constraint : pose_graph.constraint()) {
|
for (const auto& constraint : pose_graph.constraint()) {
|
||||||
// We're only interested in loop closure constraints.
|
// We're only interested in loop closure constraints.
|
||||||
if (constraint.tag() ==
|
if (constraint.tag() ==
|
||||||
mapping::proto::SparsePoseGraph::Constraint::INTRA_SUBMAP) {
|
mapping::proto::PoseGraph::Constraint::INTRA_SUBMAP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ void Run(const std::string& pose_graph_filename,
|
||||||
const double outlier_threshold_meters,
|
const double outlier_threshold_meters,
|
||||||
const double outlier_threshold_radians) {
|
const double outlier_threshold_radians) {
|
||||||
LOG(INFO) << "Reading pose graph from '" << pose_graph_filename << "'...";
|
LOG(INFO) << "Reading pose graph from '" << pose_graph_filename << "'...";
|
||||||
mapping::proto::SparsePoseGraph pose_graph;
|
mapping::proto::PoseGraph pose_graph;
|
||||||
{
|
{
|
||||||
io::ProtoStreamReader reader(pose_graph_filename);
|
io::ProtoStreamReader reader(pose_graph_filename);
|
||||||
CHECK(reader.ReadProto(&pose_graph));
|
CHECK(reader.ReadProto(&pose_graph));
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "cartographer/ground_truth/proto/relations.pb.h"
|
#include "cartographer/ground_truth/proto/relations.pb.h"
|
||||||
#include "cartographer/ground_truth/relations_text_file.h"
|
#include "cartographer/ground_truth/relations_text_file.h"
|
||||||
#include "cartographer/io/proto_stream.h"
|
#include "cartographer/io/proto_stream.h"
|
||||||
#include "cartographer/mapping/proto/sparse_pose_graph.pb.h"
|
#include "cartographer/mapping/proto/pose_graph.pb.h"
|
||||||
#include "cartographer/transform/rigid_transform.h"
|
#include "cartographer/transform/rigid_transform.h"
|
||||||
#include "cartographer/transform/transform.h"
|
#include "cartographer/transform/transform.h"
|
||||||
#include "cartographer/transform/transform_interpolation_buffer.h"
|
#include "cartographer/transform/transform_interpolation_buffer.h"
|
||||||
|
@ -113,7 +113,7 @@ void Run(const std::string& pose_graph_filename,
|
||||||
const std::string& relations_filename,
|
const std::string& relations_filename,
|
||||||
const bool read_text_file_with_unix_timestamps) {
|
const bool read_text_file_with_unix_timestamps) {
|
||||||
LOG(INFO) << "Reading pose graph from '" << pose_graph_filename << "'...";
|
LOG(INFO) << "Reading pose graph from '" << pose_graph_filename << "'...";
|
||||||
mapping::proto::SparsePoseGraph pose_graph;
|
mapping::proto::PoseGraph pose_graph;
|
||||||
{
|
{
|
||||||
io::ProtoStreamReader reader(pose_graph_filename);
|
io::ProtoStreamReader reader(pose_graph_filename);
|
||||||
CHECK(reader.ReadProto(&pose_graph));
|
CHECK(reader.ReadProto(&pose_graph));
|
||||||
|
|
|
@ -219,7 +219,7 @@ void MapBuilder::SerializeState(io::ProtoStreamWriter* const writer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapBuilder::LoadMap(io::ProtoStreamReader* const reader) {
|
void MapBuilder::LoadMap(io::ProtoStreamReader* const reader) {
|
||||||
proto::SparsePoseGraph pose_graph;
|
proto::PoseGraph pose_graph;
|
||||||
CHECK(reader->ReadProto(&pose_graph));
|
CHECK(reader->ReadProto(&pose_graph));
|
||||||
|
|
||||||
std::map<int, int> trajectory_remapping;
|
std::map<int, int> trajectory_remapping;
|
||||||
|
@ -278,10 +278,10 @@ void MapBuilder::LoadMap(io::ProtoStreamReader* const reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add information about which nodes belong to which submap.
|
// Add information about which nodes belong to which submap.
|
||||||
for (const proto::SparsePoseGraph::Constraint& constraint_proto :
|
for (const proto::PoseGraph::Constraint& constraint_proto :
|
||||||
pose_graph.constraint()) {
|
pose_graph.constraint()) {
|
||||||
if (constraint_proto.tag() !=
|
if (constraint_proto.tag() !=
|
||||||
mapping::proto::SparsePoseGraph::Constraint::INTRA_SUBMAP) {
|
mapping::proto::PoseGraph::Constraint::INTRA_SUBMAP) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const NodeId node_id{
|
const NodeId node_id{
|
||||||
|
|
|
@ -24,23 +24,23 @@
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace mapping {
|
namespace mapping {
|
||||||
|
|
||||||
proto::SparsePoseGraph::Constraint::Tag ToProto(
|
proto::PoseGraph::Constraint::Tag ToProto(
|
||||||
const PoseGraph::Constraint::Tag& tag) {
|
const PoseGraph::Constraint::Tag& tag) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case PoseGraph::Constraint::Tag::INTRA_SUBMAP:
|
case PoseGraph::Constraint::Tag::INTRA_SUBMAP:
|
||||||
return proto::SparsePoseGraph::Constraint::INTRA_SUBMAP;
|
return proto::PoseGraph::Constraint::INTRA_SUBMAP;
|
||||||
case PoseGraph::Constraint::Tag::INTER_SUBMAP:
|
case PoseGraph::Constraint::Tag::INTER_SUBMAP:
|
||||||
return proto::SparsePoseGraph::Constraint::INTER_SUBMAP;
|
return proto::PoseGraph::Constraint::INTER_SUBMAP;
|
||||||
}
|
}
|
||||||
LOG(FATAL) << "Unsupported tag.";
|
LOG(FATAL) << "Unsupported tag.";
|
||||||
}
|
}
|
||||||
|
|
||||||
PoseGraph::Constraint::Tag FromProto(
|
PoseGraph::Constraint::Tag FromProto(
|
||||||
const proto::SparsePoseGraph::Constraint::Tag& proto) {
|
const proto::PoseGraph::Constraint::Tag& proto) {
|
||||||
switch (proto) {
|
switch (proto) {
|
||||||
case proto::SparsePoseGraph::Constraint::INTRA_SUBMAP:
|
case proto::PoseGraph::Constraint::INTRA_SUBMAP:
|
||||||
return PoseGraph::Constraint::Tag::INTRA_SUBMAP;
|
return PoseGraph::Constraint::Tag::INTRA_SUBMAP;
|
||||||
case proto::SparsePoseGraph::Constraint::INTER_SUBMAP:
|
case proto::PoseGraph::Constraint::INTER_SUBMAP:
|
||||||
return PoseGraph::Constraint::Tag::INTER_SUBMAP;
|
return PoseGraph::Constraint::Tag::INTER_SUBMAP;
|
||||||
case ::google::protobuf::kint32max:
|
case ::google::protobuf::kint32max:
|
||||||
case ::google::protobuf::kint32min:;
|
case ::google::protobuf::kint32min:;
|
||||||
|
@ -49,8 +49,8 @@ PoseGraph::Constraint::Tag FromProto(
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PoseGraph::Constraint> FromProto(
|
std::vector<PoseGraph::Constraint> FromProto(
|
||||||
const ::google::protobuf::RepeatedPtrField<
|
const ::google::protobuf::RepeatedPtrField<proto::PoseGraph::Constraint>&
|
||||||
proto::SparsePoseGraph::Constraint>& constraint_protos) {
|
constraint_protos) {
|
||||||
std::vector<PoseGraph::Constraint> constraints;
|
std::vector<PoseGraph::Constraint> constraints;
|
||||||
for (const auto& constraint_proto : constraint_protos) {
|
for (const auto& constraint_proto : constraint_protos) {
|
||||||
const mapping::SubmapId submap_id{
|
const mapping::SubmapId submap_id{
|
||||||
|
@ -96,8 +96,8 @@ proto::SparsePoseGraphOptions CreateSparsePoseGraphOptions(
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
proto::SparsePoseGraph PoseGraph::ToProto() {
|
proto::PoseGraph PoseGraph::ToProto() {
|
||||||
proto::SparsePoseGraph proto;
|
proto::PoseGraph proto;
|
||||||
|
|
||||||
std::map<int, proto::Trajectory* const> trajectory_protos;
|
std::map<int, proto::Trajectory* const> trajectory_protos;
|
||||||
const auto trajectory = [&proto, &trajectory_protos](
|
const auto trajectory = [&proto, &trajectory_protos](
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
#include "cartographer/common/lua_parameter_dictionary.h"
|
#include "cartographer/common/lua_parameter_dictionary.h"
|
||||||
#include "cartographer/mapping/id.h"
|
#include "cartographer/mapping/id.h"
|
||||||
#include "cartographer/mapping/pose_graph_trimmer.h"
|
#include "cartographer/mapping/pose_graph_trimmer.h"
|
||||||
|
#include "cartographer/mapping/proto/pose_graph.pb.h"
|
||||||
#include "cartographer/mapping/proto/serialization.pb.h"
|
#include "cartographer/mapping/proto/serialization.pb.h"
|
||||||
#include "cartographer/mapping/proto/sparse_pose_graph.pb.h"
|
|
||||||
#include "cartographer/mapping/proto/sparse_pose_graph_options.pb.h"
|
#include "cartographer/mapping/proto/sparse_pose_graph_options.pb.h"
|
||||||
#include "cartographer/mapping/submaps.h"
|
#include "cartographer/mapping/submaps.h"
|
||||||
#include "cartographer/mapping/trajectory_node.h"
|
#include "cartographer/mapping/trajectory_node.h"
|
||||||
|
@ -144,7 +144,7 @@ class PoseGraph {
|
||||||
virtual MapById<NodeId, TrajectoryNode> GetTrajectoryNodes() = 0;
|
virtual MapById<NodeId, TrajectoryNode> GetTrajectoryNodes() = 0;
|
||||||
|
|
||||||
// Serializes the constraints and trajectories.
|
// Serializes the constraints and trajectories.
|
||||||
proto::SparsePoseGraph ToProto();
|
proto::PoseGraph ToProto();
|
||||||
|
|
||||||
// Returns the IMU data.
|
// Returns the IMU data.
|
||||||
virtual sensor::MapByTime<sensor::ImuData> GetImuData() = 0;
|
virtual sensor::MapByTime<sensor::ImuData> GetImuData() = 0;
|
||||||
|
@ -165,7 +165,7 @@ class PoseGraph {
|
||||||
|
|
||||||
std::vector<PoseGraph::Constraint> FromProto(
|
std::vector<PoseGraph::Constraint> FromProto(
|
||||||
const ::google::protobuf::RepeatedPtrField<
|
const ::google::protobuf::RepeatedPtrField<
|
||||||
::cartographer::mapping::proto::SparsePoseGraph::Constraint>&
|
::cartographer::mapping::proto::PoseGraph::Constraint>&
|
||||||
constraint_protos);
|
constraint_protos);
|
||||||
|
|
||||||
} // namespace mapping
|
} // namespace mapping
|
||||||
|
|
|
@ -29,7 +29,7 @@ message NodeId {
|
||||||
int32 node_index = 2; // Node index in the given trajectory.
|
int32 node_index = 2; // Node index in the given trajectory.
|
||||||
}
|
}
|
||||||
|
|
||||||
message SparsePoseGraph {
|
message PoseGraph {
|
||||||
message Constraint {
|
message Constraint {
|
||||||
// Differentiates between intra-submap (where the range data was inserted
|
// Differentiates between intra-submap (where the range data was inserted
|
||||||
// into the submap) and inter-submap constraints (where the range data was
|
// into the submap) and inter-submap constraints (where the range data was
|
|
@ -16,7 +16,7 @@ syntax = "proto3";
|
||||||
|
|
||||||
package cartographer.mapping.proto;
|
package cartographer.mapping.proto;
|
||||||
|
|
||||||
import "cartographer/mapping/proto/sparse_pose_graph.proto";
|
import "cartographer/mapping/proto/pose_graph.proto";
|
||||||
import "cartographer/mapping/proto/submap.proto";
|
import "cartographer/mapping/proto/submap.proto";
|
||||||
import "cartographer/mapping/proto/trajectory_node_data.proto";
|
import "cartographer/mapping/proto/trajectory_node_data.proto";
|
||||||
import "cartographer/sensor/proto/sensor.proto";
|
import "cartographer/sensor/proto/sensor.proto";
|
||||||
|
|
Loading…
Reference in New Issue