RobWorkProject  23.9.11-
Public Member Functions | Friends | List of all members
QState Class Reference

The configuration state of a work cell. More...

#include <QState.hpp>

Public Member Functions

 QState ()
 Constructs an empty QState.
 
 QState (rw::core::Ptr< rw::kinematics::StateSetup > setup)
 A configuration state. More...
 
virtual ~QState ()
 destructor
 
double * getQ (const rw::kinematics::StateData &data)
 An array of length frame.getDOF() containing the joint values for frame. More...
 
const double * getQ (const rw::kinematics::StateData &data) const
 non const version of getQ.
 
void setQ (const rw::kinematics::StateData &data, const double *vals)
 Assign for frame the frame.getDOF() joint values of the array vals. More...
 
QState operator* (double scale) const
 Scaling of a configuration state by a scalar.
 
QState operator/ (double scale) const
 Scaling of a configuration state by division.
 
QState operator+ (const QState &b) const
 Addition of configuration states.
 
QState operator- (const QState &b) const
 Subtraction of configuration states.
 
QState operator- () const
 Unary minus operator.
 
rw::core::Ptr< rw::kinematics::StateSetupgetStateSetup () const
 returns the StateSetup
 
QStateoperator= (const QState &rhs)
 Assignment operator. More...
 
size_t size () const
 The dimension of the state vector.
 
double & operator() (size_t index)
 Get element of state. More...
 
const double & operator() (size_t index) const
 Get element of state. More...
 
double & operator[] (size_t index)
 Get element of state. More...
 
double operator[] (size_t index) const
 Get element of state. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const QState &state)
 streaming operator More...
 
QState operator* (double scale, const QState &q)
 Scaling of a configuration state by a scalar.
 

Detailed Description

The configuration state of a work cell.

The configuration state contains state data values for all valid StateData in a StateStructure. The validity is defined by the StateSetup.

See Frame::getTransform() for the calculation of the relative transform of a frame for a given configuration state.

Configuration states can be freely copied and assigned.

The configuration state is a part of the StateStructure state (see State).

Constructor & Destructor Documentation

◆ QState()

A configuration state.

This constructor is not available for use outside of RobWork. Instead your configuration states should be constructed via the copy constructor.

Parameters
setup[in] The shared setup for configuration states.

Member Function Documentation

◆ getQ()

double* getQ ( const rw::kinematics::StateData data)

An array of length frame.getDOF() containing the joint values for frame.

It is OK to call this method also for frames with zero degrees of freedom.

Returns
The joint values for the frame.

◆ operator()() [1/2]

double& operator() ( size_t  index)
inline

Get element of state.

Parameters
index[in] the index.
Returns
the value at given index.

◆ operator()() [2/2]

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

Get element of state.

Parameters
index[in] the index.
Returns
the value at given index.

◆ operator=()

QState& operator= ( const QState rhs)

Assignment operator.

Parameters
rhs[in] the other QState to assign to this.
Returns
a reference to this QState.

◆ operator[]() [1/2]

double& operator[] ( size_t  index)
inline

Get element of state.

Parameters
index[in] the index.
Returns
the value at given index.

◆ operator[]() [2/2]

double operator[] ( size_t  index) const
inline

Get element of state.

Parameters
index[in] the index.
Returns
the value at given index.

◆ setQ()

void setQ ( const rw::kinematics::StateData data,
const double *  vals 
)

Assign for frame the frame.getDOF() joint values of the array vals.

The array vals must be of length at least frame.getDOF().

Parameters
data[in] The StateData for which the joint values are assigned.
vals[in] The joint values to assign.

setQ() and getQ() are related as follows:

q_state.setQ(frame, q_in);
const double* q_out = q_state.getQ(frame);
for (int i = 0; i < frame.getDOF(); i++)
q_in[i] == q_out[i];

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const QState state 
)
friend

streaming operator

Parameters
os[in] output stream
state[in] state to stream out
Returns
the stream

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