#include <abstractwiring.h>
Inherits Inspectable.
Inherited by DerivativeWiring, FeedbackWiring, One2OneWiring, and WiringSequence.
Inheritance diagram for AbstractWiring:
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 |
Implements wiring of robot sensors to inputs of the controller and controller outputs to robot motors.
typedef double motor |
typedef double sensor |
enum PlotTypes |
AbstractWiring | ( | NoiseGenerator * | noise, | |
int | plotMode = Controller | |||
) | [inline] |
virtual ~AbstractWiring | ( | ) | [inline, virtual] |
destructor
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),
randGen | pointer to random generator, if not given then a new one is created |
Reimplemented in MotorNoiseWiring.
virtual bool initIntern | ( | int | robotsensornumber, | |
int | robotmotornumber, | |||
RandGen * | randGen = 0 | |||
) | [protected, pure virtual] |
to be overloaded by subclasses
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.
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 |
Reimplemented in MotorNoiseWiring.
virtual bool wireMotorsIntern | ( | motor * | rmotors, | |
int | rmotornumber, | |||
const motor * | cmotors, | |||
int | cmotornumber | |||
) | [protected, pure virtual] |
to be overloaded by subclasses
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.
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 |
virtual bool wireSensorsIntern | ( | const sensor * | rsensors, | |
int | rsensornumber, | |||
sensor * | csensors, | |||
int | csensornumber, | |||
double | noiseStrength | |||
) | [protected, pure virtual] |
to be overloaded by subclasses
Implemented in DerivativeWiring, FeedbackWiring, One2OneWiring, SelectiveOne2OneWiring, and WiringSequence.
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
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