Hormodular 1.0
Locomotion gait discovery by using digital hormones on modular robots
Oscillator.h
00001 //------------------------------------------------------------------------------
00002 //-- Oscillator
00003 //------------------------------------------------------------------------------
00004 //--
00005 //-- Abstract class that serves as a base to create different oscillators
00006 //--
00007 //------------------------------------------------------------------------------
00008 //--
00009 //-- This file belongs to the Hormodular project
00010 //-- (https://github.com/David-Estevez/hormodular.git)
00011 //--
00012 //------------------------------------------------------------------------------
00013 //-- Author: David Estevez-Fernandez
00014 //--
00015 //-- Released under the GPL license (more info on LICENSE.txt file)
00016 //------------------------------------------------------------------------------
00017 
00024 #ifndef OSCILLATOR_H
00025 #define OSCILLATOR_H
00026 
00027 #include <stdint.h>
00028 #include <iostream>
00029 
00030 namespace hormodular {
00031 
00036 class Oscillator
00037 {
00038 
00039    public:
00040         void setPeriod( int period_ms);
00041         int getPeriod( );
00042 
00043         void setAmplitude( float amplitude);
00044         float getAmplitude();
00045 
00046         void setOffset(float offset);
00047         float getOffset();
00048 
00049         void setPhase( float phase);
00050         float getPhase();
00051 
00059         void setParameters( float amplitude, float offset, float phase, int period_ms = 0);
00060 
00066         virtual float calculatePos( unsigned long time ) = 0;
00067 
00068     protected:
00069         Oscillator();
00070         Oscillator(float amplitude, float offset, float phase, int period_ms = 4000);
00071 
00072         int period_ms;
00073         float amplitude;
00074         float offset;
00075         float phase;
00076 };
00077 }
00078 #endif
 All Classes Functions Variables Friends