RcsPySim
A robot control and simulation library
Rcs::ControlPolicy Class Referenceabstract

#include <ControlPolicy.h>

Inheritance diagram for Rcs::ControlPolicy:

Public Types

typedef ControlPolicy *(* ControlPolicyCreateFunction) (const char *)
 

Public Member Functions

 ControlPolicy ()
 
virtual ~ControlPolicy ()
 
virtual void reset ()
 
virtual void computeAction (MatNd *action, const MatNd *observation)=0
 

Static Public Member Functions

static void registerType (const char *name, ControlPolicyCreateFunction creator)
 
static ControlPolicycreate (const char *name, const char *dataFile)
 
static ControlPolicycreate (PropertySource *config)
 
static std::vector< std::string > getTypeNames ()
 

Detailed Description

Base class for a control policy that computes the actions from a given observation vector.

Definition at line 47 of file ControlPolicy.h.

Member Typedef Documentation

◆ ControlPolicyCreateFunction

typedef ControlPolicy*(* Rcs::ControlPolicy::ControlPolicyCreateFunction) (const char *)

Policy factory function. Should read a policy from a file.

Definition at line 53 of file ControlPolicy.h.

Constructor & Destructor Documentation

◆ ControlPolicy()

Rcs::ControlPolicy::ControlPolicy ( )

Definition at line 95 of file ControlPolicy.cpp.

◆ ~ControlPolicy()

Rcs::ControlPolicy::~ControlPolicy ( )
virtual

Definition at line 100 of file ControlPolicy.cpp.

Member Function Documentation

◆ computeAction()

virtual void Rcs::ControlPolicy::computeAction ( MatNd *  action,
const MatNd *  observation 
)
pure virtual

Compute the action according to the policy.

Parameters
[out]actionmatrix to store the action in
[in]observationcurrent observed state

Implemented in Rcs::SimpleControlPolicy, and Rcs::TorchPolicy.

◆ create() [1/2]

ControlPolicy * Rcs::ControlPolicy::create ( const char *  name,
const char *  dataFile 
)
static

Load a saved policy.

Parameters
[in]namepolicy type name
[in]dataFilefile to load
Returns
loaded policy

Definition at line 52 of file ControlPolicy.cpp.

◆ create() [2/2]

ControlPolicy * Rcs::ControlPolicy::create ( PropertySource config)
static

Load a saved policy defined by the given configuration.

Parameters
[in]configproperty config, containing type and file entries
Returns
loaded policy

Definition at line 77 of file ControlPolicy.cpp.

◆ getTypeNames()

std::vector< std::string > Rcs::ControlPolicy::getTypeNames ( )
static

List available policy names.

Definition at line 86 of file ControlPolicy.cpp.

◆ registerType()

void Rcs::ControlPolicy::registerType ( const char *  name,
ControlPolicy::ControlPolicyCreateFunction  creator 
)
static

Register a control policy type.

Parameters
[in]namepolicy type name
[in]creatorfactory function

Definition at line 46 of file ControlPolicy.cpp.

◆ reset()

void Rcs::ControlPolicy::reset ( )
virtual

Reset internal state if any. The default implementation does nothing.

Reimplemented in Rcs::TorchPolicy.

Definition at line 105 of file ControlPolicy.cpp.


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