AbstractWiring Class Reference

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

#include <abstractwiring.h>

Inherits Inspectable.

Inherited by CopyWiring, DerivativeWiring, FeedbackWiring, ForceBoostWiring, One2OneWiring, and WiringSequence.

Collaboration diagram for AbstractWiring:
Collaboration graph
[legend]

List of all members.

Public Types

enum  PlotTypes { Nothing = 0, Robot = 1, Controller = 4, Noise = 8 }
typedef double sensor
typedef double motor

Public Member Functions

 AbstractWiring (NoiseGenerator *noise, int plotMode=Controller, const std::string &name="AbstractWiring")
 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.
virtual void reset ()
 reset internal state

Protected Member Functions

virtual bool initIntern ()=0
 to be overloaded by subclasses The rsensornumber and rmotornumber are already stored in the member variables.
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
sensornoisevals
int noisenumber
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
NoiseGeneratornoiseGenerator
 noise generator
RandGenrandGen
 random generator used in NoiseGenerator (in case it is needed by subclasses)
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:
Nothing 
Robot 
Controller 
Noise 

Constructor & Destructor Documentation

AbstractWiring ( NoiseGenerator noise,
int  plotMode = Controller,
const std::string &  name = "AbstractWiring" 
) [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) The number of noise channels (noisenumber) can also be changed.

Parameters:
randGen pointer to random generator, if not given then a new one is created
Returns:
returns false on error, otherwise true
virtual bool initIntern (  )  [protected, pure virtual]

to be overloaded by subclasses The rsensornumber and rmotornumber are already stored in the member variables.

The random values are to be accessed via the noiseGenerator.

See also:
init()

Implemented in CopyWiring, DerivativeWiring, FeedbackWiring, ForceBoostWiring, MotorNoiseWiring, One2OneWiring, SelectiveOne2OneWiring, and WiringSequence.

virtual void reset (  )  [inline, virtual]

reset internal state

Reimplemented in CopyWiring, DerivativeWiring, and ForceBoostWiring.

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
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 CopyWiring, DerivativeWiring, FeedbackWiring, ForceBoostWiring, MotorNoiseWiring, 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. Noise values of the right size are then accessible via the noisevals array.

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

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

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

copy of the last robot sensors

noise generator

int noisenumber [protected]
sensor* noisevals [protected]
int plotMode [protected]

using plotTypes this variables defines what is plotted

RandGen* randGen [protected]

random generator used in NoiseGenerator (in case it is needed by subclasses)

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:
Generated on Thu Jun 28 14:48:06 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3