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

# Braitenberg Class Reference

simple braitenberg controler type 2 a and b (Aggressive,Cowardly) More...

`#include <braitenberg.h>`

Inherits AbstractController.

Collaboration diagram for Braitenberg:
[legend]

List of all members.

## Public Types
enum | Type { Aggressive, Cowardly }
## Public Member Functions
| Braitenberg (Type type, int leftsensor, int rightsensor, int leftmotor=0, int rightmotor=1)
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 *sensors, int sensornumber, motor *motors, int motornumber)
| performs one step without learning.
virtual bool | store (FILE *f) const
virtual bool | restore (FILE *f)
## Protected Attributes
Type | type
int | leftsensor
int | rightsensor
int | leftmotor
int | rightmotor
int | number_sensors
int | number_motors
paramval | strength
paramval | offset

## Detailed Description

simple braitenberg controler type 2 a and b (Aggressive,Cowardly)

assumes a linecamera (see LineImgProc), left and right sensor are specified in the constructor

## Member Enumeration Documentation

enum Type

Enumerator:

  Aggressive |
  Cowardly |

## Constructor & Destructor Documentation

Braitenberg | ( | Type | type,
|  | int | leftsensor,
|  | int | rightsensor,
|  | int | leftmotor = `0`,
|  | int | rightmotor = `1` |
| ) |  |  | `[inline]`

Parameters:

  | type | Braitenberg type
  | leftsensor | index of left light sensor
  | rightsensor | index of right light sensor
  | leftmotor | index of motor of left wheel
  | rightmotor | index of motor of right wheel

## 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.

virtual void init | ( | int | sensornumber,
|  | int | motornumber,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[inline, 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.

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.

virtual void stepNoLearning | ( | const sensor * | ,
|  | int | number_sensors,
|  | motor * | ,
|  | int | number_motors |
| ) |  |  | `[inline, 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

int leftmotor`[protected]`

int leftsensor`[protected]`

int number_motors`[protected]`

int number_sensors`[protected]`

paramval offset`[protected]`

int rightmotor`[protected]`

int rightsensor`[protected]`

paramval strength`[protected]`

Type type`[protected]`

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

- braitenberg.h