gtsam/cpp/Point2Prior.h

25 lines
567 B
C
Raw Normal View History

2009-08-22 06:23:24 +08:00
// Frank Dellaert
// Simulated2D Prior
#include "NonlinearFactor.h"
#include "simulated2D.h"
2010-01-14 06:25:03 +08:00
namespace simulated2D {
2009-08-22 06:23:24 +08:00
2010-01-14 06:25:03 +08:00
struct Point2Prior: public gtsam::NonlinearFactor1<VectorConfig, std::string, Vector> {
Vector z_;
Point2Prior(const Vector& z, double sigma, const std::string& key) :
gtsam::NonlinearFactor1<VectorConfig, std::string, Vector>(sigma, key), z_(z) {
}
2010-01-14 06:25:03 +08:00
Vector evaluateError(const Vector& x, boost::optional<Matrix&> H = boost::none) const {
if (H) *H = Dprior(x);
return prior(x) - z_;
}
};
2009-08-22 06:23:24 +08:00
2010-01-14 06:25:03 +08:00
} // namespace simulated2D