[GenericPoseGraph] Add a helper func to add PoseGraphData. (#1443)
parent
de4886ea4e
commit
ccc25862bf
|
@ -19,6 +19,16 @@
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
namespace pose_graph {
|
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) {
|
void PoseGraphController::AddNode(const proto::Node& node) {
|
||||||
absl::MutexLock locker(&mutex_);
|
absl::MutexLock locker(&mutex_);
|
||||||
AddNodeToPoseGraphData(node, &data_);
|
AddNodeToPoseGraphData(node, &data_);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "absl/synchronization/mutex.h"
|
#include "absl/synchronization/mutex.h"
|
||||||
#include "cartographer/pose_graph/pose_graph_data.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"
|
#include "cartographer/pose_graph/solver/solver.h"
|
||||||
|
|
||||||
namespace cartographer {
|
namespace cartographer {
|
||||||
|
@ -32,6 +33,7 @@ class PoseGraphController {
|
||||||
PoseGraphController(const PoseGraphController&) = delete;
|
PoseGraphController(const PoseGraphController&) = delete;
|
||||||
PoseGraphController& operator=(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 AddNode(const proto::Node& node) LOCKS_EXCLUDED(mutex_);
|
||||||
void AddConstraint(const proto::Constraint& constraint)
|
void AddConstraint(const proto::Constraint& constraint)
|
||||||
LOCKS_EXCLUDED(mutex_);
|
LOCKS_EXCLUDED(mutex_);
|
||||||
|
|
Loading…
Reference in New Issue