polymorphic base structures for easily implementing different gaits. Triangle wave is already in there
Dependents: robotic_fish_ver_4_9_pixy
Diff: fishgait.h
- Revision:
- 0:aec7653a5b19
- Child:
- 1:0aa1a6ccf5fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fishgait.h Thu Jun 19 17:53:17 2014 +0000 @@ -0,0 +1,24 @@ +#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 +}; \ No newline at end of file