Aikido
aikido::statespace::dart::MetaSkeletonStateSpace Class Reference

StateSpace of a DART MetaSkeleton. More...

#include <aikido/statespace/dart/MetaSkeletonStateSpace.hpp>

Inheritance diagram for aikido::statespace::dart::MetaSkeletonStateSpace:
aikido::statespace::CartesianProduct aikido::statespace::StateSpace

Classes

class  Properties
 Static properties from the DART MetaSkeleton. More...
 

Public Types

using ScopedState = statespace::ScopedState< StateHandle >
 
- Public Types inherited from aikido::statespace::CartesianProduct
using StateHandle = CompoundStateHandle< State >
 
using StateHandleConst = CompoundStateHandle< const State >
 
using ScopedState = statespace::ScopedState< StateHandle >
 
using ScopedStateConst = statespace::ScopedState< StateHandleConst >
 
- Public Types inherited from aikido::statespace::StateSpace
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

 MetaSkeletonStateSpace (const ::dart::dynamics::MetaSkeleton *metaskeleton)
 Constructs a state space for a DART MetaSkeleton. More...
 
const PropertiesgetProperties () const
 Gets the MetaSkeleton properties associated with this state space. More...
 
bool isCompatible (const ::dart::dynamics::MetaSkeleton *metaskeleton) const
 Returns whether the MetaSkeleton can be used with this state space. More...
 
void checkCompatibility (const ::dart::dynamics::MetaSkeleton *metaskeleton) const
 Throws an error if the MetaSkeleton cannot be used with this state space. More...
 
void checkIfContained (const ::dart::dynamics::Skeleton *skeleton) const
 Checks whether this skeleton contains all dofs defined in this state space. More...
 
template<class Space = JointStateSpace>
std::shared_ptr< Space > getJointSpace (const ::dart::dynamics::MetaSkeleton *_metaskeleton, const ::dart::dynamics::Joint *_joint) const
 Gets the subspace corresponding to _joint in _metaskeleton. More...
 
template<class Space = JointStateSpace>
std::shared_ptr< const Space > getJointSpace (std::size_t _index) const
 Gets the subspace corresponding to joint with index _index. More...
 
void convertPositionsToState (const Eigen::VectorXd &_positions, State *_state) const
 Converts DART MetaSkeleton positions, e.g. More...
 
void convertStateToPositions (const State *_state, Eigen::VectorXd &_positions) const
 Converts a State in this state space to DART MetaSkeleton positions, e.g. More...
 
void getState (const ::dart::dynamics::MetaSkeleton *_metaskeleton, State *_state) const
 Gets the positions of the _metaskeleton and store them in _state. More...
 
void setState (::dart::dynamics::MetaSkeleton *_metaskeleton, const State *_state) const
 Sets the positions of the _metaskeleton to _state. More...
 
ScopedState getScopedStateFromMetaSkeleton (const ::dart::dynamics::MetaSkeleton *_metaskeleton) const
 Wrapper for getStateFromMetaSkeleton that returns a ScopedState. More...
 
::dart::dynamics::MetaSkeletonPtr getControlledMetaSkeleton (const ::dart::dynamics::SkeletonPtr &_skeleton) const
 Returns MetaSkeleton this space operates on. More...
 
- Public Member Functions inherited from aikido::statespace::CartesianProduct
 CartesianProduct (std::vector< ConstStateSpacePtr > _subspaces)
 Construct the Cartesian product of a vector of subspaces. 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...
 
std::size_t getNumSubspaces () const
 Gets number of subspaces. More...
 
template<class Space = StateSpace>
std::shared_ptr< const Space > getSubspace (std::size_t _index) const
 Gets subspace of type Space by at _index. More...
 
template<class Space = StateSpace>
Space::State * getSubState (State *_state, std::size_t _index) const
 Gets substate of type Space::State from a CompoundState by index. More...
 
template<class Space = StateSpace>
const Space::State * getSubState (const State *_state, std::size_t _index) const
 Gets substate of type Space::State from a CompoundState by index. More...
 
template<class Space = StateSpace>
Space::StateHandle getSubStateHandle (State *_state, std::size_t _index) const
 Gets substate of type Space::State from a CompoundState by index and wraps it in a Space::StateHandle helper class. More...
 
template<class Space = StateSpace>
Space::StateHandleConst getSubStateHandle (const State *_state, std::size_t _index) const
 Gets substate of type Space::State from a CompoundState by index and wraps it in a Space::ConstStateHandle helper class. More...
 
std::size_t getStateSizeInBytes () const override
 Gets the size of a State, in bytes. More...
 
StateSpace::StateallocateStateInBuffer (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 *_state) 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 contents of each substate contained in the state as a list with each substate enclosed in brackets and including its index Format: [0: ...] [1: ...] ... 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...
 
- Public Member Functions inherited from aikido::statespace::StateSpace
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 StateallocateState () 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...
 

Private Attributes

Properties mProperties
 

Detailed Description

StateSpace of a DART MetaSkeleton.

This is a CartesianProduct, where the i-th subspace is a JointStateSpace for the i-th Joint of the MetaSkeleton. This class provides functions for converting between State objects and vectors of DART joint positions.

