Tony Stark / BLDC_V2_JYB

Dependencies:   mbed-dev-f303 FastPWM3

Files at this revision

API Documentation at this revision

Comitter:
benkatz
Date:
Sat Dec 10 05:31:06 2016 +0000
Parent:
14:80ce59119d93
Child:
16:385dd470fa3f
Commit message:
getting ready to add CAN Bus;

Changed in this revision

CurrentRegulator/CurrentRegulator.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CurrentRegulator/CurrentRegulator.cpp	Mon Oct 31 16:48:16 2016 +0000
+++ b/CurrentRegulator/CurrentRegulator.cpp	Sat Dec 10 05:31:06 2016 +0000
@@ -100,8 +100,8 @@
     //Park(I_Alpha, I_Beta, theta_elec, &I_D, &I_Q);
     
     Park(I_Alpha, I_Beta, theta_elec, &ID_Sample, &IQ_Sample);    
-    I_D = .5f*ID_Sample + .5f*ID_Old;
-    I_Q = .5f*IQ_Sample + .5f*IQ_Old;
+    I_D = 1.0f*ID_Sample + 0.0f*ID_Old;
+    I_Q = 1.0f*IQ_Sample + 0.0f*IQ_Old;
     ID_Old = I_D;
     IQ_Old = I_Q;
     //count += 1;
--- a/main.cpp	Mon Oct 31 16:48:16 2016 +0000
+++ b/main.cpp	Sat Dec 10 05:31:06 2016 +0000
@@ -19,15 +19,15 @@
 Serial pc(PA_2, PA_3);
 
 Inverter inverter(PA_10, PA_9, PA_8, PA_11, 0.02014160156, 0.00005);  //hall motor
-PositionSensorAM5147 spi(16384, 2.7f, 7);   ///1  I really need an eeprom or something to store this....
+PositionSensorAM5147 spi(16384, 1.65f, 21);   ///1  I really need an eeprom or something to store this....
 //PositionSensorSPI spi(2048, 1.34f, 7); ///2
 
 
-PositionSensorEncoder encoder(4096, 0, 7); 
+PositionSensorEncoder encoder(4096, 0, 21); 
 
 
 
-CurrentRegulator foc(&inverter, &spi, &encoder, 0.000033, .005, .5);    
+CurrentRegulator foc(&inverter, &spi, &encoder, 0.000033, .005, .55);    
 TorqueController torqueController(.031f, &foc);
 ImpedanceController impedanceController(&torqueController, &spi, &encoder);
 
@@ -49,9 +49,9 @@
 void Loop(void){
     count++;
     //impedanceController.SetImpedance(cmd_float[1], cmd_float[2], cmd_float[0]);
-    impedanceController.SetImpedance(.1, -0.01, 0);
+    //impedanceController.SetImpedance(.1, -0.01, 0);
     
-    //torqueController.SetTorque(-.03);
+    torqueController.SetTorque(.1);
     //foc.Commutate();
     //voltage_foc();
     if(count>2000){