gtsam 4.1.1
gtsam
gtsam::SmartStereoProjectionPoseFactor Class Reference
+ Inheritance diagram for gtsam::SmartStereoProjectionPoseFactor:

Public Member Functions

 SmartStereoProjectionPoseFactor (const SharedNoiseModel &sharedNoiseModel, const SmartStereoProjectionParams &params=SmartStereoProjectionParams(), const boost::optional< Pose3 > &body_P_sensor=boost::none)
 Constructor. More...
 
 ~SmartStereoProjectionPoseFactor () override=default
 Virtual destructor.
 
void add (const StereoPoint2 &measured, const Key &poseKey, const boost::shared_ptr< Cal3_S2Stereo > &K)
 add a new measurement and pose key More...
 
void add (const std::vector< StereoPoint2 > &measurements, const KeyVector &poseKeys, const std::vector< boost::shared_ptr< Cal3_S2Stereo > > &Ks)
 Variant of the previous one in which we include a set of measurements. More...
 
void add (const std::vector< StereoPoint2 > &measurements, const KeyVector &poseKeys, const boost::shared_ptr< Cal3_S2Stereo > &K)
 Variant of the previous one in which we include a set of measurements with the same noise and calibration. More...
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
double error (const Values &values) const override
 error calculates the error of the factor. More...
 
std::vector< boost::shared_ptr< Cal3_S2Stereo > > calibration () const
 return the calibration object
 
Base::Cameras cameras (const Values &values) const override
 Collect all cameras involved in this factor. More...
 
- Public Member Functions inherited from gtsam::SmartStereoProjectionFactor
 SmartStereoProjectionFactor (const SharedNoiseModel &sharedNoiseModel, const SmartStereoProjectionParams &params=SmartStereoProjectionParams(), const boost::optional< Pose3 > body_P_sensor=boost::none)
 Constructor. More...
 
 ~SmartStereoProjectionFactor () override
 Virtual destructor.
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
bool decideIfTriangulate (const Cameras &cameras) const
 Check if the new linearization point_ is the same as the one used for previous triangulation.
 
TriangulationResult triangulateSafe (const Cameras &cameras) const
 triangulateSafe
 
bool triangulateForLinearize (const Cameras &cameras) const
 triangulate
 
boost::shared_ptr< RegularHessianFactor< Base::Dim > > createHessianFactor (const Cameras &cameras, const double lambda=0.0, bool diagonalDamping=false) const
 linearize returns a Hessianfactor that is an approximation of error(p)
 
boost::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, double lambda) const
 different (faster) way to compute Jacobian factor
 
boost::shared_ptr< GaussianFactorlinearizeDamped (const Cameras &cameras, const double lambda=0.0) const
 Linearize to Gaussian Factor. More...
 
boost::shared_ptr< GaussianFactorlinearizeDamped (const Values &values, const double lambda=0.0) const
 Linearize to Gaussian Factor. More...
 
boost::shared_ptr< GaussianFactorlinearize (const Values &values) const override
 linearize More...
 
bool triangulateAndComputeE (Matrix &E, const Cameras &cameras) const
 Triangulate and compute derivative of error with respect to point. More...
 
bool triangulateAndComputeE (Matrix &E, const Values &values) const
 Triangulate and compute derivative of error with respect to point. More...
 
void computeJacobiansWithTriangulatedPoint (FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras) const
 Compute F, E only (called below in both vanilla and SVD versions) Assumes the point has been computed Note E can be 2m*3 or 2m*2, in case point is degenerate.
 
bool triangulateAndComputeJacobians (FBlocks &Fs, Matrix &E, Vector &b, const Values &values) const
 Version that takes values, and creates the point.
 
bool triangulateAndComputeJacobiansSVD (FBlocks &Fs, Matrix &Enull, Vector &b, const Values &values) const
 takes values
 
Vector reprojectionErrorAfterTriangulation (const Values &values) const
 Calculate vector of re-projection errors, before applying noise model.
 
double totalReprojectionError (const Cameras &cameras, boost::optional< Point3 > externalPoint=boost::none) const
 Calculate the error of the factor. More...
 
double error (const Values &values) const override
 Calculate total reprojection error. More...
 
void correctForMissingMeasurements (const Cameras &cameras, Vector &ue, boost::optional< typename Cameras::FBlocks & > Fs=boost::none, boost::optional< Matrix & > E=boost::none) const override
 This corrects the Jacobians and error vector for the case in which the right 2D measurement in the monocular camera is missing (nan). More...
 
