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

# FFNNController Class Reference

class for robot controller with a fixed neural network More...

`#include <ffnncontroller.h>`

Inherits AbstractController.

Collaboration diagram for FFNNController:
[legend]

List of all members.

## Public Member Functions
| FFNNController (const std::string &networkfilename, int history, bool input_only_x, unsigned int init_wait=0)
| FFNNController (MultiLayerFFNN *net, int history, bool input_only_x, unsigned int init_wait=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 | ~FFNNController ()
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.
void | notifyOnChange (const paramkey &key)
| Is called when a parameter was changes via setParam().
virtual bool | store (FILE *f) const
| stores the controller values to a given file (binary).
virtual bool | restore (FILE *f)
| loads the controller values from a given file (binary).
virtual std::list< iparamkey > | getInternalParamNames () const
| The list of the names of all internal parameters given by getInternalParams().
virtual std::list< iparamval > | getInternalParams () const
## Protected Member Functions
void | putInBuffer (matrix::Matrix *buffer, const matrix::Matrix &vec, int delay=0)
matrix::Matrix | calculateSmoothValues (const matrix::Matrix *buffer, int number_steps_for_averaging_) const
| calculate time-smoothed values
virtual matrix::Matrix | assembleNetworkInputXY (matrix::Matrix *xbuffer, matrix::Matrix *ybuffer) const
virtual matrix::Matrix | assembleNetworkInputX (matrix::Matrix *xbuffer, matrix::Matrix *ybuffer) const
virtual matrix::Matrix | assembleNetworkOutput (const matrix::Matrix &output) const
## Protected Attributes
unsigned short | number_motors
unsigned short | number_sensors
unsigned short | history
unsigned short | buffersize
bool | input_only_x
int | s4avg
unsigned int | t
unsigned int | init_wait
matrix::Matrix * | x_buffer
matrix::Matrix * | y_buffer
matrix::Matrix | x_smooth
MultiLayerFFNN * | net
bool | initialised

## Detailed Description

class for robot controller with a fixed neural network

## Constructor & Destructor Documentation

FFNNController | ( | const std::string & | networkfilename,
|  | int | history,
|  | bool | input_only_x,
|  | unsigned int | init_wait = `0` |
| ) |  |  |

Parameters:

  | networkfilename | file to load the network
  | history | number of time steps the network gets input (in sense of dimension of input)
  | input_only_x | if true then the input vector is if false then also the y values are used:
  | init_wait | number of timesteps to wait before controlling

FFNNController | ( | MultiLayerFFNN * | net,
|  | int | history,
|  | bool | input_only_x,
|  | unsigned int | init_wait = `0` |
| ) |  |  |

Parameters:

  | net | pointer to network (it must have the right dimensions)
  | history | number of time steps the network gets input (in sense of dimension of input)
  | input_only_x | if true then the input vector is if false then also the y values are used:
  | init_wait | number of timesteps to wait before controlling

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

## Member Function Documentation

matrix::Matrix assembleNetworkInputX | ( | matrix::Matrix * | xbuffer,
|  | matrix::Matrix * | ybuffer |
| ) |  |  | const`[protected, virtual]`

matrix::Matrix assembleNetworkInputXY | ( | matrix::Matrix * | xbuffer,
|  | matrix::Matrix * | ybuffer |
| ) |  |  | const`[protected, virtual]`

matrix::Matrix assembleNetworkOutput | ( | const matrix::Matrix & | output | ) | const`[protected, virtual]`

matrix::Matrix calculateSmoothValues | ( | const matrix::Matrix * | buffer,
|  | int | number_steps_for_averaging_ |
| ) |  |  | const`[protected]`

calculate time-smoothed values

virtual std::list<iparamkey> getInternalParamNames | ( |  | ) | const`[inline, 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.

virtual std::list<iparamval> getInternalParams | ( |  | ) | const`[inline, virtual]`

Returns:
  : list of values

Reimplemented from Inspectable.

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 notifyOnChange | ( | const paramkey & | key | ) | `[virtual]`

Is called when a parameter was changes via setParam().

Note that it is not called of parameters of childs are changed, then there notifyOnChange() method is called. The key and of the changed parameter (use getParam() to retrieve its actual value). Overload this function when special actions have to be taken on parameter changes.

Reimplemented from Configurable.

void putInBuffer | ( | matrix::Matrix * | buffer,
|  | const matrix::Matrix & | vec,
|  | int | delay = `0` |
| ) |  |  | `[protected]`

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

loads the controller values from a given file (binary).

Implements Storeable.

void step | ( | const sensor * | sensors,
|  | int | sensornumber,
|  | motor * | motors,
|  | int | motornumber |
| ) |  |  | `[virtual]`

performs one step (includes learning).

Calculates motor commands from sensor inputs.

Parameters:

  | sensors | sensors inputs scaled to [-1,1]
  | sensornumber | length of the sensor array
  | motors | motors outputs. MUST have enough space for motor values!
  | motornumber | length of the provided motor array

Implements AbstractController.

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

performs one step without learning.

See also:
  step

Implements AbstractController.

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

stores the controller values to a given file (binary).

Implements Storeable.

## Member Data Documentation

unsigned short buffersize`[protected]`

unsigned short history`[protected]`

unsigned int init_wait`[protected]`

bool initialised`[protected]`

bool input_only_x`[protected]`

MultiLayerFFNN* net`[protected]`

unsigned short number_motors`[protected]`

unsigned short number_sensors`[protected]`

int s4avg`[protected]`

unsigned int t`[protected]`

matrix::Matrix* x_buffer`[protected]`

matrix::Matrix x_smooth`[protected]`

matrix::Matrix* y_buffer`[protected]`

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

- ffnncontroller.h
- ffnncontroller.cpp