Robot Simulator of the Robotics Group for Self-Organization of Control: SeMoX Class Reference

# SeMoX Class Reference

This controller follows the prinziple of homeokinesis and implements the extensions described in the thesis of Georg Martius 2009, University Goettingen: Goal-Oriented Control of Self-organizing Behavior in Autonomous Robots. More...

`#include <semox.h>`

Inherits HomeokinBase, and Teachable.

Collaboration diagram for SeMoX:
[legend]

List of all members.

## Public Member Functions
| SeMoX (const SeMoXConf &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 | ~SeMoX ()
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 std::list< ILayer > | getStructuralLayers () const
| Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important.
virtual std::list< IConnection > | getStructuralConnections () const
| Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important.
virtual void | setMotorTeaching (const matrix::Matrix &teaching)
| The given motor teaching signal is used for this timestep.
virtual void | setSensorTeaching (const matrix::Matrix &teaching)
| The given sensor teaching signal (distal learning) is used for this timestep.
virtual matrix::Matrix | getLastMotorValues ()
| returns the last motor values (useful for cross motor coupling)
virtual matrix::Matrix | getLastSensorValues ()
| returns the last sensor values (useful for cross sensor coupling)
## Static Public Member Functions
static SeMoXConf | getDefaultConf ()
| returns the default configuration
## 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 | calcXsi (int delay)
| calculates xsi for the current time step using the delayed y values
virtual void | learnController ()
| learn H,C with motors y and corresponding sensors x
virtual void | learnModel (int delay)
| learn A, (and S) using motors y and corresponding sensors x
virtual matrix::Matrix | model (const matrix::Matrix *x_buffer, int delay, const matrix::Matrix &y)
| calculates the predicted sensor values
virtual void | management ()
| handles inhibition damping etc.
virtual matrix::Matrix | calculateControllerValues (const matrix::Matrix &x_smooth)
| returns controller output for given sensor values
## Static Protected Member Functions
static double | regularizedInverse (double v)
## 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.
matrix::Matrix | B
| Model Bias.
matrix::Matrix | R
| C*A.
matrix::Matrix | SmallID
| small identity matrix in the dimension of R
matrix::Matrix | v
| shift
matrix::Matrix | xsi
| current output error
NoiseGenerator * | BNoiseGen
| Noisegenerator for noisy bias.
paramval | modelNoise
| strength of noisy bias
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 * | x_c_buffer
| buffer for sensors with context sensors
matrix::Matrix * | y_buffer
matrix::Matrix | y_teaching
| motor teaching signal
paramval | gamma_cont
| parameter to include contiuity in motor values (avoid high frequencies)
paramval | gamma_teach
| strength of teaching
paramval | discountS
| discount strength for hierachical model
paramval | dampModel
| damping of A and S matrices
paramval | dampController
| damping of C matrix
SeMoXConf | conf
bool | intern_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
parambool | _modelExt_copy
| copy of modelExtension variable (to achieve readonly)
## Friends
class | ThisSim

## Detailed Description

This controller follows the prinziple of homeokinesis and implements the extensions described in the thesis of Georg Martius 2009, University Goettingen: Goal-Oriented Control of Self-organizing Behavior in Autonomous Robots.

This class also implements part of the guided self-organization

Name: SElf-organizing MOtor space eXtended

Main characteristics: Motor Space, Extended World model, Continuity, Teaching interface

## Constructor & Destructor Documentation

SeMoX | ( | const SeMoXConf & | conf = `getDefaultConf()` | ) |

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

## Member Function Documentation

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

returns controller output for given sensor values

calculate controller outputs

Parameters:

  | x_smooth | smoothed sensors Matrix(number_channels,1)

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

calculates xsi for the current time step using the delayed y values

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

returns the default configuration

matrix::Matrix getLastMotorValues | ( |  | ) | `[virtual]`

returns the last motor values (useful for cross motor coupling)

Implements Teachable.

matrix::Matrix getLastSensorValues | ( |  | ) | `[virtual]`

returns the last sensor values (useful for cross sensor coupling)

Implements Teachable.

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.

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 learnController | ( |  | ) | `[protected, virtual]`

learn H,C with motors y and corresponding sensors x

learn controller paramters C and H

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

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

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

handles inhibition damping etc.

Matrix model | ( | const matrix::Matrix * | x_buffer,
|  | int | delay,
|  | const matrix::Matrix & | y |
| ) |  |  | `[protected, virtual]`

calculates the predicted sensor values

static double regularizedInverse | ( | double | v | ) | `[static, protected]`

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

loads the controller values from a given file.

Implements Storeable.

void setMotorTeaching | ( | const matrix::Matrix & | teaching | ) | `[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.

Parameters:

  | teaching,: | matrix with dimensions (motornumber,1)

Implements Teachable.

void setSensorTeaching | ( | const matrix::Matrix & | teaching | ) | `[virtual]`

The given sensor teaching signal (distal learning) is used for this timestep.

The belonging motor teachung signal is calculated by the inverse model. See setMotorTeaching

Parameters:

  | teaching,: | matrix with dimensions (motorsensors,1)

Implements Teachable.

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

performs one step (includes learning).

performs one step (includes learning). Calculates motor commands from sensor inputs.

Calulates motor commands from sensor inputs.

Implements AbstractController.

void stepNoLearning | ( | const sensor * | x,
|  | int | number_sensors,
|  | motor * | y,
|  | 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.

## Friends And Related Function Documentation

friend class ThisSim`[friend]`

## Member Data Documentation

parambool _modelExt_copy`[protected]`

copy of modelExtension variable (to achieve readonly)

matrix::Matrix A`[protected]`

Model Matrix (motors to sensors).

matrix::Matrix B`[protected]`

Model Bias.

NoiseGenerator* BNoiseGen`[protected]`

Noisegenerator for noisy bias.

matrix::Matrix C`[protected]`

Controller Matrix.

SeMoXConf conf`[protected]`

paramval dampController`[protected]`

damping of C matrix

paramval dampModel`[protected]`

damping of A and S matrices

paramval discountS`[protected]`

discount strength for hierachical model

paramval gamma_cont`[protected]`

parameter to include contiuity in motor values (avoid high frequencies)

paramval gamma_teach`[protected]`

strength of teaching

matrix::Matrix H`[protected]`

Controller Bias.

bool intern_useTeaching`[protected]`

flag whether there is an actual teachning signal or not

int managementInterval`[protected]`

interval between subsequent management function calls

paramval modelNoise`[protected]`

strength of noisy bias

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

matrix::Matrix v`[protected]`

shift

matrix::Matrix* x_buffer`[protected]`

matrix::Matrix* x_c_buffer`[protected]`

buffer for sensors with context sensors

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]`

motor teaching signal

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

- semox.h
- semox.cpp