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

Dependencies:   FastPWM3 mbed-dev-f303

Fork of Hobbyking_Cheetah_V1 by Ben Katz

Revision:
40:cd7e837b2b93
Parent:
39:3580a907ef93
Child:
41:304ac2affb23
--- a/main.cpp	Mon May 14 21:01:06 2018 +0000
+++ b/main.cpp	Thu May 24 15:02:32 2018 +0000
@@ -61,8 +61,8 @@
 
  #define P_MIN -12.5f
  #define P_MAX 12.5f
- #define V_MIN -45.0f
- #define V_MAX 45.0f
+ #define V_MIN -650.0f
+ #define V_MAX 650.0f
  #define KP_MIN 0.0f
  #define KP_MAX 500.0f
  #define KD_MIN 0.0f
@@ -259,7 +259,7 @@
                     }
                     */  
 
-                torque_control(&controller);     
+                torque_control(&controller);    
                 if((controller.timeout > CAN_TIMEOUT) && (CAN_TIMEOUT > 0)){
                     controller.i_d_ref = 0;
                     controller.i_q_ref = 0;
@@ -272,7 +272,8 @@
                 
                 /*
                 count++;
-                if(count == 40000){
+                if(count == 4000){
+                     printf("%.4f\n\r", controller.dtheta_mech);
                      count = 0;
                      }
                      */