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

#include <AMNormalized.h>

Inheritance diagram for Rcs::AMNormalized:
Collaboration diagram for Rcs::AMNormalized:

Public Member Functions

 AMNormalized (ActionModel *wrapped)
 
virtual ~AMNormalized ()
 
 AMNormalized (const AMNormalized &)=delete
 
AMNormalizedoperator= (const AMNormalized &)=delete
 
 AMNormalized (AMNormalized &&)=delete
 
AMNormalizedoperator= (AMNormalized &&)=delete
 
virtual ActionModelclone (RcsGraph *newGraph) const
 
virtual unsigned int getDim () const
 
virtual void getMinMax (double *min, double *max) const
 
virtual std::vector< std::string > getNames () const
 
virtual void computeCommand (MatNd *q_des, MatNd *q_dot_des, MatNd *T_des, const MatNd *action, double dt)
 
virtual void reset ()
 
virtual void getStableAction (MatNd *action) const
 
virtual ActionModelgetWrappedActionModel () const
 
- Public Member Functions inherited from Rcs::ActionModel
 ActionModel (RcsGraph *graph)
 
virtual ~ActionModel ()
 
ActionModelclone () const
 
RcsGraph * getGraph ()
 
void setGraph (RcsGraph *newGraph)
 
const ActionModelunwrapAll () const
 
ActionModelunwrapAll ()
 
template<typename AM >
const AM * unwrap () const
 
template<typename AM >
AM * unwrap ()
 
- 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
 

Private Attributes

ActionModelwrapped
 
MatNd * scale
 
MatNd * shift
 

Additional Inherited Members

- Protected Attributes inherited from Rcs::ActionModel
RcsGraph * graph
 

Detailed Description

Wraps another action model to accept normalized action values in the range [-1, 1]. The passed action values are denormalized and then passed to the wrapped action model.

Definition at line 43 of file AMNormalized.h.

Constructor & Destructor Documentation

◆ AMNormalized() [1/3]

Rcs::AMNormalized::AMNormalized ( ActionModel wrapped)

Definition at line 39 of file AMNormalized.cpp.

◆ ~AMNormalized()

Rcs::AMNormalized::~AMNormalized ( )
virtual

Definition at line 59 of file AMNormalized.cpp.

◆ AMNormalized() [2/3]

Rcs::AMNormalized::AMNormalized ( const AMNormalized )
delete

◆ AMNormalized() [3/3]

Rcs::AMNormalized::AMNormalized ( AMNormalized &&  )
delete

Member Function Documentation

◆ clone()

ActionModel * Rcs::AMNormalized::clone ( RcsGraph *  newGraph) const
virtual

Create a deep copy of this action model. The graph the action model operates on is replaced with newGraph.

Parameters
newGraphoptionally, replace the graph used with newGraph.
Returns
deep copy with new graph.

Implements Rcs::ActionModel.

Definition at line 122 of file AMNormalized.cpp.

◆ computeCommand()

void Rcs::AMNormalized::computeCommand ( MatNd *  q_des,
MatNd *  q_dot_des,
MatNd *  T_des,
const MatNd *  action,
double  dt 
)
virtual

Compute the joint commands from a specified action and the current state.

Parameters
[out]q_desdesired joint positions
[out]q_dot_desdesired joint velocities
[out]T_desdesired joint torques
[in]actioninput action values
dtdifference in time since the last call.

Implements Rcs::ActionModel.

Definition at line 80 of file AMNormalized.cpp.

◆ getDim()

unsigned int Rcs::AMNormalized::getDim ( ) const
virtual

Provides the number of elements in the space. Since the BoxSpace object will be cached, this must not change.

Returns
number of elements for the space.

Implements Rcs::BoxSpaceProvider.

Definition at line 64 of file AMNormalized.cpp.

◆ getMinMax()

void Rcs::AMNormalized::getMinMax ( double *  min,
double *  max 
) const
virtual

Provides minimum and maximum values for the space.

The passed arrays will be large enough to hold getDim() values.

Parameters
[out]minminimum value storage
[out]maxmaximum value storage

Implements Rcs::BoxSpaceProvider.

Definition at line 69 of file AMNormalized.cpp.

◆ getNames()

std::vector< std::string > Rcs::AMNormalized::getNames ( ) const
virtual

Provides names for each entry of the space.

These are intended for use in python, i.e., for pandas dataframe column names.

Returns
a vector of name strings. Must be of length getDim() or empty.

Reimplemented from Rcs::BoxSpaceProvider.

Definition at line 75 of file AMNormalized.cpp.

◆ getStableAction()

void Rcs::AMNormalized::getStableAction ( MatNd *  action) const
virtual

Obtain action values which would keep the system in the current state. For action variables which are velocities or accelerations, this should be 0. For action variables which are positions, this should be the current position.

Parameters
[out]actionmatrix to write the values into

Implements Rcs::ActionModel.

Definition at line 107 of file AMNormalized.cpp.

◆ getWrappedActionModel()

ActionModel * Rcs::AMNormalized::getWrappedActionModel ( ) const
virtual

If this ActionModel is a wrapper for another action model, return the wrapped action model. Otherwise, return NULL.

Returns
wrapped action model or NULL if none.

Reimplemented from Rcs::ActionModel.

Definition at line 117 of file AMNormalized.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ reset()

void Rcs::AMNormalized::reset ( )
virtual

Called at the start of a rollout to reset any state modified by computeCommand(). This allows to reuse the ActionModel for a new simulation rollout. The graph state will already be reset, so it can be used safely. It will be called before the first rollout too, so it can also be used to setup internals that depend on operations in subclass constructors.

Reimplemented from Rcs::ActionModel.

Definition at line 102 of file AMNormalized.cpp.

Member Data Documentation

◆ scale

MatNd* Rcs::AMNormalized::scale
private

Definition at line 49 of file AMNormalized.h.

◆ shift

MatNd* Rcs::AMNormalized::shift
private

Definition at line 51 of file AMNormalized.h.

◆ wrapped

ActionModel* Rcs::AMNormalized::wrapped
private

Definition at line 47 of file AMNormalized.h.


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