|
gtsam
4.0.0
gtsam
|
This is the interface class for any value that may be used as a variable assignment in a factor graph, and which you must derive to create new variable types to use with gtsam.
Examples of built-in classes implementing this are mainly in geometry, including Rot3, Pose2, etc.
This interface specifies pure virtual retract_(), localCoordinates_() and equals_() functions that work with pointers and references to this interface class, i.e. the base class. These functions allow containers, such as Values can operate generically on Value objects, retracting or computing local coordinates for many Value objects of different types.
Inheriting from the DerivedValue class template provides a generic implementation of the pure virtual functions retract_(), localCoordinates_(), and equals_(), eliminating the need to implement these functions in your class. Note that you must inherit from DerivedValue templated on the class you are defining. For example you cannot define the following
Using the above practice, here is an example of implementing a typical class derived from Value:
Inheritance diagram for gtsam::Value:Public Member Functions | |
| virtual Value * | clone_ () const =0 |
| Clone this value in a special memory pool, must be deleted with Value::deallocate_, not with the 'delete' operator. More... | |
| virtual void | deallocate_ () const =0 |
| Deallocate a raw pointer of this value. | |
| virtual boost::shared_ptr< Value > | clone () const =0 |
| Clone this value (normal clone on the heap, delete with 'delete' operator) | |
| virtual bool | equals_ (const Value &other, double tol=1e-9) const =0 |
| Compare this Value with another for equality. More... | |
| virtual void | print (const std::string &str="") const =0 |
| Print this value, for debugging and unit tests. | |
| virtual size_t | dim () const =0 |
| Return the dimensionality of the tangent space of this value. More... | |
| virtual Value * | retract_ (const Vector &delta) const =0 |
| Increment the value, by mapping from the vector delta in the tangent space of the current value back to the manifold to produce a new, incremented value. More... | |
| virtual Vector | localCoordinates_ (const Value &value) const =0 |
Compute the coordinates in the tangent space of this value that retract() would map to value. More... | |
| virtual Value & | operator= (const Value &) |
| Assignment operator. | |
| template<typename ValueType > | |
| const ValueType & | cast () const |
| Cast to known ValueType. | |
| virtual | ~Value () |
| Virutal destructor. | |
Friends | |
| class | boost::serialization::access |
| Empty serialization function. More... | |
|
pure virtual |
Clone this value in a special memory pool, must be deleted with Value::deallocate_, not with the 'delete' operator.
Implemented in gtsam::GenericValue< T >, and gtsam::DerivedValue< DERIVED >.
|
pure virtual |
Return the dimensionality of the tangent space of this value.
This is the dimensionality of delta passed into retract() and of the vector returned by localCoordinates().
Implemented in gtsam::GenericValue< T >.
|
pure virtual |
Compare this Value with another for equality.
Implemented in gtsam::DerivedValue< DERIVED >, and gtsam::GenericValue< T >.
|
pure virtual |
Compute the coordinates in the tangent space of this value that retract() would map to value.
| value | The value whose coordinates should be determined in the tangent space of the value on which this function is called. |
value in the tangent space of this. Implemented in gtsam::GenericValue< T >, and gtsam::DerivedValue< DERIVED >.
|
pure virtual |
Increment the value, by mapping from the vector delta in the tangent space of the current value back to the manifold to produce a new, incremented value.
| delta | The delta vector in the tangent space of this value, by which to increment this value. |
Implemented in gtsam::GenericValue< T >, and gtsam::DerivedValue< DERIVED >.
|
friend |
Empty serialization function.
There are two important things that users need to do to serialize derived objects in Values successfully: (Those derived objects are stored in Values as pointer to this abstract base class Value)
1. All DERIVED classes derived from Value must put the following line in their serialization function:
or, alternatively
See: http://www.boost.org/doc/libs/release/libs/serialization/doc/serialization.html#runtimecasting