RobWorkProject
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 (boost::shared_ptr< StateSetup > setup)
 A configuration state. More...
 
virtual ~QState ()
 destructor
 
const double * getQ (const StateData &data) const
 An array of length frame.getDOF() containing the joint values for frame. More...
 
double * getQ (const StateData &data)
 non const version of getQ.
 
void setQ (const StateData &data, const double *vals)
 Assign for frame the frame.getDOF() joint values of the array vals. More...
 
QState operator- () const
 Unary minus operator.
 
boost::shared_ptr< 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
 

Friends

std::ostream & operator<< (std::ostream &os, const QState &state)
 streaming operator More...
 
QState operator* (const QState &q, double scale)
 Scaling of a configuration state by a scalar.
 
QState operator/ (const QState &q, double scale)
 Scaling of a configuration state by division.
 
QState operator* (double scale, const QState &q)
 Scaling of a configuration state by a scalar.
 
QState operator+ (const QState &a, const QState &b)
 Addition of configuration states.
 
QState operator- (const QState &a, const QState &b)
 Subtraction of configuration states.
 

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()

QState ( boost::shared_ptr< StateSetup setup)
explicit

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()

const double* getQ ( const StateData data) const

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

◆ operator=()

QState& operator= ( const QState rhs)

Assignment operator.

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

◆ setQ()

void setQ ( const 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: