FFNNController Class Reference

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

#include <ffnncontroller.h>

Inherits AbstractController.

Inheritance diagram for FFNNController:

Inheritance graph
[legend]
Collaboration diagram for FFNNController:

Collaboration graph
[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.
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< iparamkeygetInternalParamNames () const
 The list of the names of all internal parameters given by getInternalParams().
virtual std::list< iparamvalgetInternalParams () const
virtual paramval getParam (const paramkey &key) const
virtual bool setParam (const paramkey &key, paramval val)
virtual paramlist getParamList () const
 The list of all parameters with there value as allocated lists.

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
unsigned short s4avg
unsigned int t
unsigned int init_wait
matrix::Matrixx_buffer
matrix::Matrixy_buffer
matrix::Matrix x_smooth
MultiLayerFFNNnet
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

\[ (x_{t},x_{t-1},...,x_{t-history})^T \]

if false then also the y values are used:

\[ (x_{t}, y_{t-1}, x_{t-1},y_{t-2},...,x_{t-history})^T \]

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

\[ (x_{t},x_{t-1},...,x_{t-history})^T \]

if false then also the y values are used:

\[ (x_{t}, y_{t-1}, x_{t-1},y_{t-2},...,x_{t-history})^T \]

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.

Configurable::paramval getParam ( const paramkey key  )  const [virtual]

Configurable::paramlist getParamList (  )  const [virtual]

The list of all parameters with there value as allocated lists.

Note that these are only parameters that are managed manually (with setParam, getParam)

See also:
getAllParamNames()
Returns:
list of key-value pairs

Reimplemented from Configurable.

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

bool setParam ( const paramkey key,
paramval  val 
) [virtual]

void step ( const sensor ,
int  number_sensors,
motor ,
int  number_motors 
) [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]

unsigned short 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:
Generated on Fri Oct 30 16:29:02 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7