Loading...
Searching...
No Matches
gtsam::LinearContainerFactor Class Reference

## Detailed Description

Dummy version of a generic linear factor to be injected into a nonlinear factor graph.

This factor does have the ability to perform relinearization under small-angle and linearity assumptions if a linearization point is added.

Inheritance diagram for gtsam::LinearContainerFactor:

## Public Member Functions

| LinearContainerFactor ()
| Default constructor - necessary for serialization.
| LinearContainerFactor (const JacobianFactor &factor, const Values &linearizationPoint=Values())
| Primary constructor: store a linear factor with optional linearization point.
| LinearContainerFactor (const HessianFactor &factor, const Values &linearizationPoint=Values())
| Primary constructor: store a linear factor with optional linearization point.
| LinearContainerFactor (const GaussianFactor::shared_ptr &factor, const Values &linearizationPoint=Values())
| Constructor from shared_ptr.
const GaussianFactor::shared_ptr & | factor () const
void | print (const std::string &s="", const KeyFormatter &keyFormatter=gtsam::DefaultKeyFormatter) const override
| print
bool | equals (const NonlinearFactor &f, double tol=1e-9) const override
| Check if two factors are equal.
double | error (const Values &c) const override
| Calculate the nonlinear error for the factor, where the error is computed by passing the delta between linearization point and c, where delta = linearizationPoint_.localCoordinates(c), into the error function of the stored linear factor.
size_t | dim () const override
| get the dimension of the factor: rows of linear factor
const boost::optional< Values > & | linearizationPoint () const
| Extract the linearization point used in recalculating error.
GaussianFactor::shared_ptr | linearize (const Values &c) const override
| Linearize to a GaussianFactor, with method depending on the presence of a linearizationPoint.
GaussianFactor::shared_ptr | negateToGaussian () const
| Creates an anti-factor directly.
NonlinearFactor::shared_ptr | negateToNonlinear () const
| Creates the equivalent anti-factor as another LinearContainerFactor.
NonlinearFactor::shared_ptr | clone () const override
| Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
NonlinearFactor::shared_ptr | rekey (const std::map< Key, Key > &rekey_mapping) const override
| Creates a shared_ptr clone of the factor with different keys using a map from old->new keys.
NonlinearFactor::shared_ptr | rekey (const KeyVector &new_keys) const override
| Clones a factor and fully replaces its keys.
bool | hasLinearizationPoint () const
| Casting syntactic sugar.
bool | isJacobian () const
| Simple checks whether this is a Jacobian or Hessian factor.
bool | isHessian () const
boost::shared_ptr< JacobianFactor > | toJacobian () const
| Casts to JacobianFactor.
boost::shared_ptr< HessianFactor > | toHessian () const
| Casts to HessianFactor.
| 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.
void | print (const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
| print
virtual | ~NonlinearFactor ()
| Destructor.
double | error (const HybridValues &c) const override
| All factor types need to implement an error function.
virtual bool | active (const Values &) const
| Checks whether a factor should be used based on a set of values.
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).
Public Member Functions inherited from gtsam::Factor
virtual | ~Factor ()=default
| Default destructor.
bool | empty () const
| Whether the factor is empty (involves zero variables).
Key | front () const
| First key.
Key | back () const
| Last key.
const_iterator | find (Key key) const
| find
const KeyVector & | keys () 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
virtual void | printKeys (const std::string &s="Factor", const KeyFormatter &formatter=DefaultKeyFormatter) const
| print only keys
bool | equals (const This &other, double tol=1e-9) const
| check equality
KeyVector & | keys ()
iterator | begin ()
| Iterator at beginning of involved variable keys.
iterator | end ()
| Iterator at end of involved variable keys.

## Static Public Member Functions

static NonlinearFactorGraph | ConvertLinearGraph (const GaussianFactorGraph &linear_graph, const Values &linearizationPoint=Values())
| Utility function for converting linear graphs to nonlinear graphs consisting of LinearContainerFactors.

## Public Types

typedef boost::shared_ptr< This > | shared_ptr
Public Types inherited from gtsam::NonlinearFactor
typedef boost::shared_ptr< This > | shared_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 Types

