RobWorkProject
23.9.11-
|
The state of a work cell (or kinematics tree). More...
#include <State.hpp>
Inherits Serializable.
Public Types | |
typedef rw::core::Ptr< State > | Ptr |
Smart pointer type to State. | |
typedef double | value_type |
Value type. | |
Public Member Functions | |
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* (double scale) const |
Scaling of the configuration state by a scalar. More... | |
State | operator/ (double scale) const |
Scaling of the configuration state by division. More... | |
State | operator+ (const State &b) const |
Addition of configuration states. More... | |
State | operator- (const State &b) const |
Subtraction of configuration states. 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(). | |
rw::kinematics::Frame * | getFrame (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< StateStructure > | getStateStructure () 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 | |
Static Public Member Functions | |
static const State & | getDefault (rw::kinematics::StateData *data) |
Get default. More... | |
Friends | |
class | StateData |
class | Frame |
class | StateStructure |
State | operator* (double scale, const State &state) |
Scaling of the configuration state by a scalar. More... | |
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.)
State clone | ( | ) |
void clone | ( | const State & | src | ) |
performs a deep copy of src into this state.
src | [in] the state that is to be cloned |
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.
src | [in] the state that is to be copied |
|
static |
Get default.
data | [in] the state data. |
rw::core::Ptr<StateStructure> getStateStructure | ( | ) | const |
Returns pointer to the state structure (the structure of Frame's and StateData)
|
inline |
Provides direct access to the configurations stored in the state.
Notice that modifying a state directly may result in the state being inconsistent
index | [in] Index of element to access |
|
inline |
Provides direct read access to the configurations stored in the state.
index | [in] Index of element to access |
|
inline |
Scaling of the configuration state by a scalar.
The tree state remains the same.
Addition of configuration states.
It is undefined whether it is the tree state of a or b that is used for the resulting state. We say that it is undefined to force you to use setTreeStateInState() to make you explicitly choose the tree state.
|
inline |
Unary minus operator.
The tree state remains the same.
Subtraction of configuration states.
It is undefined whether it is the tree state of a or b that is used for the resulting state. We say that it is undefined to force you to use setTreeStateInState() to make you explicitly choose the tree state.
|
inline |
Scaling of the configuration state by division.
The tree state remains the same.
|
virtual |
Enable read-serialization of inherited class by implementing this method. Data is read from iarchive and filled into this object.
iarchive | [in] the InputArchive from which to read data. |
id | [in] The id of the serialized sobject. |
Implements Serializable.
|
inline |
Assign to a state the configuration state of this state.
The State can be thought of as consisting of a tree state (TreeState) (for the structure of the tree) and a configuration state (QState) (containing joint values, for example). The setQStateInState() method copies into this state the QState part of another state.
to | [out] The state to which the configuration state is written. |
|
inline |
Assign to a state the tree state of this state.
The State can be thought of as consisting of a tree state (TreeState) (for the structure of the tree) and a configuration state (QState) (containing joint values, for example). The setTreeState() method copies into this state the TreeState part of another state.
Implementation note: setTreeStateInState() is currently a lot faster than setQStateInState() (even though they are both fast), so if you have the choice then use the former.
to | [out] The state to which the tree state is written. |
|
inline |
The dimension of the configuration 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.
|
virtual |
Enable write-serialization of inherited class by implementing this method. Data is written to oarchive from this object.
oarchive | [out] the OutputArchive in which data should be written. |
id | [in] The id of the serialized sobject. |
Implements Serializable.
Scaling of the configuration state by a scalar.
The tree state remains the same.