Ingmar Loohuis / Mbed 2 deprecated MotorControl

Dependencies:   HIDScope MODSERIAL QEI biquadFilter mbed

Revision:
14:6ecf2b986a4b
Parent:
13:f92e918af729
Child:
15:d38d5d4ae86a
diff -r f92e918af729 -r 6ecf2b986a4b main.cpp
--- a/main.cpp	Mon Oct 24 14:28:04 2016 +0000
+++ b/main.cpp	Tue Oct 25 11:55:47 2016 +0000
@@ -73,7 +73,7 @@
  const double b2 = (4*Kp + 4*Kd*N - 2*Ki*Ts - 2*Kp*N*Ts + Ki*N*pow(Ts,2))/(2*N*Ts + 4);
 
  double v = err - a1*v1 - a2*v2;
- double u = b0*v + b1*v1 + b2*v2;
+ double u = b0*v + b1*v1 + b2*v2; 
  v2 = v1; v1 = v;
  return u;
  }
@@ -92,7 +92,7 @@
  // Next task, measure the error and apply the output to the plant
  void motor1_Controller(double radians)
  {
- double reference = 0.5*pi;
+ double reference = 2.0*pi;
  volatile double error1 = reference - radians;
  motor1 = PID( error1,m1_Kp,m1_Ki,m1_Kd,m1_Ts, m1_N, v1, v2 );
 //pc.printf("%d\n\r",motor1);
@@ -104,7 +104,7 @@
   
 void control(double motor1)
 {
-if(abs(motor1)>0.000015)
+if(abs(motor1)>0.000005)
         {
         motor1MagnitudePin=0.5;//MOET NOG TUSSENWAAREN KRIJGEN
         }