unit test for brushless motors using a potentiometer and a castle creations esc with 0.5 center duty cycle
Fork of brushlessmotor by
MainController.h
- Committer:
- demaille
- Date:
- 2015-07-30
- Revision:
- 2:040b8c8f4f92
- Parent:
- 0:187bb46ed128
- Child:
- 3:605f216167f6
File content as of revision 2:040b8c8f4f92:
#ifndef MBED_MAINCONTROLLER_H #define MBED_MAINCONTROLLER_H #include "mbed.h" #include "PwmIn.h" #include "esc.h" #define MATH_PI 3.14159265359 #define TOFF 0.03 class MainController { public: /** Create a MainController * * @param */ MainController() ; /** Start the main controller * @returns */ void start(); float getDutyCycle(); float getFrequency(); float getAmplitude(); float getYaw(); float getPitch(); float getTimeAdd(); float getAdj(); /** Stop the main controller * @returns */ void stop(); protected: void control(); float calculateFrequency(); float calculateAmplitude(); float calculateYaw(); float calculatePitch(); //float calculateAdj(); float signum(float input); float saturate(float input); private: PwmIn ch1; //yaw PwmIn ch2; //pitch PwmIn ch3; //amp PwmIn ch6; //freq ESC esc1; //Servo leftservo; //Servo rightservo; Timer timer1; Ticker ticker1; float amp; float ampNew; float frq; float dutyCycle; float curTime; float frqMin; float frqMax; float yaw; float pitch; float alPi; //float adj; bool fullCycle; float frqCmd; float raiser; float throttle_var; }; #endif