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

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

- Search for |

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

# AbstractWiring Class Reference

Abstract wiring-object between controller and robot. More...

`#include <abstractwiring.h>`

Inherits Inspectable.

Inherited by DerivativeWiring, FeedbackWiring, One2OneWiring, and WiringSequence.

Inheritance diagram for AbstractWiring:

[legend]
Collaboration diagram for AbstractWiring:

[legend]
List of all members.

## Public Types
typedef double | sensor
typedef double | motor
| Robot
| Controller
| Noise
enum | PlotTypes { Robot, Controller, Noise }
## Public Member Functions
| AbstractWiring (NoiseGenerator *noise, int plotMode=Controller)
| constructor
virtual | ~AbstractWiring ()
| destructor
virtual bool | init (int robotsensornumber, int robotmotornumber, RandGen *randGen=0)
| Initializes the number of sensors and motors from robot (to be precise the internal parameters rsensornumber and rmotornumber!), calculates the number of sensors and motors on controller side.
virtual bool | wireSensors (const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noiseStrength)
| Realizes wiring from robot sensors to controller sensors.
virtual bool | wireMotors (motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)
| Realizes wiring from controller motor outputs to robot motors.
virtual int | getRobotSensornumber ()
| Returns the number of sensors on robot side.
virtual int | getRobotMotornumber ()
| Returns the number of motors on robot side.
virtual int | getControllerSensornumber ()
| Returns the number of sensors on controller side.
virtual int | getControllerMotornumber ()
| Returns the number of motors on controller side.
## Protected Member Functions
virtual bool | initIntern (int robotsensornumber, int robotmotornumber, RandGen *randGen=0)=0
| to be overloaded by subclasses
virtual bool | wireSensorsIntern (const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noiseStrength)=0
| to be overloaded by subclasses
virtual bool | wireMotorsIntern (motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)=0
| to be overloaded by subclasses
## Protected Attributes
int | plotMode
| using plotTypes this variables defines what is plotted
matrix::Matrix | mNoise
| for storing the noise values
sensor * | noisevals
int | rsensornumber
| number of sensors at robot side
matrix::Matrix | mRsensors
| copy of the last robot sensors
int | rmotornumber
| number of motors at robot side
matrix::Matrix | mRmotors
| copy of the last robot motors
int | csensornumber
| number of sensors at controller side
matrix::Matrix | mCsensors
| copy of the last controller sensors
int | cmotornumber
| number of motors at controller side
matrix::Matrix | mCmotors
| copy of the last controller motors
NoiseGenerator * | noiseGenerator
| noise generator
bool | initialised

## Detailed Description

Abstract wiring-object between controller and robot.

Implements wiring of robot sensors to inputs of the controller and controller outputs to robot motors.

Examples:

  integration/main.cpp.

## Member Typedef Documentation

typedef double motor

typedef double sensor

## Member Enumeration Documentation

enum PlotTypes

Enumerator:

  Robot |
  Controller |
  Noise |

## Constructor & Destructor Documentation

AbstractWiring | ( | NoiseGenerator * | noise,
|  | int | plotMode = `Controller` |
| ) |  |  | `[inline]`

constructor

Parameters:

  | noise | NoiseGenerator that is used for adding noise to sensor values

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

destructor

## Member Function Documentation

virtual int getControllerMotornumber | ( |  | ) | `[inline, virtual]`

Returns the number of motors on controller side.

virtual int getControllerSensornumber | ( |  | ) | `[inline, virtual]`

Returns the number of sensors on controller side.

virtual int getRobotMotornumber | ( |  | ) | `[inline, virtual]`

Returns the number of motors on robot side.

virtual int getRobotSensornumber | ( |  | ) | `[inline, virtual]`

Returns the number of sensors on robot side.

