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 #ifndef __MOTORNOISEWIRING_H
00033 #define __MOTORNOISEWIRING_H
00034
00035 #include <selforg/one2onewiring.h>
00036 #include <selforg/configurable.h>
00037
00038
00039
00040
00041
00042 class MotorNoiseWiring : public One2OneWiring, public Configurable {
00043 public:
00044
00045
00046
00047 MotorNoiseWiring(NoiseGenerator* noise, double noiseStrength)
00048 : One2OneWiring(0),
00049 Configurable("MotorNoiseWiring", "$Id: motornoisewiring.h,v 1.2 2009/03/31 15:47:11 martius Exp $"),
00050 mNoiseGen(noise), noiseStrength(noiseStrength) {
00051 addParameter("strength",&noiseStrength);
00052 }
00053 virtual ~MotorNoiseWiring(){}
00054
00055 virtual bool init(int robotsensornumber, int robotmotornumber, RandGen* randGen=0){
00056 One2OneWiring::init(robotsensornumber, robotmotornumber, randGen);
00057 if(mNoiseGen)
00058 mNoiseGen->init(rmotornumber, randGen);
00059 return true;
00060 }
00061
00062 virtual bool wireMotors(motor* rmotors, int rmotornumber,
00063 const motor* cmotors, int cmotornumber){
00064 One2OneWiring::wireMotors(rmotors, rmotornumber, cmotors, cmotornumber);
00065 if(mNoiseGen)
00066 mNoiseGen->add(rmotors, noiseStrength);
00067 return true;
00068 }
00069
00070 protected:
00071 NoiseGenerator* mNoiseGen;
00072 double noiseStrength;
00073
00074 };
00075
00076 #endif