Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_35 by
Diff: pid/pid.h
- Revision:
- 0:17f575135219
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pid/pid.h Fri Sep 07 04:11:48 2018 +0000
@@ -0,0 +1,32 @@
+#ifndef PID_MBED_H
+#define PID_MBED_H
+
+
+#include "mbed.h"
+
+class PID
+{
+public:
+ double kp, ki, kd, max, min, dt;
+
+ //コンストラクタ
+ PID();
+ PID(double Pgain, double Igain, double Dgain);
+ PID(double Pgain, double Igain, double Dgain, double Max, double Min);
+ //デストラクタ
+ ~PID();
+
+ void initialize(void);
+ void setPIDgain(double Pgain, double Igain, double Dgain);
+ void setMaxMin(double Max, double Min);
+ void switchMaxMin(bool Maxcheck, bool Mincheck);
+ double calcPID(double nowval, double targetval, double dt);
+
+
+private:
+ double integral;
+ double oldval[2], diff[2];
+ bool maxcheck, mincheck;
+};
+
+#endif
\ No newline at end of file
