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.
TorqueController/TorqueController.cpp@19:bd10a04eedc2, 2017-02-14 (annotated)
- Committer:
- benkatz
- Date:
- Tue Feb 14 03:28:16 2017 +0000
- Revision:
- 19:bd10a04eedc2
- Parent:
- 8:10ae7bc88d6e
commit b4 fork; reorganizing coming
Who changed what in which revision?
| User | Revision | Line number | New 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 | } |