Robotsystem from Robot Group Leipzig: AbstractController Class Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Alphabetical List
- Class Hierarchy
- Class Members

# AbstractController Class Reference

`#include <abstractcontroller.h>`

Inheritance diagram for AbstractController:

[legend]
Collaboration diagram for AbstractController:

[legend]
List of all members.

## Detailed Description

Abstract class (interface) for robot controller.

The controller gets a number of input sensor values each timestep and has to generate a number of output motor values.

Interface assumes the following usage:

- init is called first to initialise the dimension of sensor- and motor space
- each time step either step() or stepNoLearning() is called to ask the controller for motor values.

Examples:

  main.cpp.

Definition at line 68 of file abstractcontroller.h.

## Public Member Functions
virtual void | init (int sensornumber, int motornumber) ABSTRACT
| initialisation of the controller with the given sensor/ motornumber Must be called before use.
virtual int | getSensorNumber () const ABSTRACT
virtual int | getMotorNumber () const ABSTRACT
virtual void | step (const sensor *sensors, int sensornumber, motor *motors, int motornumber) ABSTRACT
| performs one step (includes learning).
virtual void | stepNoLearning (const sensor *, int number_sensors, motor *, int number_motors) ABSTRACT
| performs one step without learning.
virtual bool | store (const char *filename) ABSTRACT
| stores the controller values to a given file.
virtual bool | restore (const char *filename) ABSTRACT
| loads the controller values from a given file.

## Member Function Documentation

virtual int getMotorNumber | ( |  | ) | const`[virtual]`

| Returns: Number of motors the controller was initialised with or 0 if not initialised Reimplemented in InvertMotorSpace, InvertNChannelController, and SineController.

virtual int getSensorNumber | ( |  | ) | const`[virtual]`

| Returns: Number of sensors the controller was initialised with or 0 if not initialised Reimplemented in InvertMotorSpace, InvertNChannelController, and SineController.

virtual void init | ( | int | sensornumber,
|  | int | motornumber
| ) | `[virtual]`

| initialisation of the controller with the given sensor/ motornumber Must be called before use. Reimplemented in DInvert3ChannelController, InvertMotorSpace, InvertNChannelController, and SineController.

virtual bool restore | ( | const char * | filename | ) | `[virtual]`

| loads the controller values from a given file. This should include internal parameters Reimplemented in InvertMotorSpace, InvertNChannelController, and SineController.

virtual 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
Reimplemented in DInvert3ChannelController, Invert3ChannelController, InvertMotorSpace, InvertNChannelController, InvertNChannelController_Gnu, and SineController.

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

| performs one step without learning. See also: step Reimplemented in DInvert3ChannelController, Invert3ChannelController, InvertMotorSpace, InvertNChannelController, InvertNChannelController_Gnu, and SineController.

virtual bool store | ( | const char * | filename | ) | `[virtual]`

| stores the controller values to a given file. This should include internal parameters. Reimplemented in InvertMotorSpace, InvertNChannelController, and SineController.