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

#include <OMNormalized.h>

Inheritance diagram for Rcs::OMNormalized:
Collaboration diagram for Rcs::OMNormalized:

Public Member Functions

 OMNormalized (ObservationModel *wrapped, PropertySource *overrideMin, PropertySource *overrideMax)
 
virtual ~OMNormalized ()
 
 OMNormalized (const OMNormalized &)=delete
 
OMNormalizedoperator= (const OMNormalized &)=delete
 
 OMNormalized (OMNormalized &&)=delete
 
OMNormalizedoperator= (OMNormalized &&)=delete
 
virtual unsigned int getStateDim () const
 
virtual unsigned int getVelocityDim () 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 void reset ()
 
virtual std::vector< std::string > getStateNames () const
 
virtual std::vector< ObservationModel * > getNested () const
 
virtual std::vector< std::string > getVelocityNames () 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 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 ()
 
- 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

ObservationModelwrapped
 
MatNd * scale
 
MatNd * shift
 

Detailed Description

Observation model wrapper to normalize observations into the [-1,1] range.

Definition at line 43 of file OMNormalized.h.

Constructor & Destructor Documentation

◆ OMNormalized() [1/3]

Rcs::OMNormalized::OMNormalized ( Rcs::ObservationModel wrapped,
PropertySource overrideMin,
PropertySource overrideMax 
)
explicit

Constructor

Parameters
wrappedinner observation model. Takes ownership.
overrideMinoverridden lower bounds by state name
overrideMaxoverridden upper bounds by state name

Definition at line 58 of file OMNormalized.cpp.

◆ ~OMNormalized()

Rcs::OMNormalized::~OMNormalized ( )
virtual

Definition at line 88 of file OMNormalized.cpp.

◆ OMNormalized() [2/3]

Rcs::OMNormalized::OMNormalized ( const OMNormalized )
delete

◆ OMNormalized() [3/3]

Rcs::OMNormalized::OMNormalized ( OMNormalized &&  )
delete

Member Function Documentation

◆ computeObservation()

void Rcs::OMNormalized::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.

Definition at line 107 of file OMNormalized.cpp.

◆ getLimits()

void Rcs::OMNormalized::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 122 of file OMNormalized.cpp.

◆ getNested()

std::vector< Rcs::ObservationModel * > Rcs::OMNormalized::getNested ( ) const
virtual

List directly nested observation models. The default implementation returns an empty list, since there are no nested models.

Reimplemented from Rcs::ObservationModel.

Definition at line 152 of file OMNormalized.cpp.

◆ getStateDim()

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

The number of state variables.

Implements Rcs::ObservationModel.

Definition at line 97 of file OMNormalized.cpp.

◆ getStateNames()

std::vector< std::string > Rcs::OMNormalized::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 142 of file OMNormalized.cpp.

◆ getVelocityDim()

unsigned int Rcs::OMNormalized::getVelocityDim ( ) const
virtual

The number of velocity variables. The default implementation assumes that for each state there is a velocity.

Reimplemented from Rcs::ObservationModel.

Definition at line 102 of file OMNormalized.cpp.

◆ getVelocityNames()

std::vector< std::string > Rcs::OMNormalized::getVelocityNames ( ) const
virtual

Provides names for each velocity entry. The default implementation derives the names from getStateNames(), appending a 'd' to each name.

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

Reimplemented from Rcs::ObservationModel.

Definition at line 147 of file OMNormalized.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ reset()

void Rcs::OMNormalized::reset ( )
virtual

Reset any internal state. This is called to begin a new episode. It should also reset values depending on modifiable physics parameters. This is an optional operation, so the default implementation does nothing.

Reimplemented from Rcs::ObservationModel.

Definition at line 137 of file OMNormalized.cpp.

Member Data Documentation

◆ scale

MatNd* Rcs::OMNormalized::scale
private

Definition at line 49 of file OMNormalized.h.

◆ shift

MatNd* Rcs::OMNormalized::shift
private

Definition at line 51 of file OMNormalized.h.

◆ wrapped

ObservationModel* Rcs::OMNormalized::wrapped
private

Definition at line 47 of file OMNormalized.h.


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