robot

Dependencies:   FastPWM3 mbed

Revision:
65:6e1fdbfae57b
Parent:
64:b4175385d718
Child:
68:f69a4f5bc93e
Child:
70:5e39beeb4a21
--- a/main.cpp	Sat Jan 28 23:21:07 2017 +0000
+++ b/main.cpp	Sun Jan 29 07:58:52 2017 +0000
@@ -83,15 +83,11 @@
     control.d_integral += d_err * KI_D;
     control.q_integral += q_err * KI_Q;
     
-    //control.d_integral = constrain(control.d_integral, -INTEGRAL_MAX, INTEGRAL_MAX);
-    //control.q_integral = constrain(control.q_integral, -INTEGRAL_MAX, INTEGRAL_MAX);
     constrain_norm(&control.d_integral, &control.q_integral, 0.5f, 1.0f, 1.0f);
     
     foc.vd = KP_D * d_err + control.d_integral;// - Lq * POLE_PAIRS * read.w * foc.q / BUS_VOLTAGE / 2.0f;
     foc.vq = KP_Q * q_err + control.q_integral;// + Ld * POLE_PAIRS * read.w * foc.d / BUS_VOLTAGE / 2.0f;
     
-    //foc.vd = constrain(foc.vd, -1.0f, 1.0f);
-    //foc.vq = constrain(foc.vq, -1.0f, 1.0f);
     constrain_norm(&foc.vd, &foc.vq, 1.0f, 1.0f, 1.0f);
     
     if (!control_enabled) {
@@ -168,11 +164,5 @@
     BREMSInit(&io, &read, &foc, &control, false);
     
     for (;;) {
-        /*
-        io.pc->printf("%d,%d,%d,%d,%d,%d,%d,%d\n\r", (int) read.w, (int) control.d_ref, (int) control.d_filtered, (int) control.q_ref, (int) control.q_filtered, (int) (256 * io.throttle_in->get_throttle()),
-                       (int) (256 * control.d_integral), (int) (256 * control.q_integral));
-        */
-        io.pc->printf("%f\n", .0743f*read.w);
-        wait(0.01);
     }
 }
\ No newline at end of file