GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
DynamicsPriors.h
Go to the documentation of this file.
1 
10 #pragma once
11 
14 
15 namespace gtsam {
16 
17 // Indices of relevant variables in the PoseRTV tangent vector:
18 // [ rx ry rz tx ty tz vx vy vz ]
19 static const size_t kRollIndex = 0;
20 static const size_t kPitchIndex = 1;
21 static const size_t kHeightIndex = 5;
22 static const size_t kVelocityZIndex = 8;
23 static const std::vector<size_t> kVelocityIndices = { 6, 7, 8 };
24 
29 struct DHeightPrior : public gtsam::PartialPriorFactor<PoseRTV> {
31 
32  DHeightPrior(Key key, double height, const gtsam::SharedNoiseModel& model)
33  : Base(key, kHeightIndex, height, model) {}
34 };
35 
41 struct DRollPrior : public gtsam::PartialPriorFactor<PoseRTV> {
43 
45  DRollPrior(Key key, double wx, const gtsam::SharedNoiseModel& model)
46  : Base(key, kRollIndex, wx, model) { }
47 
50  : Base(key, kRollIndex, 0.0, model) { }
51 };
52 
58 struct VelocityPrior : public gtsam::PartialPriorFactor<PoseRTV> {
60 
61  VelocityPrior(Key key, const gtsam::Vector& vel, const gtsam::SharedNoiseModel& model)
62  : Base(key, kVelocityIndices, vel, model) {}
63 };
64 
70 struct DGroundConstraint : public gtsam::PartialPriorFactor<PoseRTV> {
72 
76  DGroundConstraint(Key key, double height, const gtsam::SharedNoiseModel& model)
77  : Base(key, { kHeightIndex, kVelocityZIndex, kRollIndex, kPitchIndex },
78  Vector::Unit(4, 0)*height, model) {}
79 
83  DGroundConstraint(Key key, const Vector& constraint, const gtsam::SharedNoiseModel& model)
84  : Base(key, { kHeightIndex, kVelocityZIndex, kRollIndex, kPitchIndex }, constraint, model) {
85  assert(constraint.size() == 4);
86  }
87 };
88 
89 } // \namespace gtsam
Definition: Factor.h:69
Definition: DynamicsPriors.h:29
Key key() const
Definition: NonlinearFactor.h:582
DRollPrior(Key key, const gtsam::SharedNoiseModel &model)
Definition: DynamicsPriors.h:49
DGroundConstraint(Key key, double height, const gtsam::SharedNoiseModel &model)
Definition: DynamicsPriors.h:76
A simple prior factor that allows for setting a prior only on a part of linear parameters.
DGroundConstraint(Key key, const Vector &constraint, const gtsam::SharedNoiseModel &model)
Definition: DynamicsPriors.h:83
Definition: DynamicsPriors.h:41
Pose3 with translational velocity.
Definition: chartTesting.h:28
DRollPrior(Key key, double wx, const gtsam::SharedNoiseModel &model)
Definition: DynamicsPriors.h:45
Definition: PartialPriorFactor.h:38
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
Definition: DynamicsPriors.h:58
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:741
Definition: DynamicsPriors.h:70