DerController Class Reference

class for robot controller that uses the georg's matrixlib for direct matrix inversion for n channels (simple one layer networks) More...

#include <dercontroller.h>

Inherits InvertMotorController.

Inheritance diagram for DerController:

Inheritance graph
[legend]
Collaboration diagram for DerController:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DerController (const DerControllerConf &conf=getDefaultConf())
virtual void init (int sensornumber, int motornumber)
 initialisation of the controller with the given sensor/ motornumber Must be called before use.
virtual ~DerController ()
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 object to the given file stream (binary).
virtual bool restore (FILE *f)
 loads the object from the given file stream (binary).
virtual std::list< iparamkeygetInternalParamNames () const
 The list of the names of all internal parameters given by getInternalParams().
virtual std::list< iparamvalgetInternalParams () const
virtual std::list< ILayergetStructuralLayers () const
 Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important.
virtual std::list< IConnectiongetStructuralConnections () const
 Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important.
virtual void setTeachingMode (bool onOff)
virtual bool getTeachingMode ()
virtual void setMotorTeachingSignal (const motor *teaching, int len)
void getLastMotors (motor *motors, int len)

Static Public Member Functions

DerControllerConf 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 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 matrix::Matrix model (const matrix::Matrix &x, const matrix::Matrix &y)
 calculates the predicted sensor values
virtual void calcCandHandAUpdates (matrix::Matrix &C_update, matrix::Matrix &H_update, matrix::Matrix &A_update, int y_delay)
 calculates the Update for C, H and A
virtual void updateCandHandA (const matrix::Matrix &C_update, const matrix::Matrix &H_update, const matrix::Matrix &A_update, double squashSize)
 updates the matrices C, H and A
virtual matrix::Matrix calculateControllerValues (const matrix::Matrix &x_smooth)
 calculate controller outputs
virtual double calcMatrixNorm (const matrix::Matrix &m)
 calculates the city block distance (abs) norm of the matrix. (abs sum of absolutes / size of matrix)
virtual double calcErrorFactor (const matrix::Matrix &e, bool loga, bool root)
 calculates the error_factor for either logarithmic (E=ln(e^T*e)) or square (E=sqrt(e^t*e)) error
virtual paramval getParam (const paramkey &key) const
 returns the value of the requested parameter or 0 (+ error message to stderr) if unknown.
virtual bool setParam (const paramkey &key, paramval val)
 sets the value of the given parameter or does nothing if unknown.
virtual paramlist getParamList () const
 The list of all parameters with there value as allocated lists.

Static Protected Member Functions

double squashP (void *d, double z)
 squashing function, to protect against too large weight updates
double q_s (double z, double xsi)
 an exact formula for inversion if neuron.
double q_2s_div_s (double z, double xsi)
 an exact formula for q''/q'

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 to sensors)
matrix::Matrix C
 Controller Matrix.
matrix::Matrix H
 Controller Bias.
matrix::Matrix B
 Model Bias.
NoiseGeneratorBNoiseGen
 Noisegenerator for noisy bias.
NoiseGeneratorYNoiseGen
 Noisegenerator for noisy motor values.
matrix::Matrix R
 C*A.
matrix::Matrix RRT
matrix::Matrix AAT
matrix::Matrix Rm1
 R^-1.
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::Matrixx_buffer
matrix::Matrixy_buffer
matrix::Matrixeta_buffer
matrix::Matrix zero_eta
matrix::Matrix x_smooth
matrix::Matrix y_teaching
 teaching motor signal
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
DerControllerConf conf

Detailed Description

class for robot controller that uses the georg's matrixlib for direct matrix inversion for n channels (simple one layer networks)

Implements standart parameters: eps, rho, mu, stepnumber4avg, stepnumber4delay


Constructor & Destructor Documentation

DerController const DerControllerConf conf = getDefaultConf()  ) 
 

~DerController  )  [virtual]
 


Member Function Documentation

