![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
code to fly a quadrocopter
PID/PID_pitch.h@0:b0f9c5ac0305, 2020-05-05 (annotated)
- Committer:
- DD1993
- Date:
- Tue May 05 21:11:38 2020 +0000
- Revision:
- 0:b0f9c5ac0305
initial
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DD1993 | 0:b0f9c5ac0305 | 1 | #ifndef PID_PITCH_H |
DD1993 | 0:b0f9c5ac0305 | 2 | #define PID_PITCH_H |
DD1993 | 0:b0f9c5ac0305 | 3 | |
DD1993 | 0:b0f9c5ac0305 | 4 | #include "mbed.h" |
DD1993 | 0:b0f9c5ac0305 | 5 | |
DD1993 | 0:b0f9c5ac0305 | 6 | class PID_PITCH_Class |
DD1993 | 0:b0f9c5ac0305 | 7 | { |
DD1993 | 0:b0f9c5ac0305 | 8 | |
DD1993 | 0:b0f9c5ac0305 | 9 | public: |
DD1993 | 0:b0f9c5ac0305 | 10 | |
DD1993 | 0:b0f9c5ac0305 | 11 | PID_PITCH_Class(float AngleKp,float AngleKi, float RateKp, float RateKd); |
DD1993 | 0:b0f9c5ac0305 | 12 | |
DD1993 | 0:b0f9c5ac0305 | 13 | float update_pitch(float Setpoint, float CurrentPosition, float Rate, float dt); |
DD1993 | 0:b0f9c5ac0305 | 14 | |
DD1993 | 0:b0f9c5ac0305 | 15 | private: |
DD1993 | 0:b0f9c5ac0305 | 16 | |
DD1993 | 0:b0f9c5ac0305 | 17 | float Angle_Kp,Angle_Ki,Rate_Kp,Rate_Kd; |
DD1993 | 0:b0f9c5ac0305 | 18 | float AngleError,RateError; |
DD1993 | 0:b0f9c5ac0305 | 19 | float Angle_I,Rate_D; |
DD1993 | 0:b0f9c5ac0305 | 20 | float Output,WindUp; |
DD1993 | 0:b0f9c5ac0305 | 21 | float PreviousError; |
DD1993 | 0:b0f9c5ac0305 | 22 | |
DD1993 | 0:b0f9c5ac0305 | 23 | }; |
DD1993 | 0:b0f9c5ac0305 | 24 | #endif |