Biorobotics / Mbed 2 deprecated P_controler

Dependencies:   QEI mbed

Files at this revision

API Documentation at this revision

Comitter:
yohoo15
Date:
Wed Oct 14 13:26:00 2015 +0000
Parent:
4:1b4885298ade
Commit message:
The p controler working inlcusive go flag, variable is rotations

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 1b4885298ade -r d8195d9d098f main.cpp
--- a/main.cpp	Wed Oct 14 12:58:25 2015 +0000
+++ b/main.cpp	Wed Oct 14 13:26:00 2015 +0000
@@ -22,7 +22,7 @@
 
 // calculating pulses to rotations in degree.
 const double pulses_per_revolution = 4200 ;//8400 counts is aangegeven op de motor for x4.  10 - 30 counts oveshoot. for moter 1(tape)! Motor 2 almost the same(nice)
-double Rotation = -2; // rotation in degree
+double Rotation = 2; // rotation in degree
 double movement = Rotation * pulses_per_revolution; // times 360 to make Rotations degree.
 
 // defining flags
@@ -44,7 +44,8 @@
 double P(double error, const double Kp)
 { 
 
-    double P_output = Kp * error;
+
+    double P_output = (Kp * error);
     return P_output;
 }
 // Next task, measure the error and apply the output to the plant
@@ -73,8 +74,8 @@
 void counts_showing()
 {
 
-    double kijken = wheel.getPulses();
-    pc.printf("ref %.0f count%.0f \n",movement,kijken);
+    double kijken = wheel.getPulses() / pulses_per_revolution;
+    pc.printf("ref %.0f rounds%.4f \n",Rotation,kijken);
 
 }
 
@@ -98,3 +99,4 @@
 }
 
 
+