iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::StateVector< StateDef > Class Template Reference

#include <nrt/Probabilistic/Types/StateVector.H>

template<class StateDef>
class nrt::StateVector< StateDef >

A StateVector is a wrapper around an Eigen::Vector which provides methods to access elements by a StateDefinition.

Template Parameters
StateDefThe StateDefinition which defines the fields of this vector
  The only method provided by this class is access(), which is used to
  access various fields or field groups of the internal Eigen::Vector
NRT_STATE_FIELD_GROUP(Position2D,(x)(y));
NRT_STATE_FIELD_GROUP(Velocity2D,(x)(y));
// Single field access
myvector.access<Position2D::x>() = 1.1;
// Field group access
myvector.access<Velocity>() = Eigen::Vector2d(3.3, 4.4);
// Entire vector accss
myvector.access<>() = Eigen::Vector4d(1.1, 2.2, 3.3, 4.4);
See Also
probabalistic
Examples:
tests/test-UKF.C.

Definition at line 70 of file StateVector.H.

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
constexpr size_t 
size ()
 
 StateVector ()
 Default constructor. More...
 
 StateVector (Vector const &vector)
 Conversion constructor. More...
 
template<class Field >
std::enable_if< is_state_field
< Field >), double & >::type 
access ()
 Access the value of a single field. More...
 
template<class Field >
std::enable_if< is_state_field
< Field >), double >::type 
access () const
 Const field access.
 
template<class FieldGroup >
std::enable_if
< is_state_field_group
< FieldGroup >), Eigen::Block
< Vector,
FieldGroup::num_fields, 1 >
>::type 
access ()
 Access the sub-vector of a field group. More...
 
template<class FieldGroup >
std::enable_if
< is_state_field_group
< FieldGroup >), Eigen::Block
< Vector const,
FieldGroup::num_fields, 1 >
>::type 
access () const
 Const field group access.
 
template<typename Void = void>
std::enable_if< std::is_void
< Void >::value, Vector & >
::type 
access ()
 Access the entire vector. More...
 
template<typename Void = void>
std::enable_if< std::is_void
< Void >::value, Vector >
::type 
access () const
 Const access to the entire vector.
 
template<class Field >
std::enable_if
< nrt::is_state_field< Field >
), double & >::type 
access ()
 
template<class Field >
std::enable_if
< nrt::is_state_field< Field >
), double >::type 
access () const
 
template<class FieldGroup >
std::enable_if
< nrt::is_state_field_group
< FieldGroup >), Eigen::Block
< typename nrt::StateVector
< StateDef >::Vector,
FieldGroup::num_fields, 1 >
>::type 
access ()
 
template<class FieldGroup >
std::enable_if
< nrt::is_state_field_group
< FieldGroup >), Eigen::Block
< typename nrt::StateVector
< StateDef >::Vector const,
FieldGroup::num_fields, 1 >
>::type 
access () const
 
template<typename Void >
std::enable_if< std::is_void
< Void >::value, typename
nrt::StateVector< StateDef >
::Vector & >::type 
access ()
 
template<typename Void >
std::enable_if< std::is_void
< Void >::value, typename
nrt::StateVector< StateDef >
::Vector >::type 
access () const
 

Constructor & Destructor Documentation

template<class StateDef >
nrt::StateVector< StateDef >::StateVector ( )

Default constructor.

The internal vector is set to 0

Definition at line 38 of file StateVectorImpl.H.

template<class StateDef >
nrt::StateVector< StateDef >::StateVector ( Vector const &  vector)

Conversion constructor.

Copy the given Eigen::Matrix into our internal vector

Definition at line 44 of file StateVectorImpl.H.

Member Function Documentation

template<class StateDef>
template<class Field >
std::enable_if< is_state_field<Field>), double & >::type nrt::StateVector< StateDef >::access ( )

Access the value of a single field.

Template Parameters
FieldThe single field to access, e.g. Position2D::x
Returns
A reference to the scalar field
NRT_STATE_FIELD_GROUP(Position2D,(x)(y));
NRT_STATE_FIELD_GROUP(Velocity2D,(x)(y));
myvector.access<Velocity2D::x>() = 1.0;
Examples:
tests/test-UKF.C.
template<class StateDef>
template<class FieldGroup >
std::enable_if< is_state_field_group<FieldGroup>), Eigen::Block<Vector, FieldGroup::num_fields, 1> >::type nrt::StateVector< StateDef >::access ( )

Access the sub-vector of a field group.

Template Parameters
FieldGroupThe field group to access, e.g. Position2D
Returns
An Eigen::Block, which acts like a reference to the vector of the field group.
NRT_STATE_FIELD_GROUP(Position2D,(x)(y));
NRT_STATE_FIELD_GROUP(Velocity2D,(x)(y));
myvector.access<Velocity2D>() = Eigen::Vector2d(1.0, 2.0);
template<class StateDef>
template<typename Void = void>
std::enable_if< std::is_void<Void>::value, Vector & >::type nrt::StateVector< StateDef >::access ( )

Access the entire vector.

Template Parameters
VoidLeave this template parameter empty to specify that you want the entire state vector
Returns
A reference to the entire state vector
NRT_STATE_FIELD_GROUP(Position2D,(x)(y));
NRT_STATE_FIELD_GROUP(Velocity2D,(x)(y));
myvector.access<>() = Eigen::Vector4d(1.0, 2.0, 3.0, 4.0);

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