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

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

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

# AbstractControllerAdapter Class Reference

Abstract adapter class (interface) for robot controller. More...

`#include <abstractcontrolleradapter.h>`

Inherits AbstractController.

Inherited by AbstractMultiController, DiscreteControllerAdapter, and MeasureAdapter.

Inheritance diagram for AbstractControllerAdapter:

[legend]
Collaboration diagram for AbstractControllerAdapter:

[legend]
List of all members.

## Public Member Functions
| AbstractControllerAdapter (AbstractController *controller)
| AbstractControllerAdapter (AbstractController *controller, const std::string &name, const std::string &revision)
| contructor (hint: use $ID$ for revision)
virtual | ~AbstractControllerAdapter ()
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0)
| initialisation of the controller with the given sensor/ motornumber Must NORMALLY 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 *sensors, int sensornumber, motor *motors, int motornumber)
| performs one step without learning.
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.
virtual iparamkeylist | getInternalParamNames () const
| The list of the names of all internal parameters given by getInternalParams().
virtual iparamvallist | getInternalParams () const
virtual bool | store (FILE *f) const
virtual bool | restore (FILE *f)
## Protected Attributes
AbstractController * | controller

## Detailed Description

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

This is an abstract adapter class, it's useful for implementing adapters such as the DescreteController, which can be used with all Controllers.

Note that the configureable and inspectable classes hold internal lists that are copied here. If a new parameter is added to either interfaces after the call of the contructor then this will not be visible througt the adapter (at least partially. get and set will work but not the printing (also used by store))

## Constructor & Destructor Documentation

AbstractControllerAdapter | ( | AbstractController * | controller | ) | `[inline]`

AbstractControllerAdapter | ( | AbstractController * | controller,
|  | const std::string & | name,
|  | const std::string & | revision |
| ) |  |  | `[inline]`

contructor (hint: use $ID$ for revision)

virtual ~AbstractControllerAdapter | ( |  | ) | `[inline, virtual]`

## Member Function Documentation

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

Reimplemented in AbstractMultiController, DiscreteControllerAdapter, MeasureAdapter, and OneActiveMultiPassiveController.

virtual iparamvallist getInternalParams | ( |  | ) | const`[inline, virtual]`

Returns:
  : list of values

Reimplemented from Inspectable.

Reimplemented in AbstractMultiController, DiscreteControllerAdapter, MeasureAdapter, and OneActiveMultiPassiveController.

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

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

Implements AbstractController.

virtual paramval getParam | ( | const paramkey & | key | ) | const`[inline, virtual]`

virtual paramlist getParamList | ( |  | ) | const`[inline, 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:
  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 NORMALLY be called before use.

For all ControllerAdapters call first AbstractControllerAdapter::init(sensornumber,motornumber) if you overwrite this method

Implements AbstractController.

Reimplemented in AbstractMultiController, DiscreteControllerAdapter, MeasureAdapter, and OneActiveMultiPassiveController.

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

See also:
  Storable

Implements Storeable.

Reimplemented in AbstractMultiController, MeasureAdapter, and OneActiveMultiPassiveController.

virtual bool setParam | ( | const paramkey & | key,
|  | paramval | val |
| ) |  |  | `[inline, virtual]`

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.

Reimplemented in AbstractMultiController, DiscreteControllerAdapter, Discretesizable, MeasureAdapter, and OneActiveMultiPassiveController.

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

performs one step without learning.

See also:
  step

Implements AbstractController.

Reimplemented in AbstractMultiController, DiscreteControllerAdapter, Discretesizable, MeasureAdapter, and OneActiveMultiPassiveController.

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

See also:
  Storable

Implements Storeable.

Reimplemented in AbstractMultiController, MeasureAdapter, and OneActiveMultiPassiveController.

## Member Data Documentation

AbstractController* controller`[protected]`

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

- abstractcontrolleradapter.h