66 typedef typename std::shared_ptr<GaussMarkov1stOrderFactor> shared_ptr;
73 const SharedGaussian& model) :
74 Base(calcDiscreteNoiseModel(model, delta_t), key1, key2), dt_(delta_t), tau_(tau) {
83 std::cout << s <<
"GaussMarkov1stOrderFactor("
84 << keyFormatter(this->key1()) <<
","
85 << keyFormatter(this->key2()) <<
")\n";
86 this->noiseModel_->print(
" noise model");
91 const This *e =
dynamic_cast<const This*
> (&expected);
105 Vector alpha(tau_.size());
106 Vector alpha_v1(tau_.size());
107 for(
int i=0; i<tau_.size(); i++){
108 alpha(i) = exp(- 1/tau_(i)*dt_ );
109 alpha_v1(i) = alpha(i) * v1(i);
112 Vector hx(v2 - alpha_v1);
114 if(H1) *H1 = -1 * alpha.asDiagonal();
115 if(H2) *H2 = Matrix::Identity(v2.size(),v2.size());
122#if GTSAM_ENABLE_BOOST_SERIALIZATION
124 friend class boost::serialization::access;
125 template<
class ARCHIVE>
126 void serialize(ARCHIVE & ar,
const unsigned int ) {
127 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
128 ar & BOOST_SERIALIZATION_NVP(dt_);
129 ar & BOOST_SERIALIZATION_NVP(tau_);
133 SharedGaussian calcDiscreteNoiseModel(
const SharedGaussian& model,
double delta_t){
138 noiseModel::Gaussian::shared_ptr gaussian_model = std::dynamic_pointer_cast<noiseModel::Gaussian>(model);
147 public Testable<GaussMarkov1stOrderFactor<VALUE> > {
Concept check for values that can be used in unit tests.
Base class and basic functions for Lie types.
A factor with a quadratic error function - a Gaussian.
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
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
static shared_ptr SqrtInformation(const Matrix &R, bool smart=true)
A Gaussian noise model created by specifying a square root information matrix.
Definition NoiseModel.cpp:85
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual OutputVec evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const =0
Override evaluateError to finish implementing an n-way factor.
Nonlinear factor base class.
Definition NonlinearFactor.h:70
Definition GaussMarkov1stOrderFactor.h:48
GaussMarkov1stOrderFactor()
default constructor - only use for serialization
Definition GaussMarkov1stOrderFactor.h:69
GaussMarkov1stOrderFactor(const Key &key1, const Key &key2, double delta_t, Vector tau, const SharedGaussian &model)
Constructor.
Definition GaussMarkov1stOrderFactor.h:72
ErrorVector evaluateError(const VALUE &p1, const VALUE &p2, OptionalMatrixType H1, OptionalMatrixType H2) const override
implement functions needed to derive from Factor
Definition GaussMarkov1stOrderFactor.h:98
void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
implement functions needed for Testable
Definition GaussMarkov1stOrderFactor.h:82
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
equals
Definition GaussMarkov1stOrderFactor.h:90