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

# SplitControl Class Reference

class for using multiple controller with one robot. More...

`#include <splitcontrol.h>`

Inherits AbstractController.

Collaboration diagram for SplitControl:
[legend]

List of all members.

## Classes
struct | Assoziation
## Public Types
typedef std::vector< Assoziation > | Assoziations
## Public Member Functions
| SplitControl (ControllerGenerator *controllerGenerator, const Assoziations &assoziations, std::string controllerName, int numCtrlCreateBeforeInit=1, int numContextSensors=0)
virtual | ~SplitControl ()
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 void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber)
| performs one step (includes learning).
virtual void | stepNoLearning (const sensor *sensors, int sensornumber, motor *motors, int motornumber)
| performs one step without learning.
virtual int | getSensorNumber () const
virtual int | getMotorNumber () const
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::vector < AbstractController * > | getControllers () const
## Protected Attributes
std::vector< AbstractController * > | ctrl
ControllerGenerator * | controllerGenerator
Assoziations | assoz
int | numCtrlCreateBeforeInit
int | numContextSensors
int | motornumber
int | sensornumber
double * | sensorbuffer
double * | motorbuffer

## Detailed Description

class for using multiple controller with one robot.

The connection is flexible. The controller are generated on the fly with a generator object.

## Member Typedef Documentation

typedef std::vector<Assoziation> Assoziations

## Constructor & Destructor Documentation

SplitControl | ( | ControllerGenerator * | controllerGenerator,
|  | const Assoziations & | assoziations,
|  | std::string | controllerName,
|  | int | numCtrlCreateBeforeInit = `1`,
|  | int | numContextSensors = `0` |
| ) |  |  |

Parameters:

  | controllerGenerator | generator object for controller
  | assoziations | list decribing which sensors and motors are connected to each controller
  | controllerName | name
  | numCtrlCreateBeforeInit | number of controller that are generated before the init function is called. Useful if they should be put into the inspectable list of the agent
  | numContextSensors | number of context sensors (counted from the end) passed to all controllers

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

## Member Function Documentation

virtual std::vector<AbstractController*> getControllers | ( |  | ) | const`[inline, virtual]`

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.

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.

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

loads the object from the given file stream (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.

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

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

Implements Storeable.

## Member Data Documentation

Assoziations assoz`[protected]`

ControllerGenerator* controllerGenerator`[protected]`

std::vector<AbstractController*> ctrl`[protected]`

double* motorbuffer`[protected]`

int motornumber`[protected]`

int numContextSensors`[protected]`

int numCtrlCreateBeforeInit`[protected]`

double* sensorbuffer`[protected]`

int sensornumber`[protected]`

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

- splitcontrol.h
- splitcontrol.cpp