42 Cal3_S2::shared_ptr
K_;
83 void print(
const std::string& s =
"InvDepthFactorVariant1",
91 const This *e =
dynamic_cast<const This*
>(&p);
95 && this->K_->equals(*e->
K_, tol);
98 Vector inverseDepthError(
const Pose3& pose,
const Vector6& landmark)
const {
101 double x = landmark(0), y = landmark(1), z = landmark(2);
102 double theta = landmark(3), phi = landmark(4), rho = landmark(5);
103 Point3 world_P_landmark =
Point3(x, y, z) +
Point3(cos(theta)*cos(phi)/rho, sin(theta)*cos(phi)/rho, sin(phi)/rho);
106 return camera.project(world_P_landmark) -
measured_;
107 }
catch( CheiralityException& e) {
108 std::cout << e.what()
112 return Vector::Ones(2) * 2.0 *
K_->fx();
114 return Vector{{0.0}};
124 std::bind(&InvDepthFactorVariant1::inverseDepthError,
this,
125 std::placeholders::_1, landmark),
130 std::bind(&InvDepthFactorVariant1::inverseDepthError,
this, pose,
131 std::placeholders::_1), landmark);
134 return inverseDepthError(pose, landmark);
149#if GTSAM_ENABLE_BOOST_SERIALIZATION
151 friend class boost::serialization::access;
152 template<
class ARCHIVE>
153 void serialize(ARCHIVE & ar,
const unsigned int ) {
154 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
156 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
~InvDepthFactorVariant1() override
Virtual destructor.
Definition InvDepthFactorVariant1.h:76
const Point2 & imagePoint() const
return the measurement
Definition InvDepthFactorVariant1.h:138
Vector2 evaluateError(const Pose3 &pose, const Vector6 &landmark, OptionalMatrixType H1, OptionalMatrixType H2) const override
Evaluate error h(x)-z and optionally derivatives.
Definition InvDepthFactorVariant1.h:118
InvDepthFactorVariant1(const Key poseKey, const Key landmarkKey, const Point2 &measured, const Cal3_S2::shared_ptr &K, const SharedNoiseModel &model)
Constructor.
Definition InvDepthFactorVariant1.h:71
void print(const std::string &s="InvDepthFactorVariant1", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition InvDepthFactorVariant1.h:83
InvDepthFactorVariant1()
Default constructor.
Definition InvDepthFactorVariant1.h:59
InvDepthFactorVariant1 This
shorthand for this class
Definition InvDepthFactorVariant1.h:53
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition InvDepthFactorVariant1.h:56
const Cal3_S2::shared_ptr calibration() const
return the calibration object
Definition InvDepthFactorVariant1.h:143
Cal3_S2::shared_ptr K_
shared pointer to calibration object
Definition InvDepthFactorVariant1.h:42
Point2 measured_
2D measurement
Definition InvDepthFactorVariant1.h:41
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition InvDepthFactorVariant1.h:90
NoiseModelFactorT< Vector2, Pose3, Vector6 > Base
shorthand for base class type
Definition InvDepthFactorVariant1.h:47