motornoisewiring.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __MOTORNOISEWIRING_H
00036 #define __MOTORNOISEWIRING_H
00037
00038 #include <selforg/one2onewiring.h>
00039 #include <selforg/configurable.h>
00040
00041
00042
00043
00044
00045 class MotorNoiseWiring : public One2OneWiring, public Configurable {
00046 public:
00047
00048
00049
00050 MotorNoiseWiring(NoiseGenerator* noise, double noiseStrength)
00051 : One2OneWiring(0),
00052 Configurable("MotorNoiseWiring", "$Id: motornoisewiring.h,v 1.3 2010/03/30 08:48:01 martius Exp $"),
00053 mNoiseGen(noise), noiseStrength(noiseStrength) {
00054 addParameter("strength",&noiseStrength);
00055 }
00056 virtual ~MotorNoiseWiring(){}
00057
00058 virtual bool initIntern(int robotsensornumber, int robotmotornumber, RandGen* randGen=0){
00059 One2OneWiring::initIntern(robotsensornumber, robotmotornumber, randGen);
00060 if(mNoiseGen)
00061 mNoiseGen->init(rmotornumber, randGen);
00062 return true;
00063 }
00064
00065 virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber,
00066 const motor* cmotors, int cmotornumber){
00067 One2OneWiring::wireMotorsIntern(rmotors, rmotornumber, cmotors, cmotornumber);
00068 if(mNoiseGen)
00069 mNoiseGen->add(rmotors, noiseStrength);
00070 return true;
00071 }
00072
00073 protected:
00074 NoiseGenerator* mNoiseGen;
00075 double noiseStrength;
00076
00077 };
00078
00079 #endif