typedef NonlinearFactor | Base
typedef LinearContainerFactor | This
Protected Types inherited from gtsam::NonlinearFactor
typedef Factor | Base
typedef NonlinearFactor | This

## Protected Member Functions

| LinearContainerFactor (const GaussianFactor::shared_ptr &factor, const boost::optional< Values > &linearizationPoint)
| direct copy constructor
void | initializeLinearizationPoint (const Values &linearizationPoint)
| Factor ()
| Default constructor for I/O.
template<typename CONTAINER>
| Factor (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
| Factor (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.

## Protected Attributes

GaussianFactor::shared_ptr | factor_
boost::optional< Values > | linearizationPoint_
Protected Attributes inherited from gtsam::Factor
KeyVector | keys_
| The keys involved in this factor.

## Friends

class | boost::serialization::access
| Serialization function.

## Additional Inherited Members

template<typename CONTAINER>
static Factor | FromKeys (const CONTAINER &keys)
| Construct factor from container of keys.
template<typename ITERATOR>
static Factor | FromIterators (ITERATOR first, ITERATOR last)
| Construct factor from iterator keys.

## Member Function Documentation

## clone()

NonlinearFactor::shared_ptr gtsam::LinearContainerFactor::clone | ( |  | ) | const

inline override virtual

Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.

Clones the underlying linear factor

Reimplemented from gtsam::NonlinearFactor.

## dim()

size_t gtsam::LinearContainerFactor::dim | ( |  | ) | const

override virtual

get the dimension of the factor: rows of linear factor

Implements gtsam::NonlinearFactor.

## equals()

bool gtsam::LinearContainerFactor::equals | ( | const NonlinearFactor & | f,
|  | double | tol = 1e-9 ) const

override virtual

Check if two factors are equal.

Reimplemented from gtsam::NonlinearFactor.

## error()

double gtsam::LinearContainerFactor::error | ( | const Values & | c | ) | const

override virtual

Calculate the nonlinear error for the factor, where the error is computed by passing the delta between linearization point and c, where delta = linearizationPoint_.localCoordinates(c), into the error function of the stored linear factor.

Returns
  nonlinear error if linearizationPoint present, zero otherwise

Reimplemented from gtsam::NonlinearFactor.

## linearize()

GaussianFactor::shared_ptr gtsam::LinearContainerFactor::linearize | ( | const Values & | c | ) | const

override virtual

Linearize to a GaussianFactor, with method depending on the presence of a linearizationPoint.

- With no linearization point, returns a cloned version of the stored linear factor.
- With a linearization point provided, returns a relinearized version of the linearized factor.

The relinearization approach used computes a linear delta between the original linearization point and the new values c, where delta = linearizationPoint_.localCoordinates(c), and substitutes this change into the system. This substitution is only really valid for linear variable manifolds, and for any variables based on a non-commutative manifold (such as Pose2, Pose3), the relinearized version will be effective for only small angles.

TODO: better approximation of relinearization TODO: switchable modes for approximation technique

Implements gtsam::NonlinearFactor.

## print()

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

override virtual

print

Reimplemented from gtsam::Factor.

## rekey() [1/2]

NonlinearFactor::shared_ptr gtsam::LinearContainerFactor::rekey | ( | const KeyVector & | new_keys | ) | const

override virtual

Clones a factor and fully replaces its keys.

Parameters

  new_keys | is the full replacement set of keys

Reimplemented from gtsam::NonlinearFactor.

## rekey() [2/2]

NonlinearFactor::shared_ptr gtsam::LinearContainerFactor::rekey | ( | const std::map< Key, Key > & | rekey_mapping | ) | const

override virtual

Creates a shared_ptr clone of the factor with different keys using a map from old->new keys.

Reimplemented from gtsam::NonlinearFactor.

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

- /build/gtsam-RkN8wG/gtsam-4.2.2+dfsg/gtsam/nonlinear/LinearContainerFactor.h
- /build/gtsam-RkN8wG/gtsam-4.2.2+dfsg/gtsam/nonlinear/LinearContainerFactor.cpp