polymorphic base structures for easily implementing different gaits. Triangle wave is already in there

Dependents:   robotic_fish_ver_4_9_pixy

Revision:
2:d95c40ac8a3e
Parent:
1:0aa1a6ccf5fe
--- a/fishgait.h	Thu Jun 19 19:51:59 2014 +0000
+++ b/fishgait.h	Thu Jun 19 21:04:19 2014 +0000
@@ -1,5 +1,6 @@
 #pragma once
 #include "mbed.h"
+#define MAXGAITS 10
 
 class fishgait
 {
@@ -11,25 +12,48 @@
     void setTimer(Timer* tObject); //give the instance a timer to base its calculations off of instead of making a new one
     virtual float compute()=0; //asbtract function to compute output duty cycle. Must redefine in child classes
 };
-
+/*
+class mixedGait : public fishgait
+{
+    private:
+    fishgait gaits[MAXGAITS];
+    float weights[MAXGAITS];
+    int count;
+    public:
+    mixedGait();
+    void attach(fishgait gait, float weight); //gait to attach and its weight in the overall result. weights will be normalized
+    float compute(); //return the mixed signal pattern
+};
+*/
 class triangleGait: public fishgait
 {
 private:
-float frq;
-float amp;
+    float frq;
+    float amp;
 public:
-triangleGait(float freq, float amplitude);
+    triangleGait(float freq, float amplitude);
 //~triangleGait();
-float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
+    float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
 };
 
 class squareGait: public fishgait
 {
 private:
-float frq;
-float amp;
+    float frq;
+    float amp;
 public:
-squareGait(float freq, float amplitude);
+    squareGait(float freq, float amplitude);
 //~triangleGait();
-float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
+    float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
+};
+
+class sawGait: public fishgait
+{
+private:
+    float frq;
+    float amp;
+public:
+    sawGait(float freq, float amplitude);
+//~triangleGait();
+    float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
 };
\ No newline at end of file