Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AbstractWiring Class Referenceabstract

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

#include <abstractwiring.h>

Inheritance diagram for AbstractWiring:
Collaboration diagram for AbstractWiring:

Public Types

enum  PlotTypes { Nothing =0, Robot =1, Controller =4, Noise =8 }
 
typedef double sensor
 
typedef double motor
 
- Public Types inherited from Inspectable
typedef std::string iparamkey
 
typedef double iparamval
 
typedef std::pair< iparamkey,
iparamval const * > 
iparampair
 
typedef std::pair< iparamkey,
std::pair< const
matrix::Matrix *, bool > > 
imatrixpair
 
typedef std::list< iparamkeyiparamkeylist
 
typedef std::list< std::string > infoLinesList
 
typedef std::list< iparamvaliparamvallist
 
typedef std::list< iparamval
const * > 
iparamvalptrlist
 
typedef std::list< iparampairiparampairlist
 
typedef std::list< imatrixpairimatrixpairlist
 
typedef struct Inspectable::ILayer ILayer
 
typedef struct
Inspectable::IConnection 
IConnection
 
typedef std::list< ILayerilayerlist
 
typedef std::list< IConnectioniconnectionlist
 
typedef std::list< const
Inspectable * > 
inspectableList
 

Public Member Functions

 AbstractWiring (NoiseGenerator *noise, int plotMode=Controller, const std::string &name="AbstractWiring")
 constructor More...
 
virtual ~AbstractWiring ()
 destructor More...
 
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. More...
 
virtual bool wireSensors (const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noiseStrength)
 Realizes wiring from robot sensors to controller sensors. More...
 
virtual bool wireMotors (motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)
 Realizes wiring from controller motor outputs to robot motors. More...
 
virtual int getRobotSensornumber ()
 Returns the number of sensors on robot side. More...
 
virtual int getRobotMotornumber ()
 Returns the number of motors on robot side. More...
 
virtual int getControllerSensornumber ()
 Returns the number of sensors on controller side. More...
 
virtual int getControllerMotornumber ()
 Returns the number of motors on controller side. More...
 
virtual std::list
< SensorMotorInfo
wireSensorInfos (const std::list< SensorMotorInfo > &robotSensorInfos)
 routes the infos of the motors from robot to controller More...
 
virtual std::list
< SensorMotorInfo
wireMotorInfos (const std::list< SensorMotorInfo > &robotMotorInfos)
 routes the infos of the motors from robot to controller More...
 
virtual void reset ()
 reset internal state More...
 
void addSensorMotorInfosToInspectable (const std::list< SensorMotorInfo > &robotSensorInfos, const std::list< SensorMotorInfo > &robotMotorInfos, const std::list< SensorMotorInfo > &controllerSensorInfos, const std::list< SensorMotorInfo > &controllerMotorInfos)
 used by WiredController to pass infos to inspectable More...
 
- Public Member Functions inherited from Inspectable
 Inspectable (const iparamkey &name="")
 TYPEDEFS END. More...
 
virtual ~Inspectable ()
 
virtual iparamkeylist getInternalParamNames () const
 The list of the names of all internal parameters given by getInternalParams(). More...
 
virtual iparamvallist getInternalParams () const
 
virtual iparamvalptrlist getInternalParamsPtr () const
 be careful: matrices will be ignored More...
 
virtual ilayerlist getStructuralLayers () const
 Specifies which parameter vector forms a structural layer (in terms of a neural network) The ordering is important. More...
 
virtual iconnectionlist getStructuralConnections () const
 Specifies which parameter matrix forms a connection between layers (in terms of a neural network) The orderning is not important. More...
 
virtual void addInspectableValue (const iparamkey &key, iparamval const *val, const std::string &descr=std::string())
 This is the new style for adding inspectable values. More...
 
virtual void addInspectableMatrix (const iparamkey &key, const matrix::Matrix *m, bool only4x4AndDiag=true, const std::string &descr=std::string())
 This is the new style for adding inspectable values. More...
 
