Aikido
|
Represents a N-dimensional real vector space with vector addition as the group operation. More...
#include <aikido/statespace/Rn.hpp>
Classes | |
class | State |
Point in a R<N> . More... | |
Public Types | |
using | VectorNd = Eigen::Matrix< double, N, 1 > |
using | StateHandle = RStateHandle< State > |
using | StateHandleConst = RStateHandle< const State > |
using | ScopedState = statespace::ScopedState< StateHandle > |
using | ScopedStateConst = statespace::ScopedState< StateHandleConst > |
![]() | |
using | StateHandle = statespace::StateHandle< StateSpace, State > |
using | StateHandleConst = statespace::StateHandle< StateSpace, const State > |
using | ScopedState = statespace::ScopedState< StateHandle > |
using | ScopedStateConst = statespace::ScopedState< StateHandleConst > |
Public Member Functions | |
R () | |
Constructs a N dimensional real vector space only when the dimension is can be known in compile time. More... | |
R (int dimension) | |
Constructs a dimension dimensional real vector space. More... | |
ScopedState | createState () const |
Helper function to create a ScopedState . More... | |
ScopedState | cloneState (const StateSpace::State *stateIn) const |
Creates an identical clone of stateIn . More... | |
Eigen::Map< const VectorNd > | getValue (const State *_state) const |
Gets the real vector stored in a State . More... | |
void | setValue (State *_state, const VectorNd &_value) const |
Sets the real vector stored in a State . More... | |
std::size_t | getStateSizeInBytes () const override |
Gets the size of a State, in bytes. More... | |
StateSpace::State * | allocateStateInBuffer (void *_buffer) const override |
Create a new state in a pre-allocated buffer. More... | |
void | freeStateInBuffer (StateSpace::State *_state) const override |
Free a state previously created by allocateStateInBuffer . More... | |
void | compose (const StateSpace::State *_state1, const StateSpace::State *_state2, StateSpace::State *_out) const override |
Lie group operation for this StateSpace. More... | |
void | getIdentity (StateSpace::State *_out) const override |
Gets the identity element for this Lie group, such that: More... | |
void | getInverse (const StateSpace::State *_in, StateSpace::State *_out) const override |
Gets the inverse of _in in this Lie group, such that: More... | |
std::size_t | getDimension () const override |
Get the dimension of this Lie group. More... | |
void | copyState (const StateSpace::State *_source, StateSpace::State *_destination) const override |
Copy a state. More... | |
void | expMap (const Eigen::VectorXd &_tangent, StateSpace::State *_out) const override |
Exponential mapping of Lie algebra element to a Lie group element. More... | |
void | logMap (const StateSpace::State *_in, Eigen::VectorXd &_tangent) const override |
Log mapping of Lie group element to a Lie algebra element. More... | |
void | print (const StateSpace::State *_state, std::ostream &_os) const override |
Print the n-dimensional vector represented by the state Format: [x_1, x_2, ..., x_n]. More... | |
virtual void | compose (const State *_state1, const State *_state2, State *_out) const=0 |
Lie group operation for this StateSpace. More... | |
virtual void | compose (State *_state1, const State *_state2) const |
Lie group operation for this StateSpace. More... | |
![]() | |
virtual | ~StateSpace ()=default |
ScopedState | createState () const |
Helper function to create a ScopedState . More... | |
ScopedState | cloneState (const State *stateIn) const |
Creates an identical clone of stateIn . More... | |
virtual State * | allocateState () const |
Allocate a new state. More... | |
virtual void | freeState (State *_state) const |
Free a state previously created by allocateState . More... | |
virtual void | compose (State *_state1, const State *_state2) const |
Lie group operation for this StateSpace. More... | |
virtual void | getInverse (State *_state) const |
Gets the inverse of _in in this Lie group. More... | |
Static Public Attributes | |
static constexpr int | DimensionAtCompileTime = N |
Dimension of the space. More... | |
Private Member Functions | |
Eigen::Map< VectorNd > | getMutableValue (State *_state) const |
Gets the mutable value stored in a Rn::State. More... | |
Private Attributes | |
int | mDimension |
Dimension of the real vector space. More... | |
Represents a N-dimensional real vector space with vector addition as the group operation.
N
should be either non-negative or Eigen::Dynamic.
using aikido::statespace::R< N >::ScopedState = statespace::ScopedState<StateHandle> |
using aikido::statespace::R< N >::ScopedStateConst = statespace::ScopedState<StateHandleConst> |
using aikido::statespace::R< N >::StateHandle = RStateHandle<State> |
using aikido::statespace::R< N >::StateHandleConst = RStateHandle<const State> |
using aikido::statespace::R< N >::VectorNd = Eigen::Matrix<double, N, 1> |
aikido::statespace::R< N >::R |
Constructs a N
dimensional real vector space only when the dimension is can be known in compile time.
If the dimension is known in compile time, it is recommended to use this constructor over R(int) because this constructor uses fixed size Eigen objects to represent the state data internally, which is generally faster than using dynamic size Eigen objects.
N
must be non-negative and not Eigen::Dynamic.
std::invalid_argument | when N is Eigen::Dynamic. |
|
explicit |
Constructs a dimension
dimensional real vector space.
This constructor must be used only when N is Eigen::Dynamic (i.e., -1). Otherwise, throws an std::invalid_argument exception.
N
must be non-negative and not Eigen::Dynamic.
std::invalid_argument | when N is not Eigen::Dynamic and dimension is not the same with N . |
|
overridevirtual |
Create a new state in a pre-allocated buffer.
The input argument must contain at least getStateSizeInBytes()
bytes of memory. This state must be freed with freeStateInBuffer
before freeing _buffer
.
_buffer | memory used to store the returned state |
_buffer
Implements aikido::statespace::StateSpace.
auto aikido::statespace::R< N >::cloneState | ( | const StateSpace::State * | stateIn | ) | const |
Creates an identical clone of stateIn
.
virtual void aikido::statespace::StateSpace::compose |
Lie group operation for this StateSpace.
It is not acceptable for _out
to share memory with _state1
or _state2
.
_state1 | left input state | |
_state2 | right input state | |
[out] | _out | output state |
|
overridevirtual |
Lie group operation for this StateSpace.
It is not acceptable for _out
to share memory with _state1
or _state2
.
_state1 | left input state | |
_state2 | right input state | |
[out] | _out | output state |
Implements aikido::statespace::StateSpace.
virtual void aikido::statespace::StateSpace::compose |
Lie group operation for this StateSpace.
This is an in-place version of the three argument compose
member function that computes:
[in,out] | _state1 | left input state, overwritten by output |
_state2 | right input state |
|
overridevirtual |
Copy a state.
_source | input state | |
[out] | _destination | output state |
Implements aikido::statespace::StateSpace.
auto aikido::statespace::R< N >::createState |
Helper function to create a ScopedState
.
ScopedState
|
overridevirtual |
Exponential mapping of Lie algebra element to a Lie group element.
This is simply the identity transformation on a real vector space.
_tangent | element of the tangent space | |
[out] | _out | corresponding element of the Lie group |
Implements aikido::statespace::StateSpace.
|
overridevirtual |
Free a state previously created by allocateStateInBuffer
.
It is undefined behavior to access _state
after calling this function.
_state | state to free |
Implements aikido::statespace::StateSpace.
|
overridevirtual |
Get the dimension of this Lie group.
This is also the dimension of the tangent space, i.e. the Lie algebra, associated with this group.
Implements aikido::statespace::StateSpace.
|
overridevirtual |
Gets the identity element for this Lie group, such that:
[out] | _out | output state |
Implements aikido::statespace::StateSpace.
|
overridevirtual |
Gets the inverse of _in
in this Lie group, such that:
It is not acceptable for _in
to share memory with _out
.
_state | input state | |
[out] | _out | output state |
Implements aikido::statespace::StateSpace.
|
private |
Gets the mutable value stored in a Rn::State.
This is used internally to implement the public getValue
member functions.
_state | element of this state space |
_state
|
overridevirtual |
Gets the size of a State, in bytes.
State
Implements aikido::statespace::StateSpace.
auto aikido::statespace::R< N >::getValue | ( | const State * | _state | ) | const |
|
overridevirtual |
Log mapping of Lie group element to a Lie algebra element.
This is simply an identity transformation on a real vector space.
_in | element of this Lie group | |
[out] | _tangent | corresponding element of the tangent space |
Implements aikido::statespace::StateSpace.
|
overridevirtual |
Print the n-dimensional vector represented by the state Format: [x_1, x_2, ..., x_n].
Implements aikido::statespace::StateSpace.
void aikido::statespace::R< N >::setValue | ( | State * | _state, |
const VectorNd & | _value | ||
) | const |
|
staticconstexpr |
Dimension of the space.
|
private |
Dimension of the real vector space.
Note that this value is only used for dynamic sized vector space (the dimension is changable).