18 #ifndef FACTOR_ADDERS_POSE_FACTOR_ADDER_H_
19 #define FACTOR_ADDERS_POSE_FACTOR_ADDER_H_
26 #include <gtsam/linear/NoiseModel.h>
27 #include <gtsam/slam/PriorFactor.h>
34 template <
class PoseNodeAdderType>
43 gtsam::NonlinearFactorGraph& factors)
final;
48 std::shared_ptr<PoseNodeAdderType> node_adder_;
52 template <
class PoseNodeAdderType>
54 const std::shared_ptr<PoseNodeAdderType> node_adder)
57 node_adder_(node_adder) {}
59 template <
class PoseNodeAdderType>
62 node_adder_->AddNode(measurement.
timestamp, factors);
63 const auto keys = node_adder_->Keys(measurement.
timestamp);
65 const auto& pose_key = keys[0];
67 const gtsam::PriorFactor<gtsam::Pose3>::shared_ptr pose_prior_factor(
68 new gtsam::PriorFactor<gtsam::Pose3>(pose_key, measurement.
pose, pose_noise));
69 factors.push_back(pose_prior_factor);
73 template <
class PoseNodeAdderType>
74 bool PoseFactorAdder<PoseNodeAdderType>::CanAddFactor(
76 return node_adder_->CanAddNode(measurement.
timestamp);
80 #endif // FACTOR_ADDERS_POSE_FACTOR_ADDER_H_