TriangulationResult point () const
 return the landmark
 
TriangulationResult point (const Values &values) const
 COMPUTE the landmark.
 
bool isValid () const
 Is result valid?
 
bool isDegenerate () const
 return the degenerate state
 
bool isPointBehindCamera () const
 return the cheirality status flag
 
bool isOutlier () const
 return the outlier state
 
bool isFarPoint () const
 return the farPoint state
 
- Public Member Functions inherited from gtsam::SmartFactorBase< StereoCamera >
 SmartFactorBase ()
 Default Constructor, for serialization.
 
 SmartFactorBase (const SharedNoiseModel &sharedNoiseModel, boost::optional< Pose3 > body_P_sensor=boost::none, size_t expectedNumberCameras=10)
 Construct with given noise model and optional arguments.
 
 ~SmartFactorBase () override
 Virtual destructor, subclasses from NonlinearFactor.
 
void add (const Z &measured, const Key &key)
 Add a new measurement and pose/camera key. More...
 
void add (const ZVector &measurements, const KeyVector &cameraKeys)
 Add a bunch of measurements, together with the camera keys.
 
void add (const SFM_TRACK &trackToAdd)
 Add an entire SfM_track (collection of cameras observing a single point). More...
 
size_t dim () const override
 Return the dimension (number of rows!) of the factor. More...
 
const ZVector & measured () const
 Return the 2D measurements (ZDim, in general).
 
virtual Cameras cameras (const Values &values) const
 Collect all cameras: important that in key order. More...
 
void print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
 print More...
 
bool equals (const NonlinearFactor &p, double tol=1e-9) const override
 equals More...
 
Vector unwhitenedError (const Cameras &cameras, const POINT &point, boost::optional< typename Cameras::FBlocks & > Fs=boost::none, boost::optional< Matrix & > E=boost::none) const
 Compute reprojection errors [h(x)-z] = [cameras.project(p)-z] and derivatives. More...
 
virtual void correctForMissingMeasurements (const Cameras &cameras, Vector &ue, boost::optional< typename Cameras::FBlocks & > Fs=boost::none, boost::optional< Matrix & > E=boost::none) const
 This corrects the Jacobians for the case in which some 2D measurement is missing (nan). More...
 
Vector whitenedError (const Cameras &cameras, const POINT &point) const
 Calculate vector of re-projection errors [h(x)-z] = [cameras.project(p) - z], with the noise model applied.
 
double totalReprojectionError (const Cameras &cameras, const POINT &point) const
 Calculate the error of the factor. More...
 
void computeJacobians (FBlocks &Fs, Matrix &E, Vector &b, const Cameras &cameras, const POINT &point) const
 Compute F, E, and b (called below in both vanilla and SVD versions), where F is a vector of derivatives wrpt the cameras, and E the stacked derivatives with respect to the point. More...
 
void computeJacobiansSVD (FBlocks &Fs, Matrix &Enull, Vector &b, const Cameras &cameras, const POINT &point) const
 SVD version that produces smaller Jacobian matrices by doing an SVD decomposition on E, and returning the left nulkl-space of E. More...
 
boost::shared_ptr< RegularHessianFactor< Dim > > createHessianFactor (const Cameras &cameras, const Point3 &point, const double lambda=0.0, bool diagonalDamping=false) const
 Linearize to a Hessianfactor.
 
void updateAugmentedHessian (const Cameras &cameras, const Point3 &point, const double lambda, bool diagonalDamping, SymmetricBlockMatrix &augmentedHessian, const KeyVector allKeys) const
 Add the contribution of the smart factor to a pre-allocated Hessian, using sparse linear algebra. More...
 
void whitenJacobians (FBlocks &F, Matrix &E, Vector &b) const
 Whiten the Jacobians computed by computeJacobians using noiseModel_.
 
boost::shared_ptr< RegularImplicitSchurFactor< StereoCamera > > createRegularImplicitSchurFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as RegularImplicitSchurFactor with raw access.
 
boost::shared_ptr< JacobianFactorQ< Dim, ZDim > > createJacobianQFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0, bool diagonalDamping=false) const
 Return Jacobians as JacobianFactorQ.
 
boost::shared_ptr< JacobianFactorcreateJacobianSVDFactor (const Cameras &cameras, const Point3 &point, double lambda=0.0) const
 Return Jacobians as JacobianFactorSVD. More...
 
