RobWorkProject  6.6.6
Public Member Functions | Friends | List of all members
StateMsg Class Reference

The state of a work cell (or kinematics tree). More...

#include <StateMsg.hpp>

Inherits State.

Public Member Functions

 StateMsg ()
 Default constructor giving an empty state. Beware that the state is not initialized and that passing this state to a procedure will typically cause a program crash.
 
void copy (const State &src)
 copies data from a state into this state. The version of the state is allowed to be different from this state. Only state data that is valid for both states will be copied. More...
 
void clone (const State &src)
 performs a deep copy of src into this state. More...
 
void upgrade ()
 this function upgrades the current version of this State to the newest state. It will not override data values that is set in the current state.
 
void upgradeTo (const State &state)
 this function upgrades the current version of this State with the given state. It will not override data values that is set in the current state.
 
size_t size () const
 The dimension of the state vector. More...
 
double & operator() (size_t index)
 Provides direct access to the configurations stored in the state. More...
 
const double & operator() (size_t index) const
 Provides direct read access to the configurations stored in the state. More...
 
double & operator[] (size_t index)
 Same as operator().
 
const double & operator[] (size_t index) const
 Same as operator().
 
FramegetFrame (int id)
 gets the frame with id id. If a frame with id id does not exist NULL is returned
 
int getUniqueId () const
 get the state id. Represents the static structure of the StateStructure that this state relates to.
 
rw::core::Ptr< StateStructuregetStateStructure () const
 Returns pointer to the state structure (the structure of Frame's and StateData) More...
 
- Public Member Functions inherited from State
 State ()
 Default constructor giving an empty state. Beware that the state is not initialized and that passing this state to a procedure will typically cause a program crash.
 
virtual ~State ()
 destructor
 
void setQStateInState (State &to) const
 Assign to a state the configuration state of this state. More...
 
void setTreeStateInState (State &to) const
 Assign to a state the tree state of this state. More...
 
State operator- () const
 Unary minus operator. More...
 
void copy (const State &src)
 copies data from a state into this state. The version of the state is allowed to be different from this state. Only state data that is valid for both states will be copied. More...
 
State clone ()
 performs a deep copy of this state and returns the clone. Both QState and TreeState are (deep) copied as normal however the cachestates will be copied using their clone method. More...
 
void clone (const State &src)
 performs a deep copy of src into this state. More...
 
void upgrade ()
 this function upgrades the current version of this State to the newest state. It will not override data values that is set in the current state.
 
void upgradeTo (const State &state)
 this function upgrades the current version of this State with the given state. It will not override data values that is set in the current state.
 
size_t size () const
 The dimension of the configuration state vector. More...
 
double & operator() (size_t index)
 Provides direct access to the configurations stored in the state. More...
 
const double & operator() (size_t index) const
 Provides direct read access to the configurations stored in the state. More...
 
double & operator[] (size_t index)
 Same as operator().
 
const double & operator[] (size_t index) const
 Same as operator().
 
FramegetFrame (int id)
 gets the frame with id id. If a frame with id id does not exist NULL is returned
 
int getUniqueId () const
 get the state id. Represents the static structure of the StateStructure that this state relates to.
 
rw::core::Ptr< StateStructuregetStateStructure () const
 Returns pointer to the state structure (the structure of Frame's and StateData) More...
 
void read (class rw::common::InputArchive &iarchive, const std::string &id)
 
void write (class rw::common::OutputArchive &oarchive, const std::string &id) const
 
- Public Member Functions inherited from Serializable
virtual ~Serializable ()
 destructor
 

Friends

class StateData
 the basic building block for the stateless design using the StateStructure class. A StateData represents a size, a unique id, and a unique name, when inserted into the StateStructure. The size will allocate "size"-doubles in State objects originating from the StateStructure. More...
 
class Frame
 The type of node of forward kinematic trees. More...
 
class StateStructure
 the StateStructure is responsible for handling a structure of StateData and Frames More...
 

Additional Inherited Members

- Public Types inherited from State
typedef rw::core::Ptr< StatePtr
 Smart pointer type to State.
 
typedef double value_type
 Value type.
 
- Static Public Member Functions inherited from State
static const StategetDefault (StateData *data)
 Get default. More...
 

Detailed Description

The state of a work cell (or kinematics tree).

You need a work cell state in order to calculate forward kinematics for trees of frames.

Work cell states can be copied and assigned freely.

The work cell state consists of a part for the tree structure and a part for the configuration values. You are encouraged to use the getParent(), getChildren(), getQ() and setQ() utility functions rather than explicitly type, say, state.getQState().getQ(). That way you will have a much easier time of updating the code if we decide to change the way the kinematics data structures are stored (!). Also getQ(state, frame) is shorter to type also.

The operation of a work cell state is undefined valid if the tree used for its initialization is modified. (The implementation takes some care to check for this and crashes the program in a controlled way if it takes place.)

Member Function Documentation

◆ clone()

void clone ( const State src)

performs a deep copy of src into this state.

Parameters
src[in] the state that is to be cloned

◆ copy()

void copy ( const State src)

copies data from a state into this state. The version of the state is allowed to be different from this state. Only state data that is valid for both states will be copied.

Parameters
src[in] the state that is to be copied

◆ getStateStructure()

rw::core::Ptr<StateStructure> getStateStructure ( ) const

Returns pointer to the state structure (the structure of Frame's and StateData)

Returns
Pointer to the StateStructure matching the frame

◆ operator()() [1/2]

double& operator() ( size_t  index)
inline

Provides direct access to the configurations stored in the state.

Notice that modifying a state directly may result in the state being inconsistent

Parameters
index[in] Index of element to access

◆ operator()() [2/2]

const double& operator() ( size_t  index) const
inline

Provides direct read access to the configurations stored in the state.

Parameters
index[in] Index of element to access

◆ size()

size_t size ( ) const
inline

The dimension of the state vector.

Knowing the size of the state is useful for example in error messages, so that you can report if two states seem to belong to different workcells.

Friends And Related Function Documentation

◆ Frame

friend class Frame
friend

The type of node of forward kinematic trees.

Types of joints are implemented as subclasses of Frame. The responsibility of a joint is to implement the getTransform() method that returns the transform of the frame relative to whatever parent it is attached to.

The getTransform() method takes as parameter the set of joint values State for the tree. Joint values for a particular frame can be accessed via State::getQ(). A frame may contain pointers to other frames so that the transform of a frame may depend on the joint values for other frames also.

◆ StateData

friend class StateData
friend

the basic building block for the stateless design using the StateStructure class. A StateData represents a size, a unique id, and a unique name, when inserted into the StateStructure. The size will allocate "size"-doubles in State objects originating from the StateStructure.

◆ StateStructure

friend class StateStructure
friend

the StateStructure is responsible for handling a structure of StateData and Frames


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