RcsPySim
A robot control and simulation library
Rcs::OMTask Class Reference

#include <OMTask.h>

Inheritance diagram for Rcs::OMTask:
Collaboration diagram for Rcs::OMTask:

Public Member Functions

 OMTask (Task *task)
 
virtual ~OMTask ()
 
 OMTask (const OMTask &)=delete
 
OMTaskoperator= (const OMTask &)=delete
 
 OMTask (OMTask &&)=delete
 
OMTaskoperator= (OMTask &&)=delete
 
virtual unsigned int getStateDim () const
 
virtual void computeObservation (double *state, double *velocity, const MatNd *currentAction, double dt) const
 
virtual void getLimits (double *minState, double *maxState, double *maxVelocity) const
 
virtual std::vector< std::string > getStateNames () const
 
OMTasksetMinState (double minState)
 
OMTasksetMinState (std::vector< double > minState)
 
OMTasksetMaxState (double maxState)
 
OMTasksetMaxState (std::vector< double > maxState)
 
OMTasksetMaxVelocity (double maxVelocity)
 
OMTasksetMaxVelocity (std::vector< double > maxVelocity)
 
Task * getTask () const
 
- Public Member Functions inherited from Rcs::ObservationModel
virtual ~ObservationModel ()
 
MatNd * computeObservation (const MatNd *currentAction, double dt) const
 
void computeObservation (MatNd *observation, const MatNd *currentAction, double dt) const
 
virtual unsigned int getVelocityDim () const
 
virtual void reset ()
 
virtual std::vector< std::string > getVelocityNames () const
 
virtual void getMinMax (double *min, double *max) const final
 
virtual unsigned int getDim () const final
 
virtual std::vector< std::string > getNames () const final
 
template<typename OM >
OM * findModel ()
 
template<typename OM >
Offsets findOffsets ()
 
virtual std::vector< ObservationModel * > getNested () const
 
- Public Member Functions inherited from Rcs::BoxSpaceProvider
 BoxSpaceProvider ()
 
virtual ~BoxSpaceProvider ()
 
 BoxSpaceProvider (const BoxSpaceProvider &)=delete
 
BoxSpaceProvideroperator= (const BoxSpaceProvider &)=delete
 
 BoxSpaceProvider (BoxSpaceProvider &&)=delete
 
BoxSpaceProvideroperator= (BoxSpaceProvider &&)=delete
 
const BoxSpacegetSpace () const
 

Protected Member Functions

void initTaskBodyNames (const char *effectorName, const char *refBodyName, const char *refFrameName)
 

Private Attributes

Task * task
 
std::vector< double > maxVelocity
 

Detailed Description

ObservationModel wrapping a Rcs Task.

Note: By default, the state min/max is taken from the task, and the maximum velocity is set to infinity. Use the various setters to change these limits. All limit setters return this for chanining.

Definition at line 47 of file OMTask.h.

Constructor & Destructor Documentation

◆ OMTask() [1/3]

Rcs::OMTask::OMTask ( Task *  task)

Wrap the given task. Takes ownership of the task object.

Definition at line 42 of file OMTask.cpp.

◆ ~OMTask()

Rcs::OMTask::~OMTask ( )
virtual

Definition at line 44 of file OMTask.cpp.

◆ OMTask() [2/3]

Rcs::OMTask::OMTask ( const OMTask )
delete

◆ OMTask() [3/3]

Rcs::OMTask::OMTask ( OMTask &&  )
delete

Member Function Documentation

◆ computeObservation()

void Rcs::OMTask::computeObservation ( double *  state,
double *  velocity,
const MatNd *  currentAction,
double  dt 
) const
virtual

Implement to fill the observation vector with the observed values.

Parameters
[out]statestate observation vector to fill, has getStateDim() elements.
[out]velocityvelocity observation vector to fill, has getVelocityDim() elements.
[in]currentActionaction in current step. May be NULL if not available.
[in]dttime step since the last observation has been taken

Implements Rcs::ObservationModel.

Reimplemented in Rcs::OMBallPos.