Pose3 body_P_sensor () const
 
- Public Member Functions inherited from gtsam::NonlinearFactor
 NonlinearFactor ()
 Default constructor for I/O only.
 
template<typename CONTAINER >
 NonlinearFactor (const CONTAINER &keys)
 Constructor from a collection of the keys involved in this factor.
 
virtual ~NonlinearFactor ()
 Destructor.
 
virtual bool active (const Values &) const
 Checks whether a factor should be used based on a set of values. More...
 
virtual shared_ptr clone () const
 Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses. More...
 
virtual shared_ptr rekey (const std::map< Key, Key > &rekey_mapping) const
 Creates a shared_ptr clone of the factor with different keys using a map from old->new keys. More...
 
virtual shared_ptr rekey (const KeyVector &new_keys) const
 Clones a factor and fully replaces its keys. More...
 
virtual bool sendable () const
 Should the factor be evaluated in the same thread as the caller This is to enable factors that has shared states (like the Python GIL lock) More...
 
- Public Member Functions inherited from gtsam::Factor
virtual ~Factor ()=default
 Default destructor.
 
KeyVectorkeys ()
 
iterator begin ()
 Iterator at beginning of involved variable keys.
 
iterator end ()
 Iterator at end of involved variable keys.
 
virtual void printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
 print only keys More...
 
Key front () const
 First key.
 
Key back () const
 Last key.
 
const_iterator find (Key key) const
 find
 
const KeyVectorkeys () const
 Access the factor's involved variable keys.
 
const_iterator begin () const
 Iterator at beginning of involved variable keys.
 
const_iterator end () const
 Iterator at end of involved variable keys.
 
size_t size () const
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef SmartStereoProjectionFactor Base
 shorthand for base class type
 
- Public Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
GTSAM_MAKE_ALIGNED_OPERATOR_NEW typedef boost::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor.
 

Public Types

typedef SmartStereoProjectionPoseFactor This
 shorthand for this class
 
typedef boost::shared_ptr< Thisshared_ptr
 shorthand for a smart pointer to a factor
 
- Public Types inherited from gtsam::SmartStereoProjectionFactor
typedef boost::shared_ptr< SmartStereoProjectionFactorshared_ptr
 shorthand for a smart pointer to a factor
 
typedef CameraSet< StereoCameraCameras
 Vector of cameras.
 
typedef PinholeCamera< Cal3_S2MonoCamera
 Vector of monocular cameras (stereo treated as 2 monocular)
 
typedef CameraSet< MonoCameraMonoCameras
 
typedef MonoCamera::MeasurementVector MonoMeasurements
 
- Public Types inherited from gtsam::SmartFactorBase< StereoCamera >
typedef Eigen::Matrix< double, ZDim, DimMatrixZD
 
typedef std::vector< MatrixZD, Eigen::aligned_allocator< MatrixZD > > FBlocks
 
typedef CameraSet< StereoCameraCameras
 The CameraSet data structure is used to refer to a set of cameras.
 
- Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< Thisshared_ptr
 
- Public Types inherited from gtsam::Factor
typedef KeyVector::iterator iterator
 Iterator over keys.
 
typedef KeyVector::const_iterator const_iterator
 Const iterator over keys.
 

Protected Attributes

std::vector< boost::shared_ptr< Cal3_S2Stereo > > K_all_
 shared pointer to calibration object (one for each camera)
 
- Protected Attributes inherited from gtsam::SmartStereoProjectionFactor
const SmartStereoProjectionParams params_
 
TriangulationResult result_
 result from triangulateSafe
 
std::vector< Pose3cameraPosesTriangulation_
 current triangulation poses
 
- Protected Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
SharedIsotropic noiseModel_
 As of Feb 22, 2015, the noise model is the same for all measurements and is isotropic. More...
 
ZVector measured_
 Measurements for each of the m views. More...
 
boost::optional< Pose3body_P_sensor_
 Pose of the camera in the body frame.
 
FBlocks Fs
 
- Protected Attributes inherited from gtsam::Factor
KeyVector keys_
 The keys involved in this factor.
 

Friends

class boost::serialization::access
 Serialization function.
 

Additional Inherited Members

- Static Public Member Functions inherited from gtsam::SmartFactorBase< StereoCamera >
static Matrix PointCov (const Matrix &E)
 Computes Point Covariance P from the "point Jacobian" E.
 