virtual void addInspectableDescription (const iparamkey &key, const std::string &descr)
 adds a description for the given parameter using info-lines The line will start (appart from the #I) with a D for description followed by the key end then followed by the string. More...
 
virtual void addInfoLine (std::string infoLine)
 Adds an info line to this inspectable instance. More...
 
virtual void addInfoLines (std::list< std::string > infoLineList)
 Adds a bunch of infolines with addInfoLine to this inspectable instance. More...
 
virtual void removeInfoLines ()
 Removes all infolines from this inspectable instance. More...
 
virtual const infoLinesListgetInfoLines () const
 Returns all infolines added to this inspectable instance. More...
 
virtual void addInspectable (Inspectable *insp)
 Adds an inspectable as a child object. More...
 
virtual void removeInspectable (Inspectable *insp)
 Removes an inspectable as a child object. More...
 
virtual void setNameOfInspectable (const iparamkey &name)
 set the name of the inspectable More...
 
virtual const iparamkey getNameOfInspectable () const
 return the name of the inspectable, getName() would conflict with Configurable::getName() too often More...
 
virtual const inspectableListgetInspectables () const
 Returns the list containing all inspectable children. More...
 

Protected Member Functions

virtual bool initIntern ()=0
 to be overloaded by subclasses The rsensornumber and rmotornumber are already stored in the member variables. More...
 
virtual bool wireSensorsIntern (const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noiseStrength)=0
 to be overloaded by subclasses More...
 
virtual bool wireMotorsIntern (motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)=0
 to be overloaded by subclasses More...
 

Protected Attributes

int plotMode
 using plotTypes this variables defines what is plotted More...
 
matrix::Matrix mNoise
 for storing the noise values More...
 
sensornoisevals
 
int noisenumber
 
int rsensornumber
 number of sensors at robot side More...
 
matrix::Matrix mRsensors
 copy of the last robot sensors More...
 
int rmotornumber
 number of motors at robot side More...
 
matrix::Matrix mRmotors
 copy of the last robot motors More...
 
int csensornumber
 number of sensors at controller side More...
 
matrix::Matrix mCsensors
 copy of the last controller sensors More...
 
int cmotornumber
 number of motors at controller side More...
 
matrix::Matrix mCmotors
 copy of the last controller motors More...
 
NoiseGeneratornoiseGenerator
 noise generator More...
 
RandGenrandGen
 random generator used in NoiseGenerator (in case it is needed by subclasses) More...
 
bool initialised
 
- Protected Attributes inherited from Inspectable
iparamkey name
 
iparampairlist mapOfValues
 
imatrixpairlist mapOfMatrices
 
infoLinesList infoLineStringList
 

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
noiseNoiseGenerator that is used for adding noise to sensor values
virtual ~AbstractWiring ( )
inlinevirtual

destructor

Member Function Documentation

void addSensorMotorInfosToInspectable ( const std::list< SensorMotorInfo > &  robotSensorInfos,
const std::list< SensorMotorInfo > &  robotMotorInfos,
const std::list< SensorMotorInfo > &  controllerSensorInfos,
const std::list< SensorMotorInfo > &  controllerMotorInfos 
)

used by WiredController to pass infos to inspectable

virtual int getControllerMotornumber ( )
inlinevirtual

Returns the number of motors on controller side.

virtual int getControllerSensornumber ( )
inlinevirtual

Returns the number of sensors on controller side.

virtual int getRobotMotornumber ( )
inlinevirtual

Returns the number of motors on robot side.

virtual int getRobotSensornumber ( )
inlinevirtual

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
randGenpointer to random generator, if not given then a new one is created
Returns
returns false on error, otherwise true
virtual bool initIntern ( )
protectedpure 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 DerivativeWiring, SelectiveOne2OneWiring, CopyWiring, FeedbackWiring, ForceBoostWiring, MotorNoiseWiring, One2OneWiring, and WiringSequence.

virtual void reset ( )
inlinevirtual

reset internal state

Reimplemented in DerivativeWiring, CopyWiring, and ForceBoostWiring.

std::list< SensorMotorInfo > wireMotorInfos ( const std::list< SensorMotorInfo > &  robotMotorInfos)
virtual

routes the infos of the motors from robot to controller

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
rmotorspointer to array of motorvalues for robot
rmotornumbernumber of robot motors
cmotorspointer to array of motorvalues from controller
cmotornumbernumber of motorvalues from controller
Returns
returns false if error, else true
virtual bool wireMotorsIntern ( motor rmotors,
int  rmotornumber,
const motor cmotors,
int  cmotornumber 
)
protectedpure virtual

to be overloaded by subclasses

See Also
wireMotors()

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

std::list< SensorMotorInfo > wireSensorInfos ( const std::list< SensorMotorInfo > &  robotSensorInfos)
virtual

routes the infos of the motors from robot to controller

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
rsensorspointer to array of sensorvalues from robot
rsensornumbernumber of sensors from robot
csensorspointer to array of sensorvalues for controller
csensornumbernumber of sensors to controller
noiseStrengthsize 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 
)
protectedpure 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
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
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: