Motor current controller

Fork of CURRENT_CONTROL by LDSC_Robotics_TAs

Revision:
10:9f5f4a22346c
Parent:
9:d8157fbfcd2a
Child:
11:31cd02611cd0
--- a/CURRENT_CONTROL.cpp	Wed Dec 21 17:39:56 2016 +0000
+++ b/CURRENT_CONTROL.cpp	Wed Dec 21 18:45:23 2016 +0000
@@ -205,8 +205,9 @@
 }
 //////////////////////////////// end Speed_IterateOnce
 
+
 // Control
-////////////////////////////////
+///////////////////////////////////////////////////////////
 void CURRENT_CONTROL::Control(float curRef)
 {
     // Init check
@@ -226,7 +227,8 @@
     pid.Compute_noWindUP(curRef, curFeedBack_filter);
     
     // Voltage output with back-emf compensation
-    voltage_out = -pid.output + func_back_emf(angularSpeed); 
+    voltage_out = pid.output + func_back_emf(angularSpeed); 
+    // voltage_out = 0.0 + func_back_emf(angularSpeed); 
     
     // Output saturation and unit changing
     SetVoltage(voltage_out);
@@ -241,7 +243,9 @@
     // Reset flag
     Flag_SpeedCal_Iterated = false;
 }
-//////////////////////////////// end Control
+/////////////////////////////////////////////////////////// end Control
+
+
 // Back emf as the function of rotational speed
 float CURRENT_CONTROL::func_back_emf(const float &W_in){
     return (Ke*W_in);