class for using multiple controller, one for each joint. More...
#include <onecontrollerperchannel.h>
Inherits AbstractController.
Public Member Functions | |
OneControllerPerChannel (ControllerGenerator *controllerGenerator, std::string controllerName, int numCtrlCreateBeforeInit=1, int numContextSensors=0) | |
virtual | ~OneControllerPerChannel () |
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0) |
initialisation of the controller with the given sensor/ motornumber Must be called before use. | |
virtual void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber) |
performs one step (includes learning). | |
virtual void | stepNoLearning (const sensor *sensors, int sensornumber, motor *motors, int motornumber) |
performs one step without learning. | |
virtual int | getSensorNumber () const |
virtual int | getMotorNumber () 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). | |
virtual std::vector < AbstractController * > | getControllers () const |
Protected Attributes | |
std::vector< AbstractController * > | ctrl |
ControllerGenerator * | controllerGenerator |
int | numCtrlCreateBeforeInit |
int | numContextSensors |
int | motornumber |
int | sensornumber |
double * | sensorbuffer |
class for using multiple controller, one for each joint.
Each controller has dimension 1x1. The controller are generated on the fly with a generator object
OneControllerPerChannel | ( | ControllerGenerator * | controllerGenerator, | |
std::string | controllerName, | |||
int | numCtrlCreateBeforeInit = 1 , |
|||
int | numContextSensors = 0 | |||
) |
controllerGenerator | generator object for controller | |
controllerName | name | |
numCtrlCreateBeforeInit | number of controller that are generated before the init function is called. Useful if they should be put into the inspectable list of the agent | |
numContextSensors | number of context sensors (counted from the end) passed to all controllers |
~OneControllerPerChannel | ( | ) | [virtual] |
virtual std::vector<AbstractController*> getControllers | ( | ) | const [inline, virtual] |
virtual int getMotorNumber | ( | ) | const [inline, virtual] |
Implements AbstractController.
virtual int getSensorNumber | ( | ) | const [inline, virtual] |
Implements AbstractController.
void init | ( | int | sensornumber, | |
int | motornumber, | |||
RandGen * | randGen = 0 | |||
) | [virtual] |
initialisation of the controller with the given sensor/ motornumber Must be called before use.
The random generator is optional.
Implements AbstractController.
bool restore | ( | FILE * | f | ) | [virtual] |
loads the object from the given file stream (binary).
Implements Storeable.
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 |
Implements AbstractController.
bool store | ( | FILE * | f | ) | const [virtual] |
stores the object to the given file stream (binary).
Implements Storeable.
ControllerGenerator* controllerGenerator [protected] |
std::vector<AbstractController*> ctrl [protected] |
int motornumber [protected] |
int numContextSensors [protected] |
int numCtrlCreateBeforeInit [protected] |
double* sensorbuffer [protected] |
int sensornumber [protected] |