The behavior of this class is undefined if you modify the structure of the MetaSkeleton or its position limits after construction.

Member Typedef Documentation

◆ ScopedState

Constructor & Destructor Documentation

◆ MetaSkeletonStateSpace()

aikido::statespace::dart::MetaSkeletonStateSpace::MetaSkeletonStateSpace ( const ::dart::dynamics::MetaSkeleton *  metaskeleton)
explicit

Constructs a state space for a DART MetaSkeleton.

Parameters
metaskeletontarget MetaSkeleton

Member Function Documentation

◆ checkCompatibility()

void aikido::statespace::dart::MetaSkeletonStateSpace::checkCompatibility ( const ::dart::dynamics::MetaSkeleton *  metaskeleton) const

Throws an error if the MetaSkeleton cannot be used with this state space.

Parameters
metaskeletonMetaSkeleton to check
Exceptions
invalid_argumentif the MetaSkeleton does not match the state space

◆ checkIfContained()

void aikido::statespace::dart::MetaSkeletonStateSpace::checkIfContained ( const ::dart::dynamics::Skeleton *  skeleton) const

Checks whether this skeleton contains all dofs defined in this state space.

Exceptions
invalid_argumentif skeleton does not contain all dofs if this state space.

◆ convertPositionsToState()

void aikido::statespace::dart::MetaSkeletonStateSpace::convertPositionsToState ( const Eigen::VectorXd &  _positions,
State _state 
) const

Converts DART MetaSkeleton positions, e.g.

those returned by getPositions, to a State in this state space.

Parameters
_positionsinput DART MetaSkeleton positions
[out]_stateoutput state

◆ convertStateToPositions()

void aikido::statespace::dart::MetaSkeletonStateSpace::convertStateToPositions ( const State _state,
Eigen::VectorXd &  _positions 
) const

Converts a State in this state space to DART MetaSkeleton positions, e.g.

that may be passed to setPositions.

Parameters
_stateinput state
[out]_positionsoutput DART MetaSkeleton positions

◆ getControlledMetaSkeleton()

::dart::dynamics::MetaSkeletonPtr aikido::statespace::dart::MetaSkeletonStateSpace::getControlledMetaSkeleton ( const ::dart::dynamics::SkeletonPtr &  _skeleton) const

Returns MetaSkeleton this space operates on.

Parameters
_skeletonSkeleton to create MetaSkeleton from.

◆ getJointSpace() [1/2]

template<class Space >
std::shared_ptr< Space > aikido::statespace::dart::MetaSkeletonStateSpace::getJointSpace ( const ::dart::dynamics::MetaSkeleton *  _metaskeleton,
const ::dart::dynamics::Joint *  _joint 
) const

Gets the subspace corresponding to _joint in _metaskeleton.

Template Parameters
Spacetype of StateSpace to return
Parameters
_metaskeletonMetaSkeleton containing _joint
_jointjoint in _metaskeleton
Returns
state space corresponding to _joint

◆ getJointSpace() [2/2]

template<class Space >
std::shared_ptr< const Space > aikido::statespace::dart::MetaSkeletonStateSpace::getJointSpace ( std::size_t  _index) const

Gets the subspace corresponding to joint with index _index.

Template Parameters
Spacetype of StateSpace to return
Parameters
_indexindex of a joint in the MetaSkeleton
Returns
state space corresponding to _joint

◆ getProperties()

const Properties& aikido::statespace::dart::MetaSkeletonStateSpace::getProperties ( ) const

Gets the MetaSkeleton properties associated with this state space.

Returns
MetaSkeleton properties associated with this state space

◆ getScopedStateFromMetaSkeleton()

ScopedState aikido::statespace::dart::MetaSkeletonStateSpace::getScopedStateFromMetaSkeleton ( const ::dart::dynamics::MetaSkeleton *  _metaskeleton) const

Wrapper for getStateFromMetaSkeleton that returns a ScopedState.

Parameters
_metaskeletonMetaSkeleton to get state from
Returns
current state of the _metaskeleton

◆ getState()

void aikido::statespace::dart::MetaSkeletonStateSpace::getState ( const ::dart::dynamics::MetaSkeleton *  _metaskeleton,
State _state 
) const

Gets the positions of the _metaskeleton and store them in _state.

Parameters
_metaskeletonMetaSkeleton to get position from
[out]_stateoutput state

◆ isCompatible()

bool aikido::statespace::dart::MetaSkeletonStateSpace::isCompatible ( const ::dart::dynamics::MetaSkeleton *  metaskeleton) const

Returns whether the MetaSkeleton can be used with this state space.

Parameters
metaskeletonMetaSkeleton to check
Returns
true if MetaSkeleton is compatible

◆ setState()

void aikido::statespace::dart::MetaSkeletonStateSpace::setState ( ::dart::dynamics::MetaSkeleton *  _metaskeleton,
const State _state 
) const

Sets the positions of the _metaskeleton to _state.

Parameters
_metaskeletonMetaSkeleton to set position for
_stateinput state

Member Data Documentation

◆ mProperties

Properties aikido::statespace::dart::MetaSkeletonStateSpace::mProperties
private