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

# Sos Class Reference

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

`#include <sos.h>`

Inherits AbstractController.

Collaboration diagram for Sos:
[legend]

List of all members.

## Public Member Functions
| Sos (double init_feedback_strength=1.0)
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 | ~Sos ()
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 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)
## Protected Member Functions
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 | h
matrix::Matrix | b
matrix::Matrix | L
matrix::Matrix | y_buffer [buffersize]
matrix::Matrix | x_buffer [buffersize]
matrix::Matrix | v_avg
matrix::Matrix | x
matrix::Matrix | x_smooth
int | t
bool | TLE
bool | loga
double | init_feedback_strength
paramval | creativity
paramval | epsC
paramval | epsA
paramint | s4avg
paramint | s4delay
## Static Protected Attributes
static const unsigned short | buffersize = 10

## Detailed Description

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

## Constructor & Destructor Documentation

Sos | ( | double | init_feedback_strength = `1.0` | ) |

~Sos | ( |  | ) | `[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]

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

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

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)

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

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

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

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

matrix::Matrix C`[protected]`

paramval creativity`[protected]`

paramval epsA`[protected]`

paramval epsC`[protected]`

matrix::Matrix h`[protected]`

double init_feedback_strength`[protected]`

matrix::Matrix L`[protected]`

bool loga`[protected]`

unsigned short number_motors`[protected]`

unsigned short number_sensors`[protected]`

paramint s4avg`[protected]`

paramint s4delay`[protected]`

int t`[protected]`

bool TLE`[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]`

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

- sos.h
- sos.cpp