Abstract wiring-object between controller and robot. More...
#include <abstractwiring.h>
Inherits Inspectable.
Inherited by CopyWiring, DerivativeWiring, FeedbackWiring, ForceBoostWiring, One2OneWiring, and WiringSequence.
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 | |
sensor * | noisevals |
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 | |
NoiseGenerator * | noiseGenerator |
noise generator | |
RandGen * | randGen |
random generator used in NoiseGenerator (in case it is needed by subclasses) | |
bool | initialised |
Abstract wiring-object between controller and robot.
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 , |
|||
const std::string & | name = "AbstractWiring" | |||
) | [inline] |
constructor
noise | NoiseGenerator that is used for adding noise to sensor values |
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) The number of noise channels (noisenumber) can also be changed.
randGen | pointer to random generator, if not given then a new one is created |
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.
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.
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 |
virtual bool wireMotorsIntern | ( | motor * | rmotors, | |
int | rmotornumber, | |||
const motor * | cmotors, | |||
int | cmotornumber | |||
) | [protected, pure virtual] |
to be overloaded by subclasses
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.
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 |
virtual bool wireSensorsIntern | ( | const sensor * | rsensors, | |
int | rsensornumber, | |||
sensor * | csensors, | |||
int | csensornumber, | |||
double | noiseStrength | |||
) | [protected, pure virtual] |
to be overloaded by subclasses
Implemented in CopyWiring, DerivativeWiring, FeedbackWiring, ForceBoostWiring, One2OneWiring, SelectiveNoiseWiring, 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 noisenumber [protected] |
int plotMode [protected] |
using plotTypes this variables defines what is plotted
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