bool init | ( | int | robotsensornumber,
|  | int | robotmotornumber,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[virtual]`

Initializes the number of sensors and motors from robot (to be precise the internal parameters rsensornumber and rmotornumber!), calculates the number of sensors and motors on controller side.

The internal version initIntern() is called from here and be overloaded to calculate and provide the appropriate numbers controllersensornumber (csensornumber), controllermotornumber (cmotornumber), robotsensornumber (rsensornumber) and robotmotornumber (rmotornumber),

Parameters:

  | randGen | pointer to random generator, if not given then a new one is created

Returns:
  returns false on error, otherwise true

Reimplemented in MotorNoiseWiring.

virtual bool initIntern | ( | int | robotsensornumber,
|  | int | robotmotornumber,
|  | RandGen * | randGen = `0` |
| ) |  |  | `[protected, pure virtual]`

to be overloaded by subclasses

See also:
  init()

Implemented in DerivativeWiring, FeedbackWiring, One2OneWiring, SelectiveOne2OneWiring, and WiringSequence.

bool wireMotors | ( | motor * | rmotors,
|  | int | rmotornumber,
|  | const motor * | cmotors,
|  | int | cmotornumber |
| ) |  |  | `[virtual]`

Realizes wiring from controller motor outputs to robot motors.

The internal version wireMotorsIntern() is called from here and must be overloaded in order to implement the appropriate mapping.

Parameters:

  | rmotors | pointer to array of motorvalues for robot
  | rmotornumber | number of robot motors
  | cmotors | pointer to array of motorvalues from controller
  | cmotornumber | number of motorvalues from controller

Returns:
  returns false if error, else true

Reimplemented in MotorNoiseWiring.

virtual bool wireMotorsIntern | ( | motor * | rmotors,
|  | int | rmotornumber,
|  | const motor * | cmotors,
|  | int | cmotornumber |
| ) |  |  | `[protected, pure virtual]`

to be overloaded by subclasses

See also:
  wireMotors()

Implemented in DerivativeWiring, FeedbackWiring, One2OneWiring, and WiringSequence.

bool wireSensors | ( | const sensor * | rsensors,
|  | int | rsensornumber,
|  | sensor * | csensors,
|  | int | csensornumber,
|  | double | noiseStrength |
| ) |  |  | `[virtual]`

Realizes wiring from robot sensors to controller sensors.

The internal version wireSensorsIntern() is called from here and must be overloaded in order to implement the appropriate mapping.

Parameters:

  | rsensors | pointer to array of sensorvalues from robot
  | rsensornumber | number of sensors from robot
  | csensors | pointer to array of sensorvalues for controller
  | csensornumber | number of sensors to controller
  | noise | size of the noise added to the sensors

Returns:
  returns false on error, otherwise true

virtual bool wireSensorsIntern | ( | const sensor * | rsensors,
|  | int | rsensornumber,
|  | sensor * | csensors,
|  | int | csensornumber,
|  | double | noiseStrength |
| ) |  |  | `[protected, pure virtual]`

to be overloaded by subclasses

See also:
  wireSensors()

Implemented in DerivativeWiring, FeedbackWiring, One2OneWiring, SelectiveOne2OneWiring, and WiringSequence.

## Member Data Documentation

int cmotornumber`[protected]`

number of motors at controller side

int csensornumber`[protected]`

number of sensors at controller side

bool initialised`[protected]`

Reimplemented in WiringSequence.

matrix::Matrix mCmotors`[protected]`

copy of the last controller motors

matrix::Matrix mCsensors`[protected]`

copy of the last controller sensors

matrix::Matrix mNoise`[protected]`

for storing the noise values

matrix::Matrix mRmotors`[protected]`

copy of the last robot motors

matrix::Matrix mRsensors`[protected]`

copy of the last robot sensors

NoiseGenerator* noiseGenerator`[protected]`

noise generator

sensor* noisevals`[protected]`

int plotMode`[protected]`

using plotTypes this variables defines what is plotted

int rmotornumber`[protected]`

number of motors at robot side

int rsensornumber`[protected]`

number of sensors at robot side

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

- abstractwiring.h
- abstractwiring.cpp