An incomplete quadcopter control programme.

Dependencies:   mbed

Committer:
Gurvan
Date:
Wed Jul 17 15:58:25 2013 +0000
Revision:
0:9cb9445a11f0
Pour Zobson, fi(r)st commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gurvan 0:9cb9445a11f0 1 #ifndef PID_H
Gurvan 0:9cb9445a11f0 2 #define PID_H
Gurvan 0:9cb9445a11f0 3
Gurvan 0:9cb9445a11f0 4
Gurvan 0:9cb9445a11f0 5 #include "mbed.h"
Gurvan 0:9cb9445a11f0 6
Gurvan 0:9cb9445a11f0 7 class DaclePID{
Gurvan 0:9cb9445a11f0 8
Gurvan 0:9cb9445a11f0 9 public:
Gurvan 0:9cb9445a11f0 10
Gurvan 0:9cb9445a11f0 11 /* Constructeur du DaclePID
Gurvan 0:9cb9445a11f0 12 Kc: Coeff Kc
Gurvan 0:9cb9445a11f0 13 Ti: Coeff Ti
Gurvan 0:9cb9445a11f0 14 Td: Coeff Td
Gurvan 0:9cb9445a11f0 15 Interval: Intervalle de temps */
Gurvan 0:9cb9445a11f0 16 DaclePID(float Kc, float Ti, float Td, float interval);
Gurvan 0:9cb9445a11f0 17
Gurvan 0:9cb9445a11f0 18 /* Fonction qui permet de regler les coeff du PID */
Gurvan 0:9cb9445a11f0 19 void setCoeff(float Kc, float Ti, float Td);
Gurvan 0:9cb9445a11f0 20
Gurvan 0:9cb9445a11f0 21 /* Fonction qui permet au DaclePID de calculer la commande
Gurvan 0:9cb9445a11f0 22 en entrée: Erreur */
Gurvan 0:9cb9445a11f0 23 void setInputLimits(float minInput, float maxInput);
Gurvan 0:9cb9445a11f0 24 void setOutputLimits(float minOutput, float maxOutput);
Gurvan 0:9cb9445a11f0 25 void setConsigne(float consigne);
Gurvan 0:9cb9445a11f0 26 void setBiais(float biais);
Gurvan 0:9cb9445a11f0 27 float dacalcul(float erreur);
Gurvan 0:9cb9445a11f0 28
Gurvan 0:9cb9445a11f0 29 private:
Gurvan 0:9cb9445a11f0 30
Gurvan 0:9cb9445a11f0 31 float Kc_;
Gurvan 0:9cb9445a11f0 32 float Ti_;
Gurvan 0:9cb9445a11f0 33 float Td_;
Gurvan 0:9cb9445a11f0 34
Gurvan 0:9cb9445a11f0 35 float dT_;
Gurvan 0:9cb9445a11f0 36 float accError_; //Erreur accumulée (Pour l'intégrale de l'erreur)
Gurvan 0:9cb9445a11f0 37 float pidSortie_; //Commande
Gurvan 0:9cb9445a11f0 38 float erreurPres_; //Erreur au temps d'avant (pour la dérivée)
Gurvan 0:9cb9445a11f0 39
Gurvan 0:9cb9445a11f0 40 float minInput_, maxInput_, minOutput_, maxOutput_;
Gurvan 0:9cb9445a11f0 41 float consigne_, biais_;
Gurvan 0:9cb9445a11f0 42
Gurvan 0:9cb9445a11f0 43 float to01(float x);
Gurvan 0:9cb9445a11f0 44 float from01(float x);
Gurvan 0:9cb9445a11f0 45
Gurvan 0:9cb9445a11f0 46 };
Gurvan 0:9cb9445a11f0 47
Gurvan 0:9cb9445a11f0 48 #endif