ConstantVelocityFactor.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
18 #pragma once
19 
22 
23 namespace gtsam {
24 
29 class ConstantVelocityFactor : public NoiseModelFactorN<NavState, NavState> {
30  double dt_;
31 
32  public:
33  using Base = NoiseModelFactor2<NavState, NavState>;
34 
35  // Provide access to the Matrix& version of evaluateError:
36  using Base::evaluateError;
37 
38  public:
42 
54  OptionalMatrixType H1, OptionalMatrixType H2) const override {
55  // only used to use update() below
56  static const Vector3 b_accel{0.0, 0.0, 0.0};
57  static const Vector3 b_omega{0.0, 0.0, 0.0};
58 
59  Matrix99 predicted_H_x1;
60  NavState predicted = x1.update(b_accel, b_omega, dt_, H1 ? &predicted_H_x1 : nullptr, {}, {});
61 
62  Matrix99 error_H_predicted;
63  Vector9 error = predicted.localCoordinates(x2, H1 ? &error_H_predicted : nullptr, H2);
64 
65  if (H1) {
66  *H1 = error_H_predicted * predicted_H_x1;
67  }
68  return error;
69  }
70 };
71 
72 } // namespace gtsam
gtsam::ConstantVelocityFactor::~ConstantVelocityFactor
~ConstantVelocityFactor() override
Definition: ConstantVelocityFactor.h:41
gtsam::ConstantVelocityFactor::dt_
double dt_
Definition: ConstantVelocityFactor.h:30
gtsam::NoiseModelFactor::error
double error(const Values &c) const override
Definition: NonlinearFactor.cpp:136
dt
const double dt
Definition: testVelocityConstraint.cpp:15
gtsam::NavState
Definition: NavState.h:34
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
gtsam::Vector
Eigen::VectorXd Vector
Definition: Vector.h:38
gtsam::ConstantVelocityFactor
Definition: ConstantVelocityFactor.h:29
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
x1
Pose3 x1
Definition: testPose3.cpp:663
NavState.h
Navigation state composing of attitude, position, and velocity.
gtsam::NoiseModelFactorN
Definition: NonlinearFactor.h:431
gtsam::SharedNoiseModel
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:762
gtsam::ConstantVelocityFactor::ConstantVelocityFactor
ConstantVelocityFactor(Key i, Key j, double dt, const SharedNoiseModel &model)
Definition: ConstantVelocityFactor.h:39
model
noiseModel::Diagonal::shared_ptr model
Definition: doc/Code/Pose2SLAMExample.cpp:7
NonlinearFactor.h
Non-linear factor base classes.
gtsam
traits
Definition: SFMdata.h:40
gtsam::OptionalMatrixType
Matrix * OptionalMatrixType
Definition: NonlinearFactor.h:55
gtsam::NavState::localCoordinates
Vector9 localCoordinates(const NavState &g, OptionalJacobian< 9, 9 > H1={}, OptionalJacobian< 9, 9 > H2={}) const
localCoordinates with optional derivatives
Definition: NavState.cpp:134
Base
Definition: test_virtual_functions.cpp:156
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:97
x2
Pose3 x2(Rot3::Ypr(0.0, 0.0, 0.0), l2)
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
gtsam::ConstantVelocityFactor::evaluateError
gtsam::Vector evaluateError(const NavState &x1, const NavState &x2, OptionalMatrixType H1, OptionalMatrixType H2) const override
Caclulate error: (x2 - x1.update(dt))) where X1 and X1 are NavStates and dt is the time difference in...
Definition: ConstantVelocityFactor.h:53


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:02