MD_PID

Dependencies:   QEI

Dependents:   Omni_2017_z BETA_A ALPHA_A GAMMA_A ... more

Files at this revision

API Documentation at this revision

Comitter:
hirotayamato
Date:
Wed Sep 27 06:49:24 2017 +0000
Parent:
11:b621815834c1
Commit message:
MD_PID

Changed in this revision

MD_PID.cpp Show annotated file Show diff for this revision Revisions of this file
MD_PID.h Show annotated file Show diff for this revision Revisions of this file
--- a/MD_PID.cpp	Thu Sep 14 00:25:53 2017 +0000
+++ b/MD_PID.cpp	Wed Sep 27 06:49:24 2017 +0000
@@ -22,9 +22,10 @@
     Reset();
 }
 
-double MD_PID::Drive(double ref, double stop)
+double MD_PID::Drive(int a, double ref, double stop)
 {
-    ref *= 6;
+    if(a)
+        ref *= 6;
     /*
     if(ref1 != ref)
     {
@@ -45,7 +46,12 @@
             Read_Speed();
         }
         else
-            duty -= PID(ref);
+
+            if(a){
+                duty -= PID(ref);
+            }else{
+                duty = ref;
+            }
 
         if(duty > 1.0)
             duty = 1.0;
--- a/MD_PID.h	Thu Sep 14 00:25:53 2017 +0000
+++ b/MD_PID.h	Wed Sep 27 06:49:24 2017 +0000
@@ -10,7 +10,7 @@
     MD_PID();
     MD_PID( MD *motor_,
             double kp_, double ki_, double kd_, int pulse_, QEI *qei_);
-    double Drive(double ref, double stop);
+    double Drive(int a, double ref, double stop);
     double PID(double target);
     void Read_Speed();
     double Speed();