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

# Sox Class Reference

This controller implements the standard algorihm described the the Chapter 5 (Homeokinesis) with extensions of Chapter 15 of book "The Playful Machine". More...

`#include <sox.h>`

Inherits AbstractController, and Teachable.

Collaboration diagram for Sox:
[legend]

List of all members.

## Public Member Functions
| Sox (const SoxConf &conf=getDefaultConf())
| constructor
| Sox (double init_feedback_strength, bool useExtendedModel=true, bool useTeaching=false)
| constructor provided for convenience, use conf object to customize more
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 | ~Sox ()
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 void | motorBabblingStep (const sensor *, int number_sensors, const motor *, int number_motors)
| called during babbling phase
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 matrix::Matrix | getA ()
virtual void | setA (const matrix::Matrix &A)
virtual matrix::Matrix | getC ()
virtual void | setC (const matrix::Matrix &C)
virtual matrix::Matrix | geth ()
virtual void | seth (const matrix::Matrix &h)
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 SoxConf | getDefaultConf ()
## Protected Member Functions
void | constructor ()
matrix::Matrix | pseudoInvL (const matrix::Matrix &L, const matrix::Matrix &A, const matrix::Matrix &C)
virtual void | learn ()
| learn values model and controller (A,b,C,h)
## Static Protected Member Functions
static double | g (double z)
| neuron transfer function
static double | g_s (double z)
| derivative of g
static double | clip (double r, double x)
| function that clips the second argument to the interval [-first,first]
static double | one_over (double x)
| calculates the inverse the argument (useful for Matrix::map)
## Protected Attributes
unsigned short | number_sensors
unsigned short | number_motors
matrix::Matrix | A
matrix::Matrix | C
matrix::Matrix | S
matrix::Matrix | h
matrix::Matrix | b
matrix::Matrix | L
matrix::Matrix | R
matrix::Matrix | C_native
matrix::Matrix | A_native
matrix::Matrix | y_buffer [buffersize]
matrix::Matrix | x_buffer [buffersize]
matrix::Matrix | v_avg
matrix::Matrix | x
matrix::Matrix | x_smooth
int | t
bool | loga
SoxConf | conf
| configuration objects
bool | intern_isTeaching
matrix::Matrix | y_teaching
paramval | creativity
paramval | sense
paramval | harmony
paramval | causeaware
paramint | pseudo
paramval | epsC
paramval | epsA
paramval | damping
paramval | gamma
## Static Protected Attributes
static const unsigned short | buffersize = 10

## Detailed Description

This controller implements the standard algorihm described the the Chapter 5 (Homeokinesis) with extensions of Chapter 15 of book "The Playful Machine".

## Constructor & Destructor Documentation

Sox | ( | const SoxConf & | conf = `getDefaultConf()` | ) |

constructor

Sox | ( | double | init_feedback_strength,
|  | bool | useExtendedModel = `true`,
|  | bool | useTeaching = `false` |
| ) |  |  |

constructor provided for convenience, use conf object to customize more

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

## Member Function Documentation

static double clip | ( | double | r,
|  | double | x |
| ) |  |  | `[inline, static, protected]`

function that clips the second argument to the interval [-first,first]

void constructor | ( |  | ) | `[protected]`

static double g | ( | double | z | ) | `[inline, static, protected]`

neuron transfer function

static double g_s | ( | double | z | ) | `[inline, static, protected]`

derivative of g

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

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

static SoxConf getDefaultConf | ( |  | ) | `[inline, static]`

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

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.

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

learn values model and controller (A,b,C,h)

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

called during babbling phase

Reimplemented from AbstractController.

static double one_over | ( | double | x | ) | `[inline, static, protected]`

calculates the inverse the argument (useful for Matrix::map)

Matrix pseudoInvL | ( | const matrix::Matrix & | L,
|  | const matrix::Matrix & | A,
|  | const matrix::Matrix & | C |
| ) |  |  | `[protected]`

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

loads the controller values from a given file.

Implements Storeable.

void setA | ( | const matrix::Matrix & | A | ) | `[virtual]`

void setC | ( | const matrix::Matrix & | C | ) | `[virtual]`

void seth | ( | const matrix::Matrix & | h | ) | `[virtual]`

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).

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.

## Member Data Documentation

matrix::Matrix A`[protected]`

matrix::Matrix A_native`[protected]`

matrix::Matrix b`[protected]`

const unsigned short buffersize = 10`[static, protected]`

matrix::Matrix C`[protected]`

matrix::Matrix C_native`[protected]`

paramval causeaware`[protected]`

SoxConf conf`[protected]`

configuration objects

paramval creativity`[protected]`

paramval damping`[protected]`

paramval epsA`[protected]`

paramval epsC`[protected]`

paramval gamma`[protected]`

matrix::Matrix h`[protected]`

paramval harmony`[protected]`

bool intern_isTeaching`[protected]`

matrix::Matrix L`[protected]`

bool loga`[protected]`

unsigned short number_motors`[protected]`

unsigned short number_sensors`[protected]`

paramint pseudo`[protected]`

matrix::Matrix R`[protected]`

matrix::Matrix S`[protected]`

paramval sense`[protected]`

int t`[protected]`

matrix::Matrix v_avg`[protected]`

matrix::Matrix x`[protected]`

matrix::Matrix x_buffer[buffersize]`[protected]`

matrix::Matrix x_smooth`[protected]`

matrix::Matrix y_buffer[buffersize]`[protected]`

matrix::Matrix y_teaching`[protected]`

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

- sox.h
- sox.cpp