2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。

Dependencies:   SBDBT arrc_mbed BNO055

Revision:
5:1a850f68a06c
Parent:
0:a1238c4cd105
Child:
7:a0375e6dc8ca
--- a/PIDco.hpp	Sat Jan 22 16:00:04 2022 +0000
+++ b/PIDco.hpp	Sun Jan 23 13:31:36 2022 +0000
@@ -2,9 +2,9 @@
 #define PID_CO_H
 #include "mbed.h"
 
-#define Kp 0.0001
-#define Ki 0.0000014
-#define Kd 0.0000001
+//#define Kp 0.0001
+//#define Ki 0.0000014
+//#define Kd 0.0000001
 #define co (108 * 3.1415926535897) / 500
 
 
@@ -13,7 +13,7 @@
     public://use in main.cpp
         PIDco();
         double obt_spd();
-        void pass_val(double PULSE,double TARGET);
+        void pass_val(double PULSE,double TARGET,double p_gain,double i_gain,double d_gain);
         void wheel_ctl(PinName PIN_A,PinName PIN_B);
     
     private:
@@ -31,6 +31,9 @@
         double Integral,dt;
         double diff,pulse_a,pulse_b;
         double v1p_set,v1m_set;
+        double Kp;
+        double Ki;
+        double Kd;
 };
 
 #endif