robot

Dependencies:   FastPWM3 mbed

Revision:
47:1c9868e226d0
Parent:
46:748aba7d111d
Child:
48:a1a09c83d42c
--- a/main.cpp	Tue Jan 10 04:47:38 2017 +0000
+++ b/main.cpp	Tue Jan 10 05:35:24 2017 +0000
@@ -51,6 +51,7 @@
     if (control_enabled && !io.throttle_in->get_enabled()) go_disabled();
     if (control_enabled && !io.pos->IsValid()) go_disabled();
     if (!control_enabled && io.throttle_in->get_enabled()) go_enabled();
+//    io.pc->printf("Passed safety checks.\n");
     
     /*update velocity, references*/
     update_velocity();
@@ -112,13 +113,9 @@
     vc = vc - voff;
     
     /*output to timers*/
-    //set_dtc(io.a, 0.5f + 0.5f * va);
-    //set_dtc(io.b, 0.5f + 0.5f * vb);
-    //set_dtc(io.c, 0.5f + 0.5f * vc);
-    
-    set_dtc(io.a, 0.95f);
-    set_dtc(io.b, 0.05f);
-    set_dtc(io.c, 0.05f);
+    set_dtc(io.a, 0.5f + 0.5f * va);
+    set_dtc(io.b, 0.5f + 0.5f * vb);
+    set_dtc(io.c, 0.5f + 0.5f * vc);
 }
 
 void slow_loop() {
@@ -155,10 +152,10 @@
 }
 
 int main() {
-    BREMSInit(&io, &read, &foc, &control, false);
     dq = new LinearNoFWMapper(KT, TORQUE_MAX, FLUX_LINKAGE);
     th = new NullThrottleMapper();
-    
+    BREMSInit(&io, &read, &foc, &control, false);
+
     for (;;) {
     }
 }
\ No newline at end of file