Chun Feng Huang / CURRENT_CONTROL

Fork of CURRENT_CONTROL by LDSC_Robotics_TAs

Files at this revision

API Documentation at this revision

Comitter:
benson516
Date:
Wed Dec 21 18:45:23 2016 +0000
Parent:
9:d8157fbfcd2a
Child:
11:31cd02611cd0
Commit message:
Closed-loop control for motor current reached the bandwidth beyond 50Hz

Changed in this revision

CURRENT_CONTROL.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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);