quadcopter cufe
/
2006_Theta_Control_yaw
Quadcopter Attitude Control(Yaw-Pitch-Roll)
Diff: PID_Yaw.h
- Revision:
- 0:e63996fd7d3e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PID_Yaw.h Fri Jul 03 11:16:02 2015 +0000 @@ -0,0 +1,41 @@ +//Includes// +#ifndef _QuadCopter_H_yaw +#define _QuadCopter_H_yaw +#ifndef _MBED_H +#define _MBED_H +#include "mbed.h" +#endif +#ifndef _IOSTREAM_ +#define _IOSTREAM_ +#include "iostream" +#endif +#ifndef _MATH_H +#define _MATH_H +#define D_BAUDRATE 115200 +//#include "math.h" +#endif +class PID_Yaw{ + public: + PID_Yaw(float KP,float KI,float KD,float KDD);//constructor + + void PWM_cal(float RPM_req,float RPM_curr,float req_power_SP,float * xPlanePWM,float *yPlanePWM );//calculating the PWM taking in mind upper/lower limits and error calculation/estimation. + void Set_OUT_Limits(float LowerLimit,float UpperLimit);//setting Output Limits. + void Set_IN_Limits(float LowerLimit,float UpperLimit);//setting Input Limits. + void Check_OUT_Limits(float *RPMSetPoint);//checking Input Limits in the Realtime operation. + void Check_IN_Limits(float *O_PWM);//checking Output Limits in Realtime operation. + + private: + void Pulse_Error_cal(float RPM_req,float RPM_curr);//error calculating and out the relative output to the relative error. + //variables and PinRoles + float PowerSetPoint;//,RPMSetPoint; + float Out_PWM,Out_PWM2; + float O_Upper_Limit,O_Lower_Limit; + float I_Upper_Limit,I_Lower_Limit; + float Error,ErrorI,ErrorD,ErrorOLD,ErrorDD,ErrorDOLD; + float h; + float _KP,_KD,_KI,_KDD; + //Serial debugSerial; + +}; + +#endif \ No newline at end of file