the fish that looks like a jet

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MainController.h Source File

MainController.h

00001 #ifndef MBED_MAINCONTROLLER_H
00002 #define MBED_MAINCONTROLLER_H
00003  
00004 #include "mbed.h"
00005 #include "PwmIn.h"
00006 #include "motor_controller.h"
00007 #include "guardian.h"
00008 //#include "IMU.h"
00009 
00010 
00011 #define MATH_PI 3.14159265359
00012  
00013 /** MainController class to get control inputs and place them onto the system
00014  * 
00015  * 
00016  */
00017 class MainController {
00018 public:
00019     /** Create a MainController
00020      *
00021      * @param 
00022      */ 
00023     MainController() ;
00024     
00025     /** Start the main controller
00026      *
00027      * @returns 
00028      */
00029     void start();
00030     
00031     float getDutyCycle();
00032     float getFrequency();
00033     float getVolume();
00034     float getAmplitude();
00035     float getRudder();
00036     
00037     /** Stop the main controller
00038      *
00039      * @returns 
00040      */
00041     void stop();
00042     
00043  
00044 protected:        
00045     void control();
00046     float calculateFrequency();
00047     float calculateVolume();
00048     float calculateRudder();
00049     float signum(float input);
00050     float saturate(float input);
00051     
00052 private:
00053     PwmIn ch3;
00054     PwmIn ch4;
00055     PwmIn ch6;
00056     PololuMController mcon;
00057     Guardian ap;
00058     
00059     
00060     Timer timer1;
00061     Ticker ticker1;
00062     float vol;
00063     float frq;
00064     float dutyCycle;
00065     float curTime;
00066     float frqMin;
00067     float frqMax;
00068     float amplitude;
00069     float rud;
00070     float goofftime;
00071     bool switched;
00072 };
00073  
00074 #endif
00075 
00076