34 template<
class POSE,
class LANDMARK,
class CALIBRATION = Cal3_S2>
40 std::shared_ptr<CALIBRATION>
K_;
73 KeySet poseKeys,
Key pointKey,
const std::shared_ptr<CALIBRATION>& K,
74 std::optional<POSE> body_P_sensor = {}) :
77 keys_.assign(poseKeys.begin(), poseKeys.end());
78 keys_.push_back(pointKey);
94 KeySet poseKeys,
Key pointKey,
const std::shared_ptr<CALIBRATION>& K,
96 std::optional<POSE> body_P_sensor = {}) :
104 NonlinearFactor::shared_ptr
clone()
const override {
105 return std::static_pointer_cast<NonlinearFactor>(
106 NonlinearFactor::shared_ptr(
new This(*
this))); }
114 std::cout << s <<
"MultiProjectionFactor, z = ";
115 std::cout <<
measured_ <<
"measurements, z = ";
116 if(this->body_P_sensor_)
117 this->body_P_sensor_->print(
" sensor pose in body frame: ");
123 const This *e =
dynamic_cast<const This*
>(&p);
127 && this->K_->equals(*e->
K_, tol)
166 Vector evaluateError(
const Pose3& pose,
const Point3& point,
175 return reprojectionError;
179 return reprojectionError;
182 PinholeCamera<CALIBRATION> camera(pose, *
K_);
184 return reprojectionError;
186 }
catch( CheiralityException& e) {
187 if (H1) *H1 = Matrix::Zero(2,6);
188 if (H2) *H2 = Matrix::Zero(2,3);
195 return Vector::Ones(2) * 2.0 *
K_->fx();
216#if GTSAM_ENABLE_BOOST_SERIALIZATION
218 friend class boost::serialization::access;
219 template<
class ARCHIVE>
220 void serialize(ARCHIVE & ar,
const unsigned int ) {
221 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(
Base);
223 ar & BOOST_SERIALIZATION_NVP(
K_);
The most common 5DOF 3D->2D calibration.
Base class for all pinhole cameras.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
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
std::vector< Matrix > * OptionalMatrixVecType
The OptionalMatrixVecType is a pointer to a vector of matrices.
Definition NonlinearFactor.h:63
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
KeyVector keys_
The keys involved in this factor.
Definition Factor.h:88
Nonlinear factor base class.
Definition NonlinearFactor.h:70
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Print.
Definition NonlinearFactor.cpp:82
bool equals(const NonlinearFactor &f, double tol=1e-9) const override
Check if two factors are equal.
Definition NonlinearFactor.cpp:90
NoiseModelFactor()
Default constructor for I/O only.
Definition NonlinearFactor.h:223
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65
const std::shared_ptr< CALIBRATION > calibration() const
return the calibration object
Definition MultiProjectionFactor.h:204
NonlinearFactor::shared_ptr clone() const override
Definition MultiProjectionFactor.h:104
bool throwCheirality() const
Definition MultiProjectionFactor.h:212
MultiProjectionFactor< POSE, LANDMARK, CALIBRATION > This
shorthand for this class
Definition MultiProjectionFactor.h:54
MultiProjectionFactor()
Default constructor.
Definition MultiProjectionFactor.h:60
std::shared_ptr< This > shared_ptr
Definition MultiProjectionFactor.h:57
std::optional< POSE > body_P_sensor_
Definition MultiProjectionFactor.h:41
std::shared_ptr< CALIBRATION > K_
Definition MultiProjectionFactor.h:40
~MultiProjectionFactor() override
Virtual destructor.
Definition MultiProjectionFactor.h:101
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition MultiProjectionFactor.h:113
bool throwCheirality_
Definition MultiProjectionFactor.h:45
NoiseModelFactor Base
shorthand for base class type
Definition MultiProjectionFactor.h:51
bool equals(const NonlinearFactor &p, double tol=1e-9) const override
equals
Definition MultiProjectionFactor.h:122
bool verboseCheirality_
Definition MultiProjectionFactor.h:46
Vector unwhitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const override
Evaluate error h(x)-z and optionally derivatives.
Definition MultiProjectionFactor.h:132
bool verboseCheirality() const
Definition MultiProjectionFactor.h:209
const Vector & measured() const
Definition MultiProjectionFactor.h:199
MultiProjectionFactor(const Vector &measured, const SharedNoiseModel &model, KeySet poseKeys, Key pointKey, const std::shared_ptr< CALIBRATION > &K, bool throwCheirality, bool verboseCheirality, std::optional< POSE > body_P_sensor={})
Constructor with exception-handling flags TODO: Mark argument order standard (keys,...
Definition MultiProjectionFactor.h:93
Vector measured_
Definition MultiProjectionFactor.h:39
MultiProjectionFactor(const Vector &measured, const SharedNoiseModel &model, KeySet poseKeys, Key pointKey, const std::shared_ptr< CALIBRATION > &K, std::optional< POSE > body_P_sensor={})
Constructor TODO: Mark argument order standard (keys, measurement, parameters).
Definition MultiProjectionFactor.h:72