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

Dependents:   robotic_fish_ver_4_9_pixy

fishgait.h

Committer:
sandwich
Date:
2014-06-19
Revision:
1:0aa1a6ccf5fe
Parent:
0:aec7653a5b19
Child:
2:d95c40ac8a3e

File content as of revision 1:0aa1a6ccf5fe:

#pragma once
#include "mbed.h"

class fishgait
{
protected:
    Timer* t;
public:
    fishgait(); //give the constructor a timer to use
    ~fishgait();
    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 triangleGait: public fishgait
{
private:
float frq;
float amp;
public:
triangleGait(float freq, float amplitude);
//~triangleGait();
float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
};

class squareGait: public fishgait
{
private:
float frq;
float amp;
public:
squareGait(float freq, float amplitude);
//~triangleGait();
float compute(); //this does a triangle wave pattern. frequency and amplitude controlled
};