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@8:10ae7bc88d6e, 2016-04-13 (annotated)
- Committer:
- benkatz
- Date:
- Wed Apr 13 04:09:56 2016 +0000
- Revision:
- 8:10ae7bc88d6e
- Parent:
- 4:c023f7b6f462
Multi-turn mechanical position, MA700 position sensing over SPI. Placeholder torque controller for cogging/ripple compensation;
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 | } |