43 Cal3_S2::shared_ptr
K_;
86 void print(
const std::string& s =
"InvDepthFactorVariant2",
94 const This *e =
dynamic_cast<const This*
>(&p);
98 && this->K_->equals(*e->
K_, tol)
102 Vector inverseDepthError(
const Pose3& pose,
const Vector3& landmark)
const {
105 double theta = landmark(0), phi = landmark(1), rho = landmark(2);
109 return camera.project(world_P_landmark) -
measured_;
110 }
catch( CheiralityException& e) {
111 std::cout << e.what()
115 return Vector::Ones(2) * 2.0 *
K_->fx();
117 return Vector{{0.0}};
127 std::bind(&InvDepthFactorVariant2::inverseDepthError,
this,
128 std::placeholders::_1, landmark), pose);
132 std::bind(&InvDepthFactorVariant2::inverseDepthError,
this, pose,
133 std::placeholders::_1), landmark);
136 return inverseDepthError(pose, landmark);
156#if GTSAM_ENABLE_BOOST_SERIALIZATION
158 friend class boost::serialization::access;
159 template<
class ARCHIVE>
160 void serialize(ARCHIVE & ar,
const unsigned int ) {
161 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
163 ar & BOOST_SERIALIZATION_NVP(
K_);
Numerical derivative helpers for manifold-valued functions.
The most common 5DOF 3D->2D calibration.
Base class for all pinhole cameras.
3D Pose manifold SO(3) x R^3 and group SE(3)
Base class for noise model factors with N variables.
Non-linear factor base classes.
internal::MatrixMN< traits< internal::OutputType< Y, F, X > >::dimension, N >::type numericalDerivative11(F &&h, const X &x, double delta=1e-5)
New-style numerical derivatives using manifold_traits.
Definition numericalDerivative.h:180
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
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
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:32
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:846
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
The most common 5DOF 3D->2D calibration.
Definition Cal3_S2.h:35
A pinhole camera class that has a Pose3 and a Calibration.
Definition PinholeCamera.h:34
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
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
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual Vector2 evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Key key() const
Definition NoiseModelFactorN.h:307
Nonlinear factor base class.
Definition NonlinearFactor.h:70
Cal3_S2::shared_ptr K_
shared pointer to calibration object
Definition InvDepthFactorVariant2.h:43
const Point2 & imagePoint() const
return the measurement
Definition InvDepthFactorVariant2.h:140
Point3 referencePoint_
the reference point/origin for this landmark
Definition InvDepthFactorVariant2.h:44
InvDepthFactorVariant2()
Default constructor.
Definition InvDepthFactorVariant2.h:61
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition InvDepthFactorVariant2.h:93
~InvDepthFactorVariant2() override
Virtual destructor.
Definition InvDepthFactorVariant2.h:79
const Cal3_S2::shared_ptr calibration() const
return the calibration object
Definition InvDepthFactorVariant2.h:145
const Point3 & referencePoint() const
return the calibration object
Definition InvDepthFactorVariant2.h:150
void print(const std::string &s="InvDepthFactorVariant2", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition InvDepthFactorVariant2.h:86
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition InvDepthFactorVariant2.h:58
NoiseModelFactorT< Vector2, Pose3, Vector3 > Base
shorthand for base class type
Definition InvDepthFactorVariant2.h:49
InvDepthFactorVariant2(const Key poseKey, const Key landmarkKey, const Point2 &measured, const Cal3_S2::shared_ptr &K, const Point3 referencePoint, const SharedNoiseModel &model)
Constructor.
Definition InvDepthFactorVariant2.h:73
Vector2 evaluateError(const Pose3 &pose, const Vector3 &landmark, OptionalMatrixType H1, OptionalMatrixType H2) const override
Evaluate error h(x)-z and optionally derivatives.
Definition InvDepthFactorVariant2.h:121
Point2 measured_
2D measurement
Definition InvDepthFactorVariant2.h:42
InvDepthFactorVariant2 This
shorthand for this class
Definition InvDepthFactorVariant2.h:55