FOC Implementation for putting multirotor motors in robots

Dependencies:   FastPWM3 mbed

Committer:
benkatz
Date:
Mon Oct 31 16:48:16 2016 +0000
Revision:
14:80ce59119d93
Parent:
8:10ae7bc88d6e
Misc. changes.  Finally fixed transforms (turns out B and C current measurements were accidentally swapped)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
benkatz 4:c023f7b6f462 1
benkatz 8:10ae7bc88d6e 2 //cogging torque and torque ripple compensation can go here later
benkatz 4:c023f7b6f462 3
benkatz 4:c023f7b6f462 4 #include "CurrentRegulator.h"
benkatz 4:c023f7b6f462 5 #include "TorqueController.h"
benkatz 4:c023f7b6f462 6
benkatz 4:c023f7b6f462 7 TorqueController::TorqueController(float Kt, CurrentRegulator *regulator)
benkatz 4:c023f7b6f462 8 {
benkatz 4:c023f7b6f462 9 _CurrentRegulator = regulator;
benkatz 4:c023f7b6f462 10 _Kt = Kt;
benkatz 4:c023f7b6f462 11
benkatz 4:c023f7b6f462 12 }
benkatz 4:c023f7b6f462 13
benkatz 4:c023f7b6f462 14 void TorqueController::SetTorque(float torque)
benkatz 4:c023f7b6f462 15 {
benkatz 4:c023f7b6f462 16 SetCurrent(0, torque/_Kt);
benkatz 4:c023f7b6f462 17 }
benkatz 4:c023f7b6f462 18
benkatz 4:c023f7b6f462 19 void TorqueController::SetCurrent(float Id, float Iq)
benkatz 4:c023f7b6f462 20 {
benkatz 4:c023f7b6f462 21 _CurrentRegulator->UpdateRef(Id, Iq);
benkatz 4:c023f7b6f462 22 _CurrentRegulator->Commutate();
benkatz 4:c023f7b6f462 23
benkatz 4:c023f7b6f462 24 }