#include <abstractmulticontroller.h>
Inherits AbstractControllerAdapter.
Inherited by OneActiveMultiPassiveController.
Inheritance diagram for AbstractMultiController:
Public Member Functions | |
AbstractMultiController (AbstractController *controller, std::string controllerName) | |
contructor (hint: use $ID$ for revision) | |
virtual | ~AbstractMultiController () |
virtual void | addPassiveController (AbstractController *passiveController, std::string name) |
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 iparamkeylist | getInternalParamNames () const |
The list of the names of all internal parameters given by getInternalParams(). | |
virtual iparamvallist | getInternalParams () const |
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 |
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, | |
std::string | controllerName | |||
) | [inline] |
contructor (hint: use $ID$ for revision)
virtual ~AbstractMultiController | ( | ) | [inline, virtual] |
virtual void addPassiveController | ( | AbstractController * | passiveController, | |
std::string | name | |||
) | [inline, 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)
virtual iparamkeylist getInternalParamNames | ( | ) | const [inline, virtual] |
The list of the names of all internal parameters given by getInternalParams().
The naming convention is "v[i]" for vectors and "A[i][j]" for matrices, where i, j start at 0.
Reimplemented from AbstractControllerAdapter.
Reimplemented in OneActiveMultiPassiveController.
virtual iparamvallist getInternalParams | ( | ) | const [inline, virtual] |
Reimplemented from AbstractControllerAdapter.
Reimplemented in OneActiveMultiPassiveController.
virtual void init | ( | int | sensornumber, | |
int | motornumber, | |||
RandGen * | randGen = 0 | |||
) | [inline, 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.
virtual bool restore | ( | FILE * | f | ) | [inline, virtual] |
loads the object from the given file stream (binary).
Reimplemented from AbstractControllerAdapter.
Reimplemented in OneActiveMultiPassiveController.
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.
virtual bool store | ( | FILE * | f | ) | const [inline, virtual] |
stores the object to the given file stream (binary).
Reimplemented from AbstractControllerAdapter.
Reimplemented in OneActiveMultiPassiveController.
std::list<AbstractController*> controllerList [protected] |
std::list<std::string> controllerNameList [protected] |