ReplayController Class Reference

Controller that replays a file. More...

#include <replaycontroller.h>

Inherits AbstractController.

Inheritance diagram for ReplayController:

Inheritance graph
[legend]
Collaboration diagram for ReplayController:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ReplayController (const char *filename, bool repeat=false)
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 int getSensorNumber () const
virtual int getMotorNumber () const
virtual void step (const sensor *sensors, int sensornumber, motor *motors, int motornumber)
 performs one step (includes learning).
virtual void stepNoLearning (const sensor *, int number_sensors, motor *motors, 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

Protected Member Functions

bool parseDataFileForHeader (FILE *f)

Static Protected Member Functions

static bool isEmpty (const char *c)
static bool check4Number (const char *c)
static bool parseDataLine (matrix::Matrix &data, FILE *f)

Protected Attributes

int sensorStart
int sensorEnd
int motorStart
int motorEnd
matrix::Matrix m
const char * filename
FILE * f
bool repeat

Detailed Description

Controller that replays a file.


Constructor & Destructor Documentation

ReplayController ( const char *  filename,
bool  repeat = false 
) [inline]


Member Function Documentation

static bool check4Number ( const char *  c  )  [inline, static, protected]

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:
Number of motors the controller was initialised with or 0 if not initialised

Implements AbstractController.

virtual int getSensorNumber (  )  const [inline, virtual]

Returns:
Number of sensors the controller was initialised with or 0 if not initialised

Implements AbstractController.

virtual void init ( int  sensornumber,
int  motornumber,
RandGen randGen = 0 
) [inline, virtual]

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

The random generator is optional.

Implements AbstractController.

static bool isEmpty ( const char *  c  )  [inline, static, protected]

bool parseDataFileForHeader ( FILE *  f  )  [inline, protected]

static bool parseDataLine ( matrix::Matrix data,
FILE *  f 
) [inline, static, protected]

virtual bool restore ( FILE *  f  )  [inline, virtual]

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

Implements Storeable.

virtual void step ( const sensor sensors,
int  sensornumber,
motor motors,
int  motornumber 
) [inline, 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.

virtual void stepNoLearning ( const sensor ,
int  number_sensors,
motor motors,
int  number_motors 
) [inline, virtual]

performs one step without learning.

See also:
step

Implements AbstractController.

virtual bool store ( FILE *  f  )  const [inline, virtual]

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

Implements Storeable.


Member Data Documentation

FILE* f [protected]

const char* filename [protected]

matrix::Matrix m [protected]

int motorEnd [protected]

int motorStart [protected]

bool repeat [protected]

int sensorEnd [protected]

int sensorStart [protected]


The documentation for this class was generated from the following file:
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