20#include <gtsam/config.h>
22#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
33class VelocityConstraint3
38 typedef NoiseModelFactorT<Vector1, double, double, double> Base;
41 VelocityConstraint3() {}
48 using Base::evaluateError;
50 typedef std::shared_ptr<VelocityConstraint3 > shared_ptr;
53 VelocityConstraint3(Key key1, Key key2, Key velKey,
double dt,
double mu = 1000.0)
54 : Base(noiseModel::Constrained::All(1, std::abs(mu)), key1, key2, velKey), dt_(dt) {}
55 ~VelocityConstraint3()
override {}
58 gtsam::NonlinearFactor::shared_ptr clone()
const override {
59 return std::static_pointer_cast<gtsam::NonlinearFactor>(
60 gtsam::NonlinearFactor::shared_ptr(
new VelocityConstraint3(*
this))); }
63 Vector1 evaluateError(
const double& x1,
const double& x2,
const double& v,
64 OptionalMatrixType H1, OptionalMatrixType H2,
65 OptionalMatrixType H3)
const override {
67 if (H1) *H1 = Matrix::Identity(p,p);
68 if (H2) *H2 = -Matrix::Identity(p,p);
69 if (H3) *H3 = Matrix::Identity(p,p)*dt_;
70 return Vector{{x1 + v * dt_ - x2}};
75#if GTSAM_ENABLE_BOOST_SERIALIZATION
77 friend class boost::serialization::access;
78 template<
class ARCHIVE>
79 void serialize(ARCHIVE & ar,
const unsigned int ) {
81 ar & boost::serialization::make_nvp(
"NoiseModelFactor3",
82 boost::serialization::base_object<Base>(*
this));
Base class for noise model factors with N variables.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
A convenient base class for creating your own NoiseModelFactor with n variables.
Definition NoiseModelFactorN.h:155