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

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

- Search for |

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

# DiscreteControllerAdapter Class Reference

Adapter class for robot controller. More...

`#include <discretecontrolleradapter.h>`

Inherits AbstractControllerAdapter.

Inherited by Discretesizable.

Inheritance diagram for DiscreteControllerAdapter:

[legend]
Collaboration diagram for DiscreteControllerAdapter:

[legend]
List of all members.

## Public Member Functions
| DiscreteControllerAdapter (AbstractController *controller)
| Adapter class for robot controller.
virtual | ~DiscreteControllerAdapter ()
virtual void | setIntervalCount (int intervalCount)
| Sets the number of intervals, in which sensor AND motor values are mapped.
virtual void | setSensorIntervalCount (int sensorIntervalCount)
| Sets the number of intervals, in which sensor values are mapped.
virtual void | setMotorIntervalCount (int motorIntervalCount)
| Sets the number of intervals, in which motor values are mapped.
virtual void | setIntervalRange (double minRange, double maxRange, bool mapToInterval=true)
| Sets the interval range for the motors AND sensors, the minimum and maximum.
virtual void | setMotorIntervalRange (double minMotorRange, double maxMotorRange, bool mapToMotorInterval=true)
| Sets the interval range for the motors, the minimum and maximum.
virtual void | setSensorIntervalRange (double minSensorRange, double maxSensorRange, bool mapToSensorInterval=true)
| Sets the interval range for the sensors, the minimum and maximum.
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 *, int number_motors)
| performs one step without learning.
virtual void | init (int sensornumber, int motornumber, RandGen *randGen=0)
| init function
virtual std::list< Inspectable::iparamkey > | getInternalParamNames () const
| The list of the names of all internal parameters given by getInternalParams().
virtual std::list< Inspectable::iparamval > | getInternalParams () const
## Protected Attributes
int | sensorIntervalCount
int | motorIntervalCount
bool | automaticMotorRange
bool | automaticSensorRange
bool | mapToSensorInterval
bool | mapToMotorInterval
double | minMotorRange
double | maxMotorRange
double | minSensorRange
double | maxSensorRange

## Detailed Description

Adapter class for robot controller.

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

These sensor and motor values are discretesized with this adapter.

Use this adapter between an agent and a controller to get discrete sensor and motor values.

The sensor values are hand over to the controller from the agent, in the other direction the motor values of the controller are hand over to the agent.

If no intervalCount is set, the count=1. If no intervalRange is set, the range is automatically adjusted.

For more details about controllers, see AbstractController and all implementing classes.

See also:
  AbstractController

  AbstractControllerAdapter

Author:
  Frank Güttler <frankguettler@gmx.de>

## Constructor & Destructor Documentation

DiscreteControllerAdapter | ( | AbstractController * | controller | ) |

Adapter class for robot controller.

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

These sensor and motor values are discretesized with this adapter.

Use this adapter between an agent and a controller to get discrete sensor and motor values.

The sensor values are hand over to the controller from the agent, in the other direction the motor values of the controller are hand over to the agent.

For more details about controllers, see AbstractController and all implementing classes.

Author:
  Frank Güttler <frankguettler@gmx.de>

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

## Member Function Documentation

std::list< Inspectable::iparamkey > getInternalParamNames | ( |  | ) | const`[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 AbstractControllerAdapter.

std::list< Inspectable::iparamval > getInternalParams | ( |  | ) | const`[virtual]`

Returns:
  : list of values

Reimplemented from AbstractControllerAdapter.

void init | ( | int | sensornumber,
|  | int | motornumber,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[virtual]`

init function

Reimplemented from AbstractControllerAdapter.

void setIntervalCount | ( | int | intervalCount | ) | `[virtual]`

Sets the number of intervals, in which sensor AND motor values are mapped.

Parameters:

  | intervalCount | the number of intervals

void setIntervalRange | ( | double | minRange,
|  | double | maxRange,
|  | bool | mapToInterval = `true` |
| ) |  |  | `[virtual]`

Sets the interval range for the motors AND sensors, the minimum and maximum.

The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minRange respectively maxRange.

Note: The adjustment of the range is disabled, if this method is called.

Parameters:

  | minRange | the minimum of the interval
  | maxRange | the maximum of the interval
  | mapToInterval | decides if all values are mapped to the given interval

void setMotorIntervalCount | ( | int | motorIntervalCount | ) | `[virtual]`

Sets the number of intervals, in which motor values are mapped.

Parameters:

  | motorIntervalCount | the number of intervals

void setMotorIntervalRange | ( | double | minMotorRange,
|  | double | maxMotorRange,
|  | bool | mapToMotorInterval = `true` |
| ) |  |  | `[virtual]`

Sets the interval range for the motors, the minimum and maximum.

The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minMotorRange respectively maxMotorRange.

Note: The adjustment of the range is disabled, if this method is called.

Parameters:

  | minMotorRange | the minimum of the interval
  | maxMotorRange | the maximum of the interval
  | mapToMotorInterval | decides if all values are mapped to the given interval

void setSensorIntervalCount | ( | int | sensorIntervalCount | ) | `[virtual]`

Sets the number of intervals, in which sensor values are mapped.

Parameters:

  | sensorIntervalCount | the number of intervals

void setSensorIntervalRange | ( | double | minSensorRange,
|  | double | maxSensorRange,
|  | bool | mapToSensorInterval = `true` |
| ) |  |  | `[virtual]`

Sets the interval range for the sensors, the minimum and maximum.

The third parameter decides if the originally range should be completely mapped to the given interval range. If not, the values outside the given interval range are set to minSensorRange respectively maxSensorRange.

Note: The adjustment of the range is disabled, if this method is called.

Parameters:

  | minSensorRange | the minimum of the interval
  | maxSensorRange | the maximum of the interval
  | mapToSensorInterval | decides if all values are mapped to the given interval

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

Reimplemented in Discretesizable.

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

performs one step without learning.

See also:
  step

Reimplemented from AbstractControllerAdapter.

Reimplemented in Discretesizable.

## Member Data Documentation

bool automaticMotorRange`[protected]`

bool automaticSensorRange`[protected]`

bool mapToMotorInterval`[protected]`

bool mapToSensorInterval`[protected]`

double maxMotorRange`[protected]`

double maxSensorRange`[protected]`

double minMotorRange`[protected]`

double minSensorRange`[protected]`

int motorIntervalCount`[protected]`

int sensorIntervalCount`[protected]`

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

- discretecontrolleradapter.h
- discretecontrolleradapter.cpp