static void FillDiagonalF (const FBlocks &Fs, Matrix &F)
 Create BIG block-diagonal matrix F from Fblocks.
 
- Static Public Attributes inherited from gtsam::SmartFactorBase< StereoCamera >
static const int Dim
 Camera dimension.
 
static const int ZDim
 Measurement dimension.
 
- Protected Types inherited from gtsam::NonlinearFactor
typedef Factor Base
 
typedef NonlinearFactor This
 
- Protected Member Functions inherited from gtsam::Factor
 Factor ()
 Default constructor for I/O.
 
template<typename CONTAINER >
 Factor (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
 Factor (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 
bool equals (const This &other, double tol=1e-9) const
 check equality
 
- Static Protected Member Functions inherited from gtsam::Factor
template<typename CONTAINER >
static Factor FromKeys (const CONTAINER &keys)
 Construct factor from container of keys. More...
 
template<typename ITERATOR >
static Factor FromIterators (ITERATOR first, ITERATOR last)
 Construct factor from iterator keys. More...
 

Constructor & Destructor Documentation

◆ SmartStereoProjectionPoseFactor()

gtsam::SmartStereoProjectionPoseFactor::SmartStereoProjectionPoseFactor ( const SharedNoiseModel sharedNoiseModel,
const SmartStereoProjectionParams params = SmartStereoProjectionParams(),
const boost::optional< Pose3 > &  body_P_sensor = boost::none 
)

Constructor.

Parameters
Isotropicmeasurement noise
paramsinternal parameters of the smart factors

Member Function Documentation

◆ add() [1/3]

void gtsam::SmartStereoProjectionPoseFactor::add ( const std::vector< StereoPoint2 > &  measurements,
const KeyVector poseKeys,
const boost::shared_ptr< Cal3_S2Stereo > &  K 
)

Variant of the previous one in which we include a set of measurements with the same noise and calibration.

Parameters
measurementsvector of the 2m dimensional location of the projection of a single landmark in the m view (the measurement)
poseKeysvector of keys corresponding to the camera observing the same landmark
Kthe (known) camera calibration (same for all measurements)

◆ add() [2/3]

void gtsam::SmartStereoProjectionPoseFactor::add ( const std::vector< StereoPoint2 > &  measurements,
const KeyVector poseKeys,
const std::vector< boost::shared_ptr< Cal3_S2Stereo > > &  Ks 
)

Variant of the previous one in which we include a set of measurements.

Parameters
measurementsvector of the 2m dimensional location of the projection of a single landmark in the m view (the measurement)
poseKeysvector of keys corresponding to the camera observing the same landmark
Ksvector of calibration objects

◆ add() [3/3]

void gtsam::SmartStereoProjectionPoseFactor::add ( const StereoPoint2 measured,
const Key poseKey,
const boost::shared_ptr< Cal3_S2Stereo > &  K 
)

add a new measurement and pose key

Parameters
measuredis the 2m dimensional location of the projection of a single landmark in the m view (the measurement)
poseKeyis key corresponding to the camera observing the same landmark
Kis the (fixed) camera calibration

◆ cameras()

SmartStereoProjectionPoseFactor::Base::Cameras gtsam::SmartStereoProjectionPoseFactor::cameras ( const Values values) const
overridevirtual

Collect all cameras involved in this factor.

Parameters
valuesValues structure which must contain camera poses corresponding to keys involved in this factor
Returns
vector of Values

Reimplemented from gtsam::SmartFactorBase< StereoCamera >.

◆ equals()

bool gtsam::SmartStereoProjectionPoseFactor::equals ( const NonlinearFactor p,
double  tol = 1e-9 
) const
overridevirtual

equals

Reimplemented from gtsam::SmartStereoProjectionFactor.

◆ error()

double gtsam::SmartStereoProjectionPoseFactor::error ( const Values values) const
overridevirtual

error calculates the error of the factor.

Reimplemented from gtsam::SmartStereoProjectionFactor.

◆ print()

void gtsam::SmartStereoProjectionPoseFactor::print ( const std::string &  s = "",
const KeyFormatter keyFormatter = DefaultKeyFormatter 
) const
overridevirtual

print

Parameters
soptional string naming the factor
keyFormatteroptional formatter useful for printing Symbols

Reimplemented from gtsam::SmartStereoProjectionFactor.


The documentation for this class was generated from the following files: