PID

Fork of QEI by Aaron Berk

Files at this revision

API Documentation at this revision

Comitter:
Joshua_Cheung
Date:
Fri Nov 10 19:22:52 2017 +0000
Parent:
1:8100a4a465b0
Commit message:
PID

Changed in this revision

PID_control.cpp Show diff for this revision Revisions of this file
diff -r 8100a4a465b0 -r 61efaab47e47 PID_control.cpp
--- a/PID_control.cpp	Wed Nov 08 02:59:47 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-
-int P_controller(int error) {
-    int correction = Kp*error;
-    return correction;
-}
-
-int I_Controller(int error) {
-    integrator += error;
-    inte correction = Ki*integrator;
-    integrator /= decayFactor;
-    
-    return correction;
-}
-
-int D_Controller(int error) {
-    int dError = error - prevError;
-    int dt = time.read_us();
-    timer.reset();
-    prevError = error;
-    int correction = Kd*dError/dt;
-    return correction;
-}
-
-Ticker systicker;
-//speed = speed + P_Controller(error) + I_Controller(error) + D_Controller(error);
-void systick() {
-     
-}
-
-int main() {
-    Systicker.attach_us(&systick, 1000);
-}
\ No newline at end of file