26template<
class POSE,
class LANDMARK,
class INVDEPTH>
32 boost::shared_ptr<Cal3_S2>
K_;
61 const Key poseKey,
Key pointKey,
Key invDepthKey,
const Cal3_S2::shared_ptr& K) :
62 Base(model, poseKey, pointKey, invDepthKey),
measured_(measured),
K_(K) {}
72 void print(
const std::string& s =
"InvDepthFactor3",
73 const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
80 const This *e =
dynamic_cast<const This*
>(&p);
85 Vector
evaluateError(
const POSE& pose,
const Vector5& point,
const INVDEPTH& invDepth,
86 boost::optional<Matrix&> H1=boost::none,
87 boost::optional<Matrix&> H2=boost::none,
88 boost::optional<Matrix&> H3=boost::none)
const override {
93 if (H1) *H1 = Matrix::Zero(2,6);
94 if (H2) *H2 = Matrix::Zero(2,5);
95 if (H3) *H3 = Matrix::Zero(2,1);
96 std::cout << e.what() <<
": Landmark "<< DefaultKeyFormatter(this->key2()) <<
97 " moved behind camera " << DefaultKeyFormatter(this->key1()) << std::endl;
98 return Vector::Ones(2) * 2.0 *
K_->fx();
100 return (Vector(1) << 0.0).finished();
117 template<
class ARCHIVE>
118 void serialize(ARCHIVE & ar,
const unsigned int ) {
119 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
121 ar & BOOST_SERIALIZATION_NVP(
K_);
The most common 5DOF 3D->2D calibration.
Non-linear factor base classes.
Inverse Depth Camera based on Civera09tro, Montiel06rss.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Vector2 Point2
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point2 to Vector2...
Definition Point2.h:27
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
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:724
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:100
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
The most common 5DOF 3D->2D calibration.
Definition Cal3_S2.h:34
Definition CalibratedCamera.h:32
virtual void print(const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
print
Definition Factor.cpp:29
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
Nonlinear factor base class.
Definition NonlinearFactor.h:42
NoiseModelFactorN()
Definition NonlinearFactor.h:469
A pinhole camera class that has a Pose3 and a Calibration.
Definition InvDepthCamera3.h:31
gtsam::Point2 project(const Vector5 &pw, double rho, boost::optional< gtsam::Matrix & > H1=boost::none, boost::optional< gtsam::Matrix & > H2=boost::none, boost::optional< gtsam::Matrix & > H3=boost::none) const
project a point from world InvDepth parameterization to the image
Definition InvDepthCamera3.h:84
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition InvDepthFactor3.h:79
boost::shared_ptr< Cal3_S2 > K_
shared pointer to calibration object
Definition InvDepthFactor3.h:32
void print(const std::string &s="InvDepthFactor3", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition InvDepthFactor3.h:72
const Point2 & imagePoint() const
return the measurement
Definition InvDepthFactor3.h:104
boost::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition InvDepthFactor3.h:43
Vector evaluateError(const POSE &pose, const Vector5 &point, const INVDEPTH &invDepth, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none, boost::optional< Matrix & > H3=boost::none) const override
Evaluate error h(x)-z and optionally derivatives.
Definition InvDepthFactor3.h:85
InvDepthFactor3< POSE, LANDMARK, INVDEPTH > This
shorthand for this class
Definition InvDepthFactor3.h:40
InvDepthFactor3(const Point2 &measured, const SharedNoiseModel &model, const Key poseKey, Key pointKey, Key invDepthKey, const Cal3_S2::shared_ptr &K)
Constructor TODO: Mark argument order standard (keys, measurement, parameters).
Definition InvDepthFactor3.h:60
NoiseModelFactorN< POSE, LANDMARK, INVDEPTH > Base
shorthand for base class type
Definition InvDepthFactor3.h:37
Point2 measured_
2D measurement
Definition InvDepthFactor3.h:31
const Cal3_S2::shared_ptr calibration() const
return the calibration object
Definition InvDepthFactor3.h:109
friend class boost::serialization::access
Serialization function.
Definition InvDepthFactor3.h:116
InvDepthFactor3()
Default constructor.
Definition InvDepthFactor3.h:46
~InvDepthFactor3() override
Virtual destructor.
Definition InvDepthFactor3.h:65