FOC Implementation for putting multirotor motors in robots

Dependencies:   FastPWM3 mbed

Committer:
benkatz
Date:
Sat Mar 12 08:04:51 2016 +0000
Revision:
4:c023f7b6f462
Child:
8:10ae7bc88d6e
serial debugging;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
benkatz 4:c023f7b6f462 1
benkatz 4:c023f7b6f462 2 //cogging torque and torque ripple compensation will 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 }