void calcCandHandAUpdates matrix::Matrix C_update,
matrix::Matrix H_update,
matrix::Matrix A_update,
int  y_delay
[protected, virtual]
 

calculates the Update for C, H and A

double calcErrorFactor const matrix::Matrix e,
bool  loga,
bool  root
[protected, virtual]
 

calculates the error_factor for either logarithmic (E=ln(e^T*e)) or square (E=sqrt(e^t*e)) error

Reimplemented from InvertMotorController.

void calcEtaAndBufferIt int  delay  )  [protected, virtual]
 

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

double calcMatrixNorm const matrix::Matrix m  )  [protected, 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]
 

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

DerControllerConf 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

Implements Inspectable.

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

Returns:
: list of values

Implements 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

Reimplemented from AbstractController.

virtual paramval getParam const paramkey key  )  const [inline, protected, virtual]
 

returns the value of the requested parameter or 0 (+ error message to stderr) if unknown.

Reimplemented from InvertMotorController.

virtual paramlist getParamList  )  const [inline, protected, 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

Reimplemented from 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.

bool getTeachingMode  )  [virtual]
 

void init int  sensornumber,
int  motornumber
[virtual]
 

initialisation of the controller with the given sensor/ motornumber Must be called before use.

Reimplemented from AbstractController.

void learnController  )  [protected, virtual]
 

learn H,C with motors y and corresponding sensors x

Matrix model const matrix::Matrix x,
const matrix::Matrix y
[protected, virtual]
 

calculates the predicted sensor values

double q_2s_div_s double  z,
double  xsi
[inline, static, protected]
 

an exact formula for q''/q'

double q_s double  z,
double  xsi
[inline, static, protected]
 

an exact formula for inversion if neuron.

bool restore FILE *  f  )  [virtual]
 

loads the object from the given file stream (binary).

Implements Storeable.

void setMotorTeachingSignal const motor teaching,
int  len
[virtual]
 

virtual bool setParam const paramkey key,
paramval  val
[inline, protected, virtual]
 

sets the value of the given parameter or does nothing if unknown.

Reimplemented from InvertMotorController.

void setTeachingMode bool  onOff  )  [virtual]
 

double squashP void *  d,
double  z
[inline, static, protected]
 

squashing function, to protect against too large weight updates

void step const sensor ,
int  number_sensors,
motor ,
int  number_motors
[virtual]
 

performs one step (includes learning).

Calulates motor commands from sensor inputs.

Reimplemented from AbstractController.

void stepNoLearning const sensor ,
int  number_sensors,
motor ,
int  number_motors
[virtual]
 

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

Reimplemented from AbstractController.

bool store FILE *  f  )  const [virtual]
 

stores the object to the given file stream (binary).

Implements Storeable.

void updateCandHandA const matrix::Matrix C_update,
const matrix::Matrix H_update,
const matrix::Matrix A_update,
double  squashSize
[protected, virtual]
 

updates the matrices C, H and A


Member Data Documentation

matrix::Matrix A [protected]
 

Model Matrix (motors to sensors).

matrix::Matrix AAT [protected]
 

matrix::Matrix B [protected]
 

Model Bias.

NoiseGenerator* BNoiseGen [protected]
 

Noisegenerator for noisy bias.

matrix::Matrix C [protected]
 

Controller Matrix.

DerControllerConf conf [protected]
 

matrix::Matrix* eta_buffer [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 H [protected]
 

Controller 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 Rm1 [protected]
 

R^-1.

matrix::Matrix RRT [protected]
 

matrix::Matrix S [protected]
 

additional Model Matrix (sensors to sensors)

matrix::Matrix SmallID [protected]
 

small identity matrix in the dimension of R

matrix::Matrix* x_buffer [protected]
 

matrix::Matrix x_intern [protected]
 

fantasy sensor values

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

NoiseGenerator* YNoiseGen [protected]
 

Noisegenerator for noisy motor values.

matrix::Matrix zero_eta [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Jan 16 02:14:46 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8