Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
TorqueController/TorqueController.cpp
- Committer:
- benkatz
- Date:
- 2016-03-12
- Revision:
- 4:c023f7b6f462
- Child:
- 8:10ae7bc88d6e
File content as of revision 4:c023f7b6f462:
//cogging torque and torque ripple compensation will go here later
#include "CurrentRegulator.h"
#include "TorqueController.h"
TorqueController::TorqueController(float Kt, CurrentRegulator *regulator)
{
_CurrentRegulator = regulator;
_Kt = Kt;
}
void TorqueController::SetTorque(float torque)
{
SetCurrent(0, torque/_Kt);
}
void TorqueController::SetCurrent(float Id, float Iq)
{
_CurrentRegulator->UpdateRef(Id, Iq);
_CurrentRegulator->Commutate();
}