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

# MotorBabbler Class Reference

class for robot control that does motor babbling, e.g. More...

`#include <motorbabbler.h>`

Inherits AbstractController.

Collaboration diagram for MotorBabbler:
[legend]

List of all members.

## Public Types
enum | function { Sine, SawTooth }
## Public Member Functions
| MotorBabbler (function func=Sine)
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 *, int number_motors)
| performs one step without learning.
void | sampleFrequencies ()
virtual bool | store (FILE *f) const
virtual bool | restore (FILE *f)
## Static Public Member Functions
static double | sine (double x)
| sine
static double | sawtooth (double x)
| saw tooth shape oscillator
## Protected Attributes
int | number_sensors
int | number_motors
paramval | speed
paramval | amplitude
paramint | resampling
matrix::Matrix | phases
matrix::Matrix | frequencies
RandGen * | randGen
double(* | osci )(double x)
int | t

## Detailed Description

class for robot control that does motor babbling, e.g.

sine waves with different frequencies and phaseshift

## Member Enumeration Documentation

enum function

Enumerator:

  Sine |
  SawTooth |

## Constructor & Destructor Documentation

MotorBabbler | ( | function | func = `Sine` | ) |

Parameters:

  | controlmask | bitmask to select channels to control (default all)
  | function | controller function to use

## Member Function Documentation

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]`

See also:
  Storable

Implements Storeable.

void sampleFrequencies | ( |  | ) |

double sawtooth | ( | double | x | ) | `[static]`

saw tooth shape oscillator

double sine | ( | double | x | ) | `[static]`

sine

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.

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]`

See also:
  Storable

Implements Storeable.

## Member Data Documentation

paramval amplitude`[protected]`

matrix::Matrix frequencies`[protected]`

int number_motors`[protected]`

int number_sensors`[protected]`

double(* osci)(double x)`[protected]`

matrix::Matrix phases`[protected]`

RandGen* randGen`[protected]`

paramint resampling`[protected]`

paramval speed`[protected]`

int t`[protected]`

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

- motorbabbler.h
- motorbabbler.cpp