投下モードのpwmを修正

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_34 by 航空研究会

Committer:
taknokolat
Date:
Sat Sep 22 06:59:37 2018 +0000
Revision:
30:624cb32e13a3
Parent:
0:17f575135219
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HARUKIDELTA 0:17f575135219 1 #ifndef PID_MBED_H
HARUKIDELTA 0:17f575135219 2 #define PID_MBED_H
HARUKIDELTA 0:17f575135219 3
HARUKIDELTA 0:17f575135219 4
HARUKIDELTA 0:17f575135219 5 #include "mbed.h"
HARUKIDELTA 0:17f575135219 6
HARUKIDELTA 0:17f575135219 7 class PID
HARUKIDELTA 0:17f575135219 8 {
HARUKIDELTA 0:17f575135219 9 public:
HARUKIDELTA 0:17f575135219 10 double kp, ki, kd, max, min, dt;
HARUKIDELTA 0:17f575135219 11
HARUKIDELTA 0:17f575135219 12 //コンストラクタ
HARUKIDELTA 0:17f575135219 13 PID();
HARUKIDELTA 0:17f575135219 14 PID(double Pgain, double Igain, double Dgain);
HARUKIDELTA 0:17f575135219 15 PID(double Pgain, double Igain, double Dgain, double Max, double Min);
HARUKIDELTA 0:17f575135219 16 //デストラクタ
HARUKIDELTA 0:17f575135219 17 ~PID();
HARUKIDELTA 0:17f575135219 18
HARUKIDELTA 0:17f575135219 19 void initialize(void);
HARUKIDELTA 0:17f575135219 20 void setPIDgain(double Pgain, double Igain, double Dgain);
HARUKIDELTA 0:17f575135219 21 void setMaxMin(double Max, double Min);
HARUKIDELTA 0:17f575135219 22 void switchMaxMin(bool Maxcheck, bool Mincheck);
HARUKIDELTA 0:17f575135219 23 double calcPID(double nowval, double targetval, double dt);
HARUKIDELTA 0:17f575135219 24
HARUKIDELTA 0:17f575135219 25
HARUKIDELTA 0:17f575135219 26 private:
HARUKIDELTA 0:17f575135219 27 double integral;
HARUKIDELTA 0:17f575135219 28 double oldval[2], diff[2];
HARUKIDELTA 0:17f575135219 29 bool maxcheck, mincheck;
HARUKIDELTA 0:17f575135219 30 };
HARUKIDELTA 0:17f575135219 31
HARUKIDELTA 0:17f575135219 32 #endif