VelocityConstraint3.h
Go to the documentation of this file.
1 
7 #pragma once
8 
10 
11 namespace gtsam {
12 
13 class VelocityConstraint3 : public NoiseModelFactorN<double, double, double> {
14 public:
15 
16 protected:
18 
21 
22  double dt_;
23 
24 public:
25 
26  // Provide access to the Matrix& version of evaluateError:
27  using Base::evaluateError;
28 
29  typedef std::shared_ptr<VelocityConstraint3 > shared_ptr;
30 
32  VelocityConstraint3(Key key1, Key key2, Key velKey, double dt, double mu = 1000.0)
33  : Base(noiseModel::Constrained::All(1, std::abs(mu)), key1, key2, velKey), dt_(dt) {}
34  ~VelocityConstraint3() override {}
35 
38  return std::static_pointer_cast<gtsam::NonlinearFactor>(
40 
42  Vector evaluateError(const double& x1, const double& x2, const double& v,
44  OptionalMatrixType H3) const override {
45  const size_t p = 1;
46  if (H1) *H1 = Matrix::Identity(p,p);
47  if (H2) *H2 = -Matrix::Identity(p,p);
48  if (H3) *H3 = Matrix::Identity(p,p)*dt_;
49  return (Vector(1) << x1+v*dt_-x2).finished();
50  }
51 
52 private:
53 
54 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
55 
56  friend class boost::serialization::access;
57  template<class ARCHIVE>
58  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
59  // NoiseModelFactor3 instead of NoiseModelFactorN for backward compatibility
60  ar & boost::serialization::make_nvp("NoiseModelFactor3",
61  boost::serialization::base_object<Base>(*this));
62  }
63 #endif
64 }; // \VelocityConstraint3
65 
66 }
std::string serialize(const T &input)
serializes to a string
double mu
virtual Vector evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Definition: BFloat16.h:88
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
Vector evaluateError(const double &x1, const double &x2, const double &v, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
const double dt
const SharedNoiseModel & noiseModel() const
access to the noise model
Matrix * OptionalMatrixType
std::shared_ptr< VelocityConstraint3 > shared_ptr
Eigen::VectorXd Vector
Definition: Vector.h:38
Array< int, Dynamic, 1 > v
traits
Definition: chartTesting.h:28
NoiseModelFactorN< double, double, double > Base
Non-linear factor base classes.
Pose3 x1
Definition: testPose3.cpp:663
std::shared_ptr< This > shared_ptr
float * p
gtsam::NonlinearFactor::shared_ptr clone() const override
#define abs(x)
Definition: datatypes.h:17
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
VelocityConstraint3(Key key1, Key key2, Key velKey, double dt, double mu=1000.0)
TODO: comment.


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:44