Motor control for robots. More compact, less object-oriented revision.

Dependencies:   FastPWM3 mbed-dev-f303

Fork of Hobbyking_Cheetah_V1 by Ben Katz

Revision:
38:67e4e1453a4b
Parent:
37:c0f352d6e8e3
Child:
39:3580a907ef93
--- a/main.cpp	Fri Apr 13 13:50:54 2018 +0000
+++ b/main.cpp	Mon May 14 20:59:02 2018 +0000
@@ -10,7 +10,7 @@
 #define SETUP_MODE 4
 #define ENCODER_MODE 5
 
-#define VERSION_NUM "1.4"
+#define VERSION_NUM "1.5"
 
 
 float __float_reg[64];                                                          // Floats stored in flash
@@ -247,6 +247,7 @@
                 if(state_change){
                     enter_torque_mode();
                     count = 0;
+                    controller.t_ff = 15.0f;
                     }
                 else{
                 /*
@@ -269,12 +270,13 @@
                     } 
                 commutate(&controller, &observer, &gpio, controller.theta_elec);           // Run current loop
                 controller.timeout += 1;
-                /*
+                
                 count++;
-                if(count == 1000){
+                if(count == 40000){
+                     controller.t_ff = -controller.t_ff;
                      count = 0;
                      }
-                     */
+                     
             
                 }     
                 break;