58 typedef typename boost::shared_ptr<GaussMarkov1stOrderFactor> shared_ptr;
65 const SharedGaussian& model) :
66 Base(calcDiscreteNoiseModel(model, delta_t),
key1, key2), dt_(delta_t), tau_(tau) {
74 virtual void print(
const std::string& s,
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const {
75 std::cout << s <<
"GaussMarkov1stOrderFactor(" 76 << keyFormatter(this->
key1()) <<
"," 77 << keyFormatter(this->key2()) <<
")\n";
78 this->noiseModel_->print(
" noise model");
83 const This *e = dynamic_cast<const This*> (&expected);
91 boost::optional<Matrix&> H1 = boost::none,
92 boost::optional<Matrix&> H2 = boost::none)
const {
97 Vector alpha(tau_.size());
98 Vector alpha_v1(tau_.size());
99 for(
int i=0; i<tau_.size(); i++){
100 alpha(i) = exp(- 1/tau_(i)*dt_ );
101 alpha_v1(i) = alpha(i) * v1(i);
104 Vector hx(v2 - alpha_v1);
106 if(H1) *H1 = -1 * alpha.asDiagonal();
107 if(H2) *H2 = Matrix::Identity(v2.size(),v2.size());
116 template<
class ARCHIVE>
117 void serialize(ARCHIVE & ar,
const unsigned int ) {
118 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
119 ar & BOOST_SERIALIZATION_NVP(dt_);
120 ar & BOOST_SERIALIZATION_NVP(tau_);
123 SharedGaussian calcDiscreteNoiseModel(
const SharedGaussian& model,
double delta_t){
128 noiseModel::Gaussian::shared_ptr gaussian_model = boost::dynamic_pointer_cast<noiseModel::Gaussian>(model);
137 public Testable<GaussMarkov1stOrderFactor<VALUE> > {
This is the base class for all factor types.
Definition: Factor.h:54
A convenient base class for creating your own NoiseModelFactor with 2 variables.
Definition: NonlinearFactor.h:345
GaussMarkov1stOrderFactor(const Key &key1, const Key &key2, double delta_t, Vector tau, const SharedGaussian &model)
Constructor.
Definition: GaussMarkov1stOrderFactor.h:64
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
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:81
GaussMarkov1stOrderFactor()
default constructor - only use for serialization
Definition: GaussMarkov1stOrderFactor.h:61
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
Definition: GaussMarkov1stOrderFactor.h:45
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
virtual void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
implement functions needed for Testable
Definition: GaussMarkov1stOrderFactor.h:74
Key key1() const
methods to retrieve both keys
Definition: NonlinearFactor.h:377
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Non-linear factor base classes.
A factor with a quadratic error function - a Gaussian.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Concept check for values that can be used in unit tests.
Vector evaluateError(const VALUE &p1, const VALUE &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
implement functions needed to derive from Factor
Definition: GaussMarkov1stOrderFactor.h:90
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.cpp:71
Base class and basic functions for Lie types.
friend class boost::serialization::access
Serialization function.
Definition: GaussMarkov1stOrderFactor.h:115
virtual bool equals(const NonlinearFactor &expected, double tol=1e-9) const
equals
Definition: GaussMarkov1stOrderFactor.h:82