Definition at line 54 of file OMTask.cpp.

◆ getLimits()

void Rcs::OMTask::getLimits ( double *  minState,
double *  maxState,
double *  maxVelocity 
) const
virtual

Provides the minimum and maximum observable values. Since the velocity is symmetric, only the maximum needs to be provided. The default implementation uses -inf and inf.

Parameters
[out]minStateminimum state vector to fill, has getStateDim() elements.
[out]maxStatemaximum state vector to fill, has getStateDim() elements.
[out]maxVelocitymaximum velocity vector to fill, has getVelocityDim() elements.

Reimplemented from Rcs::ObservationModel.

Definition at line 60 of file OMTask.cpp.

◆ getStateDim()

unsigned int Rcs::OMTask::getStateDim ( ) const
virtual

The number of state variables.

Implements Rcs::ObservationModel.

Definition at line 49 of file OMTask.cpp.

◆ getStateNames()

std::vector< std::string > Rcs::OMTask::getStateNames ( ) const
virtual

Provides names for each state entry.

Returns
a vector of name strings. Must be of length getStateDim() or empty for a nameless space.

Reimplemented from Rcs::ObservationModel.

Definition at line 69 of file OMTask.cpp.

◆ getTask()

Task* Rcs::OMTask::getTask ( ) const
inline

Return the wrapped Rcs Task.

Definition at line 101 of file OMTask.h.

◆ initTaskBodyNames()

void Rcs::OMTask::initTaskBodyNames ( const char *  effectorName,
const char *  refBodyName,
const char *  refFrameName 
)
protected

Initialize the task's effector, refBody and refFrame values by looking up the named bodies from the graph.

Parameters
effectorNameName of effector body, a.k.a. the body controlled by the task.
refBodyNameName of reference body, a.k.a. the body the task coordinates should be relative to. Set to NULL to use the world origin.
refFrameNameName of the reference frame body. The task coordinates will be expressed in this body's frame if set. If this is NULL, refBodyName will be used.

Definition at line 139 of file OMTask.cpp.

◆ operator=() [1/2]

OMTask& Rcs::OMTask::operator= ( const OMTask )
delete

◆ operator=() [2/2]

OMTask& Rcs::OMTask::operator= ( OMTask &&  )
delete

◆ setMaxState() [1/2]

OMTask * Rcs::OMTask::setMaxState ( double  maxState)

Set the upper state limit, broadcasting one value to all elements.

Definition at line 109 of file OMTask.cpp.

◆ setMaxState() [2/2]

OMTask * Rcs::OMTask::setMaxState ( std::vector< double >  maxState)

Set the upper state limit. The number of elements must match the state dimension.

Definition at line 117 of file OMTask.cpp.

◆ setMaxVelocity() [1/2]

OMTask * Rcs::OMTask::setMaxVelocity ( double  maxVelocity)

Set the velocity limit, broadcasting one value to all elements.

Definition at line 126 of file OMTask.cpp.

◆ setMaxVelocity() [2/2]

OMTask * Rcs::OMTask::setMaxVelocity ( std::vector< double >  maxVelocity)

Set the velocity limit. The number of elements must match the state dimension.

Definition at line 132 of file OMTask.cpp.

◆ setMinState() [1/2]

OMTask * Rcs::OMTask::setMinState ( double  minState)

Set the lower state limit, broadcasting one value to all elements.

Definition at line 92 of file OMTask.cpp.

◆ setMinState() [2/2]

OMTask * Rcs::OMTask::setMinState ( std::vector< double >  minState)

Set the lower state limit. The number of elements must match the state dimension.

Definition at line 100 of file OMTask.cpp.

Member Data Documentation

◆ maxVelocity

std::vector<double> Rcs::OMTask::maxVelocity
private

Settable maximum velocity (min/max state is stored in task parameter)

Definition at line 121 of file OMTask.h.

◆ task

Task* Rcs::OMTask::task
private

Wrapped task object (owned!)

Definition at line 118 of file OMTask.h.


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