robot

Dependencies:   FastPWM3 mbed

Revision:
123:d81d91c9abe8
Parent:
122:53be0630f79d
Child:
124:e70ca81676fc
--- a/main.cpp	Wed Apr 26 03:28:00 2017 +0000
+++ b/main.cpp	Fri Apr 28 01:11:04 2017 +0000
@@ -64,7 +64,7 @@
     loop_counter++;
     
     /*update position, sin, cos*/
-    foc.p = io.pos->GetElecPosition() - POS_OFFSET;
+    foc.p = io.pos->GetElecPosition() - POS_OFFSET + read.w / 1048.0f;
     float sin_p = sinf(foc.p);
     float cos_p = cosf(foc.p);
     
@@ -154,6 +154,7 @@
 void log() {
     io.pc->printf("%d,%d,%d,%d,%d,%d,%d,%d\n", (int) read.w, (int) control.d_ref, (int) control.d_filtered, (int) control.q_ref, (int) control.q_filtered, (int) (255 * control.torque_percent), 
                         (int) (255 * foc.vd), (int) (255 * foc.vq));
+    //io.pc->printf("%d,%d,%d,%d,%d\n", (int) read.w, (int) control.d_filtered, (int) control.q_filtered, (int) (255 * foc.vd), (int) (255 * foc.vq));
     //io.pc->printf("%d\n", io.pos->IsValid());
     wait(1.0f / LOG_FREQUENCY);
 }
@@ -179,7 +180,7 @@
 }
 
 int main() {
-    dq = new LutMapper();//AngleMapper(PI / 2, 200);
+    dq = new LutMapper();//AngleMapper(1.7805f, 48.05f);
     th = new NullThrottleMapper();
     BREMSInit(&io, &read, &foc, &control, false);