Abstract class (interface) for using multiple controller. More...
#include <abstractmulticontroller.h>
Inherits AbstractControllerAdapter.
Inherited by OneActiveMultiPassiveController.
Public Member Functions | |
AbstractMultiController (AbstractController *controller, const std::string &name, const std::string &revision) | |
contructor (hint: use $ID$ for revision) | |
virtual | ~AbstractMultiController () |
virtual void | addPassiveController (AbstractController *passiveController) |
Adds a passive controller to this MultiController. | |
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0) |
initialisation of the controller with the given sensor/ motornumber Must NORMALLY be called before use. | |
virtual void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber)=0 |
performs one step (includes learning). | |
virtual void | stepNoLearning (const sensor *sensors, int sensornumber, motor *motors, int motornumber)=0 |
performs one step without learning. | |
virtual bool | store (FILE *f) const |
stores the object to the given file stream (binary). | |
virtual bool | restore (FILE *f) |
loads the object from the given file stream (binary). | |
Protected Attributes | |
std::list< AbstractController * > | controllerList |
std::list< std::string > | controllerNameList |
Abstract class (interface) for using multiple controller.
A controller gets a number of input sensor values each timestep and has to generate a number of output motor values
This is an abstract class, it's useful for implementing multicontrollers such as the OneActiveMultiPassiveController, which can be used with all Controllers.
Any MulitController implementing this class should overwrite the methods step(...) and stepNoLearning(...).
AbstractMultiController | ( | AbstractController * | controller, | |
const std::string & | name, | |||
const std::string & | revision | |||
) |
contructor (hint: use $ID$ for revision)
~AbstractMultiController | ( | ) | [virtual] |
void addPassiveController | ( | AbstractController * | passiveController | ) | [virtual] |
Adds a passive controller to this MultiController.
If the Agent calls step(..) or stepNoLearning(..), the MultiController calls not only the active controllers step(...) but also the step(...) of all the passive controllers. (same for stepNoLearning(..) ).
Note: The initialisation of the MultiController with init(sensornumber, motornumber) must be called after all passive controllers are added, otherwise you must init the passive controller yourself (not recommended and can generate problems)
void init | ( | int | sensornumber, | |
int | motornumber, | |||
RandGen * | randGen = 0 | |||
) | [virtual] |
initialisation of the controller with the given sensor/ motornumber Must NORMALLY be called before use.
For all multicontroller call first AbstractMultiController::init(sensornumber,motornumber) if you overwrite this method
Reimplemented from AbstractControllerAdapter.
Reimplemented in OneActiveMultiPassiveController.
bool restore | ( | FILE * | f | ) | [virtual] |
loads the object from the given file stream (binary).
Reimplemented from AbstractControllerAdapter.
virtual void step | ( | const sensor * | sensors, | |
int | sensornumber, | |||
motor * | motors, | |||
int | motornumber | |||
) | [pure virtual] |
performs one step (includes learning).
Calculates motor commands from sensor inputs.
sensors | sensors inputs scaled to [-1,1] | |
sensornumber | length of the sensor array | |
motors | motors outputs. MUST have enough space for motor values! | |
motornumber | length of the provided motor array |
Reimplemented from AbstractControllerAdapter.
Implemented in OneActiveMultiPassiveController.
virtual void stepNoLearning | ( | const sensor * | sensors, | |
int | sensornumber, | |||
motor * | motors, | |||
int | motornumber | |||
) | [pure virtual] |
performs one step without learning.
Reimplemented from AbstractControllerAdapter.
Implemented in OneActiveMultiPassiveController.
bool store | ( | FILE * | f | ) | const [virtual] |
stores the object to the given file stream (binary).
Reimplemented from AbstractControllerAdapter.
std::list<AbstractController*> controllerList [protected] |
std::list<std::string> controllerNameList [protected] |