motorbabbler.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 #ifndef __MOTORBABBLER_H
00025 #define __MOTORBABBLER_H
00026
00027 #include <stdio.h>
00028 #include "abstractcontroller.h"
00029 #include "matrix.h"
00030
00031
00032
00033
00034
00035 class MotorBabbler : public AbstractController {
00036 public:
00037 enum function {Sine, SawTooth};
00038
00039
00040
00041
00042
00043 MotorBabbler(function func = Sine );
00044
00045 virtual void init(int sensornumber, int motornumber, RandGen* randGen = 0);
00046 virtual int getSensorNumber() const {return number_sensors;}
00047 virtual int getMotorNumber() const {return number_motors;}
00048 virtual void step(const sensor* sensors, int sensornumber,
00049 motor* motors, int motornumber){
00050 stepNoLearning(sensors, sensornumber, motors, motornumber);
00051 }
00052 virtual void stepNoLearning(const sensor* , int number_sensors,
00053 motor* , int number_motors);
00054
00055
00056 void sampleFrequencies();
00057
00058
00059
00060 virtual bool store(FILE* f) const {
00061 Configurable::print(f,"");
00062 return true;
00063 }
00064
00065
00066 virtual bool restore(FILE* f) {
00067 Configurable::parse(f);
00068 return true;
00069 }
00070
00071
00072 static double sine(double x);
00073
00074 static double sawtooth(double x);
00075
00076 protected:
00077 int number_sensors;
00078 int number_motors;
00079
00080 paramval speed;
00081 paramval amplitude;
00082 paramint resampling;
00083 matrix::Matrix phases;
00084 matrix::Matrix frequencies;
00085
00086 RandGen* randGen;
00087
00088 double (*osci) (double x);
00089 int t;
00090 };
00091
00092 #endif