#include <basiccontroller.h>
Inherits InvertMotorController.
Inheritance diagram for BasicController:


Public Member Functions | |
| BasicController (const BasicControllerConf &conf=getDefaultConf()) | |
| 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 | ~BasicController () |
| virtual int | getSensorNumber () const |
| returns the number of sensors the controller was initialised with or 0 if not initialised | |
| virtual int | getMotorNumber () const |
| returns the mumber of motors the controller was initialised with or 0 if not initialised | |
| virtual void | step (const sensor *, int number_sensors, motor *, int number_motors) |
| performs one step (includes learning). | |
| virtual void | stepNoLearning (const sensor *, int number_sensors, motor *, int number_motors) |
| performs one step without learning. Calulates motor commands from sensor inputs. | |
| virtual bool | store (FILE *f) const |
| stores the controller values to a given file. | |
| virtual bool | restore (FILE *f) |
| loads the controller values from a given file. | |
| virtual iparamkeylist | getInternalParamNames () const |
| The list of the names of all internal parameters given by getInternalParams(). | |
| virtual iparamvallist | getInternalParams () const |
| virtual ilayerlist | getStructuralLayers () const |
| Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important. | |
| virtual iconnectionlist | getStructuralConnections () const |
| Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important. | |
| virtual bool | setParam (const paramkey &key, paramval val) |
| void | getLastMotors (motor *motors, int len) |
| virtual double | calcMatrixNorm (const matrix::Matrix &m) |
| calculates the city block distance (abs) norm of the matrix. (abs sum of absolutes / size of matrix) | |
Static Public Member Functions | |
| static BasicControllerConf | getDefaultConf () |
| The given sensor teaching signal (distal learning) is used for this timestep. | |
Protected Member Functions | |
| virtual void | fillBuffersAndControl (const sensor *x_, int number_sensors, motor *y_, int number_motors) |
| puts the sensors in the ringbuffer, generate controller values and put them in the | |
| virtual void | learnController (int delay) |
| learn values H,C This is the implementation uses a better formula for g^-1 using Mittelwertsatz | |
| virtual void | learnModel (int delay) |
| learn conf.model, (and S) using motors y and corresponding sensors x | |
| virtual matrix::Matrix | calculateControllerValues (const matrix::Matrix &x_smooth) |
| returns controller output for given sensor values | |
| matrix::Matrix | calcDerivatives (const matrix::Matrix *buffer, int delay) |
| Calculates first and second derivative and returns both in on matrix (above). | |
Protected Attributes | |
| unsigned short | number_sensors |
| unsigned short | number_motors |
| matrix::Matrix | A |
| Model Matrix (motors to sensors). | |
| matrix::Matrix | A_Hat |
| Model Matrix (motors to sensors) with input shift. | |
| matrix::Matrix | S |
| additional Model Matrix (sensors to sensors) | |
| matrix::Matrix | C |
| Controller Matrix. | |
| matrix::Matrix | GSC |
| G_Prime times Controller Matrix. | |
| matrix::Matrix | DD |
| Noise Matrix. | |
| matrix::Matrix | Dinverse |
| Inverse Noise Matrix. | |
| matrix::Matrix | H |
| Controller Bias. | |
| matrix::Matrix | B |
| Model Bias. | |
| NoiseGenerator * | BNoiseGen |
| Noisegenerator for noisy bias. | |
| NoiseGenerator * | YNoiseGen |
| Noisegenerator for noisy motor values. | |
| matrix::Matrix | R |
| C*A. | |
| matrix::Matrix | RRT_inv |
| matrix::Matrix | ATA_inv |
| matrix::Matrix | Rm1 |
| R^-1. | |
| matrix::Matrix | ID |
| identity matrix in the dimension of R | |
| matrix::Matrix | ID_Sensor |
| identity matrix in the dimension of sensor space | |
| matrix::Matrix | CST |
| matrix::Matrix | CCT_inv |
| matrix::Matrix | xsi |
| current output error | |
| double | xsi_norm |
| norm of matrix | |
| double | xsi_norm_avg |
| average norm of xsi (used to define whether Modell learns) | |
| double | pain |
| if the modelling error (xsi) is too high we have a pain signal | |
| matrix::Matrix * | x_buffer |
| matrix::Matrix * | y_buffer |
| matrix::Matrix * | eta_buffer |
| matrix::Matrix | eta |
| matrix::Matrix | v_smooth |
| matrix::Matrix | zero_eta |
| matrix::Matrix | x_smooth |
| matrix::Matrix | y_smooth |
| matrix::Matrix | eta_smooth |
| matrix::Matrix | x_smooth_long |
| matrix::Matrix | y_teaching |
| teaching motor signal | |
| bool | useTeaching |
| flag whether there is an actual teachning signal or not | |
| matrix::Matrix | x_intern |
| fantasy sensor values | |
| int | fantControl |
| interval length for fantasising | |
| int | fantControlLen |
| length of fantasy control | |
| int | fantReset |
| number of fantasy control events before reseting internal state | |
| int | t_rand |
| initial random time to avoid syncronous management of all controllers | |
| int | managementInterval |
| interval between subsequent management function calls | |
| paramval | dampS |
| damping of S matrix | |
| paramval | dampC |
| damping of C matrix | |
| paramval | dampH |
| damping of H vector | |
| paramval | weighting |
| general weighting fator between update concepts | |
| BasicControllerConf | conf |
| BasicController | ( | const BasicControllerConf & | conf = getDefaultConf() |
) |
| ~BasicController | ( | ) | [virtual] |
| Matrix calcDerivatives | ( | const matrix::Matrix * | buffer, | |
| int | delay | |||
| ) | [protected] |
Calculates first and second derivative and returns both in on matrix (above).
We use simple discrete approximations:
where we have to go into the past because we do not have f(x+1). The scaling can be neglegted.
| double calcMatrixNorm | ( | const matrix::Matrix & | m | ) | [virtual] |
calculates the city block distance (abs) norm of the matrix. (abs sum of absolutes / size of matrix)
| Matrix calculateControllerValues | ( | const matrix::Matrix & | x_smooth | ) | [protected, virtual] |
returns controller output for given sensor values
| x_smooth | smoothed sensors Matrix(number_channels,1) |
| void fillBuffersAndControl | ( | const sensor * | x_, | |
| int | number_sensors, | |||
| motor * | y_, | |||
| int | number_motors | |||
| ) | [protected, virtual] |
puts the sensors in the ringbuffer, generate controller values and put them in the
| static BasicControllerConf getDefaultConf | ( | ) | [inline, static] |
The given sensor teaching signal (distal learning) is used for this timestep.
First the belonging motor teachung signal is calculated by the inverse model. See setMotorTeachingSignal
| list< Inspectable::iparamkey > getInternalParamNames | ( | ) | const [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 Inspectable.
| list< Inspectable::iparamval > getInternalParams | ( | ) | const [virtual] |
| void getLastMotors | ( | motor * | motors, | |
| int | len | |||
| ) |
| virtual int getMotorNumber | ( | ) | const [inline, virtual] |
returns the mumber of motors the controller was initialised with or 0 if not initialised
Implements AbstractController.
| virtual int getSensorNumber | ( | ) | const [inline, virtual] |
returns the number of sensors the controller was initialised with or 0 if not initialised
Implements AbstractController.
| list< Inspectable::IConnection > getStructuralConnections | ( | ) | const [virtual] |
Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important.
Reimplemented from Inspectable.
| list< Inspectable::ILayer > getStructuralLayers | ( | ) | const [virtual] |
Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important.
The first entry is the input layer and so on.
Reimplemented from Inspectable.
| 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.
| void learnController | ( | int | delay | ) | [protected, virtual] |
learn values H,C This is the implementation uses a better formula for g^-1 using Mittelwertsatz
| delay | 0 for no delay and n>0 for n timesteps delay in the SML (s4delay) |
| void learnModel | ( | int | delay | ) | [protected, virtual] |
learn conf.model, (and S) using motors y and corresponding sensors x
| bool restore | ( | FILE * | f | ) | [virtual] |
performs one step (includes learning).
Calulates motor commands from sensor inputs.
Implements AbstractController.
performs one step without learning. Calulates motor commands from sensor inputs.
Implements AbstractController.
| bool store | ( | FILE * | f | ) | const [virtual] |
matrix::Matrix A [protected] |
Model Matrix (motors to sensors).
matrix::Matrix A_Hat [protected] |
Model Matrix (motors to sensors) with input shift.
matrix::Matrix ATA_inv [protected] |
matrix::Matrix B [protected] |
Model Bias.
NoiseGenerator* BNoiseGen [protected] |
Noisegenerator for noisy bias.
matrix::Matrix C [protected] |
Controller Matrix.
matrix::Matrix CCT_inv [protected] |
BasicControllerConf conf [protected] |
matrix::Matrix CST [protected] |
matrix::Matrix DD [protected] |
Noise Matrix.
matrix::Matrix Dinverse [protected] |
Inverse Noise Matrix.
matrix::Matrix eta [protected] |
matrix::Matrix* eta_buffer [protected] |
matrix::Matrix eta_smooth [protected] |
int fantControl [protected] |
interval length for fantasising
int fantControlLen [protected] |
length of fantasy control
int fantReset [protected] |
number of fantasy control events before reseting internal state
matrix::Matrix GSC [protected] |
G_Prime times Controller Matrix.
matrix::Matrix H [protected] |
Controller Bias.
matrix::Matrix ID [protected] |
identity matrix in the dimension of R
matrix::Matrix ID_Sensor [protected] |
identity matrix in the dimension of sensor space
int managementInterval [protected] |
interval between subsequent management function calls
unsigned short number_motors [protected] |
unsigned short number_sensors [protected] |
double pain [protected] |
if the modelling error (xsi) is too high we have a pain signal
matrix::Matrix R [protected] |
C*A.
matrix::Matrix Rm1 [protected] |
R^-1.
matrix::Matrix RRT_inv [protected] |
matrix::Matrix S [protected] |
additional Model Matrix (sensors to sensors)
int t_rand [protected] |
initial random time to avoid syncronous management of all controllers
bool useTeaching [protected] |
flag whether there is an actual teachning signal or not
matrix::Matrix v_smooth [protected] |
matrix::Matrix* x_buffer [protected] |
matrix::Matrix x_intern [protected] |
fantasy sensor values
matrix::Matrix x_smooth [protected] |
matrix::Matrix x_smooth_long [protected] |
matrix::Matrix xsi [protected] |
current output error
double xsi_norm [protected] |
norm of matrix
double xsi_norm_avg [protected] |
average norm of xsi (used to define whether Modell learns)
matrix::Matrix* y_buffer [protected] |
matrix::Matrix y_smooth [protected] |
matrix::Matrix y_teaching [protected] |
teaching motor signal
NoiseGenerator* YNoiseGen [protected] |
Noisegenerator for noisy motor values.
matrix::Matrix zero_eta [protected] |
1.4.7