45 class PlanarProjectionFactorBase {
47 PlanarProjectionFactorBase() {}
73 OptionalJacobian<2, 6> HbTc = {},
74 OptionalJacobian<2, 9> Hcalib = {}
76#ifndef GTSAM_THROW_CHEIRALITY_EXCEPTION
81 Pose3 wTc =
Pose3::FromPose2(wTb, HwTb ? &Hp :
nullptr).compose(bTc, HwTb ? &H0 :
nullptr);
82 PinholeCamera<Cal3DS2> camera = PinholeCamera<Cal3DS2>(wTc, calib);
86 Point2 result = camera.project(landmark, Dpose, Hlandmark, Hcalib);
90 *HwTb = Dpose * H0 * Hp;
93 return camera.project(landmark, {}, {}, {});
95#ifndef GTSAM_THROW_CHEIRALITY_EXCEPTION
96 }
catch (CheiralityException& e) {
97 std::cout <<
"****** CHIRALITY EXCEPTION ******\n";
98 if (Hlandmark) Hlandmark->setZero();
99 if (HwTb) HwTb->setZero();
100 if (HbTc) HbTc->setZero();
101 if (Hcalib) Hcalib->setZero();
103 return Matrix::Constant(2, 1, 2.0 * calib.
fx());
118 class PlanarProjectionFactor1
123 PlanarProjectionFactor1() {}
125 ~PlanarProjectionFactor1()
override {}
128 NonlinearFactor::shared_ptr
clone()
const override {
129 return std::static_pointer_cast<NonlinearFactor>(
130 NonlinearFactor::shared_ptr(
new PlanarProjectionFactor1(*
this)));
161 return predict(landmark_, wTb, bTc_, calib_, {}, HwTb, {}, {}) - measured_;
172 public Testable<PlanarProjectionFactor1> {};
180 class PlanarProjectionFactor2
181 :
public PlanarProjectionFactorBase,
187 PlanarProjectionFactor2() {}
189 ~PlanarProjectionFactor2()
override {}
192 NonlinearFactor::shared_ptr
clone()
const override {
193 return std::static_pointer_cast<NonlinearFactor>(
194 NonlinearFactor::shared_ptr(
new PlanarProjectionFactor2(*
this)));
214 Base(model, poseKey, landmarkKey),
229 return predict(landmark, wTb, bTc_, calib_, Hlandmark, HwTb, {}, {}) - measured_;
239 public Testable<PlanarProjectionFactor2> {};
247 class PlanarProjectionFactor3
248 :
public PlanarProjectionFactorBase,
254 PlanarProjectionFactor3() {}
256 ~PlanarProjectionFactor3()
override {}
259 NonlinearFactor::shared_ptr
clone()
const override {
260 return std::static_pointer_cast<NonlinearFactor>(
261 NonlinearFactor::shared_ptr(
new PlanarProjectionFactor3(*
this)));
277 Base(model, poseKey, offsetKey, calibKey),
278 landmark_(landmark) {}
295 return predict(landmark_, wTb, bTc, calib, {}, HwTb, HbTc, Hcalib) - measured_;
304 public Testable<PlanarProjectionFactor3> {};
Concept check for values that can be used in unit tests.
Base class and basic functions for Lie types.
Base class for all pinhole cameras.
3D Pose manifold SO(3) x R^3 and group SE(3)
Calibration of a camera with radial distortion, calculations in base class Cal3DS2_Base.
3D rotation represented as a rotation matrix or quaternion
Base class for noise model factors with N variables.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
NoiseModelFactorT< Vector, ValueTypes... > NoiseModelFactorN
Noise model factor with N value types and dynamic-sized error vector.
Definition NoiseModelFactorN.h:561
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
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
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
double fx() const
focal length x
Definition Cal3.h:138
Calibration of a camera with radial distortion that also supports Lie-group behaviors for optimizatio...
Definition Cal3DS2.h:35
A 2D pose (Point2,Rot2).
Definition Pose2.h:39
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
static Pose3 FromPose2(const Pose2 &p, OptionalJacobian< 6, 3 > H={})
Construct from Pose2 in the xy plane, with derivative.
Definition Pose3.cpp:55
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual Vector evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Camera projection for robot on the floor.
Definition PlanarProjectionFactor.h:45
PlanarProjectionFactorBase(const Point2 &measured)
Definition PlanarProjectionFactor.h:52
Point2 predict(const Point3 &landmark, const Pose2 &wTb, const Pose3 &bTc, const Cal3DS2 &calib, OptionalJacobian< 2, 3 > Hlandmark={}, OptionalJacobian< 2, 3 > HwTb={}, OptionalJacobian< 2, 6 > HbTc={}, OptionalJacobian< 2, 9 > Hcalib={}) const
Predict the projection of the landmark in camera pixels.
Definition PlanarProjectionFactor.h:66
One variable: the pose.
Definition PlanarProjectionFactor.h:119
Vector evaluateError(const Pose2 &wTb, OptionalMatrixType HwTb) const override
Definition PlanarProjectionFactor.h:160
NonlinearFactor::shared_ptr clone() const override
Definition PlanarProjectionFactor.h:128
PlanarProjectionFactor1(Key poseKey, const Point3 &landmark, const Point2 &measured, const Pose3 &bTc, const Cal3DS2 &calib, const SharedNoiseModel &model={})
constructor for known landmark, offset, and calibration
Definition PlanarProjectionFactor.h:143
Two unknowns: the pose and the landmark.
Definition PlanarProjectionFactor.h:182
NonlinearFactor::shared_ptr clone() const override
Definition PlanarProjectionFactor.h:192
PlanarProjectionFactor2(Key poseKey, Key landmarkKey, const Point2 &measured, const Pose3 &bTc, const Cal3DS2 &calib, const SharedNoiseModel &model={})
constructor for variable landmark, known offset and calibration
Definition PlanarProjectionFactor.h:206
Vector2 evaluateError(const Pose2 &wTb, const Point3 &landmark, OptionalMatrixType HwTb, OptionalMatrixType Hlandmark) const override
Definition PlanarProjectionFactor.h:224
Three unknowns: the pose, the camera offset, and the camera calibration.
Definition PlanarProjectionFactor.h:249
NonlinearFactor::shared_ptr clone() const override
Definition PlanarProjectionFactor.h:259
PlanarProjectionFactor3(Key poseKey, Key offsetKey, Key calibKey, const Point3 &landmark, const Point2 &measured, const SharedNoiseModel &model={})
constructor for variable pose, offset, and calibration, known landmark.
Definition PlanarProjectionFactor.h:273
Vector2 evaluateError(const Pose2 &wTb, const Pose3 &bTc, const Cal3DS2 &calib, OptionalMatrixType HwTb, OptionalMatrixType HbTc, OptionalMatrixType Hcalib) const override
Definition PlanarProjectionFactor.h:288