[GenericPoseGraph] Add a helper func to add PoseGraphData. (#1443)

master
Alexander Belyaev 2018-10-10 13:38:58 +02:00 committed by GitHub
parent de4886ea4e
commit ccc25862bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,16 @@
namespace cartographer {
namespace pose_graph {
void PoseGraphController::AddData(const proto::PoseGraphData& data) {
absl::MutexLock locker(&mutex_);
for (const auto& node : data.nodes()) {
AddNodeToPoseGraphData(node, &data_);
}
for (const auto& constraint : data.constraints()) {
AddConstraintToPoseGraphData(constraint, &data_);
}
}
void PoseGraphController::AddNode(const proto::Node& node) {
absl::MutexLock locker(&mutex_);
AddNodeToPoseGraphData(node, &data_);

View File

@ -19,6 +19,7 @@
#include "absl/synchronization/mutex.h"
#include "cartographer/pose_graph/pose_graph_data.h"
#include "cartographer/pose_graph/proto/pose_graph_data.pb.h"
#include "cartographer/pose_graph/solver/solver.h"
namespace cartographer {
@ -32,6 +33,7 @@ class PoseGraphController {
PoseGraphController(const PoseGraphController&) = delete;
PoseGraphController& operator=(const PoseGraphController&) = delete;
void AddData(const proto::PoseGraphData& data) LOCKS_EXCLUDED(mutex_);
void AddNode(const proto::Node& node) LOCKS_EXCLUDED(mutex_);
void AddConstraint(const proto::Constraint& constraint)
LOCKS_EXCLUDED(mutex_);