Robotsystem of the Robot Group Leipzig: InvertMotorBigModel Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# InvertMotorBigModel Class Reference

class for robot controller is based on InvertMotorNStep More...

`#include <invertmotorbigmodel.h>`

Inherits InvertMotorController.

Inheritance diagram for InvertMotorBigModel:

[legend]
Collaboration diagram for InvertMotorBigModel:

[legend]
List of all members.

## Public Member Functions
| InvertMotorBigModel (const InvertMotorBigModelConf &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 | ~InvertMotorBigModel ()
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 paramval | getParam (const paramkey &key) const
virtual bool | setParam (const paramkey &key, paramval val)
virtual paramlist | getParamList () const
| The list of all parameters with there value as allocated lists.
virtual void | setMotorTeachingSignal (const motor *teaching, int len)
| The given motor teaching signal is used for this timestep.
virtual void | setSensorTeachingSignal (const sensor *teaching, int len)
| The given sensor teaching signal (distal learning) is used for this timestep.
void | getLastMotors (motor *motors, int len)
void | kwtaInhibition (matrix::Matrix &weightmatrix, unsigned int k, double damping)
| k-winner take all inhibition for synapses.
void | limitC (matrix::Matrix &weightmatrix, unsigned int rfSize)
| sets all connections to zero which are further away then rfSize.
## Static Public Member Functions
static InvertMotorBigModelConf | getDefaultConf ()
## 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 | calcEtaAndBufferIt (int delay)
| calculates the first shift into the motor space useing delayed motor values.
virtual void | learnController ()
| learn H,C with motors y and corresponding sensors x
virtual void | calcCandHUpdates (matrix::Matrix &C_update, matrix::Matrix &H_update, int y_delay)
| calculates the Update for C and H
virtual void | updateCandH (const matrix::Matrix &C_update, const matrix::Matrix &H_update, double squashSize)
| updates the matrix C and H
virtual void | learnModel (int delay)
| learn A, (and S) using motors y and corresponding sensors x
virtual void | management ()
| handles inhibition damping etc.
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 | S
| additional Model Matrix (sensors derivatives to sensors)
matrix::Matrix | C
| Controller Matrix.
matrix::Matrix | H
| Controller Bias.
NoiseGenerator * | BNoiseGen
| Noisegenerator for noisy bias.
matrix::Matrix | R
| C*A.
matrix::Matrix | SmallID
| small identity matrix in the dimension of R
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 | zero_eta
matrix::Matrix | x_smooth
matrix::Matrix | y_teaching
| teaching motor signal
bool | useTeaching
| flag whether there is an actual teachning signal or not
int | t_rand
| initial random time to avoid syncronous management of all controllers
int | managementInterval
| interval between subsequent management function calls
paramval | inhibition
| inhibition strength for sparce kwta strategy (is scaled with epsC)
paramval | kwta
| (int) number of synapses that get strengthend
paramval | limitRF
| (int) receptive field of motor neurons (number of offcenter sensors) if null then no limitation. Mutual exclusive with inhibition
paramval | dampS
| damping of S matrix
InvertMotorBigModelConf | conf

## Detailed Description

class for robot controller is based on InvertMotorNStep

- direct inversion

- motor space

- multilayer,nonlinear model

## Constructor & Destructor Documentation

InvertMotorBigModel | ( | const InvertMotorBigModelConf & | conf = `getDefaultConf()` | ) |

~InvertMotorBigModel | ( |  | ) | `[virtual]`

## Member Function Documentation

void calcCandHUpdates | ( | matrix::Matrix & | C_update,
|  | matrix::Matrix & | H_update,
|  | int | y_delay |
| ) |  |  | `[protected, virtual]`

calculates the Update for C and H

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.

void calcEtaAndBufferIt | ( | int | delay | ) | `[protected, virtual]`

calculates the first shift into the motor space useing delayed motor values.

Matrix calculateControllerValues | ( | const matrix::Matrix & | x_smooth | ) | `[protected, virtual]`

returns controller output for given sensor values

Parameters:

  | 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 InvertMotorBigModelConf getDefaultConf | ( |  | ) | `[inline, static]`

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.

Returns:
  : list of keys

Reimplemented from Inspectable.

list< Inspectable::iparamval > getInternalParams | ( |  | ) | const`[virtual]`

Returns:
  : list of values

Reimplemented from Inspectable.

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.

Configurable::paramval getParam | ( | const paramkey & | key | ) | const`[virtual]`

Reimplemented from InvertMotorController.

Configurable::paramlist getParamList | ( |  | ) | const`[virtual]`

The list of all parameters with there value as allocated lists.

Returns:
  list of key-value pairs

Reimplemented from InvertMotorController.

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.

Returns:
  : list of layer names with dimension

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.

Returns:
  : list of layer names with dimension

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 kwtaInhibition | ( | matrix::Matrix & | weightmatrix,
|  | unsigned int | k,
|  | double | damping |
| ) |  |  |

k-winner take all inhibition for synapses.

k largest synapses are strengthed and the rest are inhibited. strong synapes are scaled by 1+(damping/k) and weak synapses are scaled by 1-(damping/(n-k)) where n is the number of synapes

Parameters:

  | weightmatrix | reference to weight matrix. Synapses for a neuron are in one row. The inhibition is done for all rows independently
  | k | number of synapes to strengthen
  | damping | strength of supression and exitation (typically 0.001)

void learnController | ( |  | ) | `[protected, virtual]`

learn H,C with motors y and corresponding sensors x

void learnModel | ( | int | delay | ) | `[protected, virtual]`

learn A, (and S) using motors y and corresponding sensors x

void limitC | ( | matrix::Matrix & | weightmatrix,
|  | unsigned int | rfSize |
| ) |  |  |

sets all connections to zero which are further away then rfSize.

If rfSize == 1 then only main diagonal is left. If rfSize = 2: main diagonal and upper and lower side diagonal are kept and so on and so forth.

void management | ( |  | ) | `[protected, virtual]`

handles inhibition damping etc.

bool restore | ( | FILE * | f | ) | `[virtual]`

loads the controller values from a given file.

Implements Storeable.

void setMotorTeachingSignal | ( | const motor * | teaching,
|  | int | len |
| ) |  |  | `[virtual]`

The given motor teaching signal is used for this timestep.

It is used as a feed forward teaching signal for the controller. Please note, that the teaching signal has to be given each timestep for a continuous teaching process.

bool setParam | ( | const paramkey & | key,
|  | paramval | val |
| ) |  |  | `[virtual]`

Reimplemented from InvertMotorController.

void setSensorTeachingSignal | ( | const sensor * | teaching,
|  | int | len |
| ) |  |  | `[virtual]`

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

void step | ( | const sensor * | ,
|  | int | number_sensors,
|  | motor * | ,
|  | int | number_motors |
| ) |  |  | `[virtual]`

performs one step (includes learning).

Calulates motor commands from sensor inputs.

Implements AbstractController.

void stepNoLearning | ( | const sensor * | ,
|  | int | number_sensors,
|  | motor * | ,
|  | int | number_motors |
| ) |  |  | `[virtual]`

performs one step without learning. Calulates motor commands from sensor inputs.

Implements AbstractController.

bool store | ( | FILE * | f | ) | const`[virtual]`

stores the controller values to a given file.

Implements Storeable.

void updateCandH | ( | const matrix::Matrix & | C_update,
|  | const matrix::Matrix & | H_update,
|  | double | squashSize |
| ) |  |  | `[protected, virtual]`

updates the matrix C and H

## Member Data Documentation

matrix::Matrix A`[protected]`

Model Matrix (motors to sensors).

NoiseGenerator* BNoiseGen`[protected]`

Noisegenerator for noisy bias.

matrix::Matrix C`[protected]`

Controller Matrix.

InvertMotorBigModelConf conf`[protected]`

paramval dampS`[protected]`

damping of S matrix

matrix::Matrix* eta_buffer`[protected]`

matrix::Matrix H`[protected]`

Controller Bias.

paramval inhibition`[protected]`

inhibition strength for sparce kwta strategy (is scaled with epsC)

paramval kwta`[protected]`

(int) number of synapses that get strengthend

paramval limitRF`[protected]`

(int) receptive field of motor neurons (number of offcenter sensors) if null then no limitation. Mutual exclusive with inhibition

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 S`[protected]`

additional Model Matrix (sensors derivatives to sensors)

matrix::Matrix SmallID`[protected]`

small identity matrix in the dimension of R

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* x_buffer`[protected]`

matrix::Matrix x_smooth`[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_teaching`[protected]`

teaching motor signal

matrix::Matrix zero_eta`[protected]`

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

- invertmotorbigmodel.h
- invertmotorbigmodel.cpp