Bayley Wang
/
foc-ed_in_the_bot_compact
robot
CurrentModel/CurrentModel.cpp@252:38644631ed97, 2018-11-13 (annotated)
- Committer:
- bwang
- Date:
- Tue Nov 13 17:46:23 2018 +0000
- Revision:
- 252:38644631ed97
- Parent:
- 220:ff69c230aa6d
11/13/2018 12:45 - hitting <return> on empty line prints "\r>", so that hitting enter after intially connecting to the controller generates a prompt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 220:ff69c230aa6d | 1 | #include "CurrentModel.h" |
bwang | 220:ff69c230aa6d | 2 | |
bwang | 220:ff69c230aa6d | 3 | CurrentModel::CurrentModel(float Lr, float Rr, float fsw) { |
bwang | 220:ff69c230aa6d | 4 | _tauinv = Rr / Lr; |
bwang | 220:ff69c230aa6d | 5 | _tsw = 1.0f / fsw; |
bwang | 220:ff69c230aa6d | 6 | |
bwang | 220:ff69c230aa6d | 7 | _im = 0.0f; |
bwang | 220:ff69c230aa6d | 8 | _theta = 0.0f; |
bwang | 220:ff69c230aa6d | 9 | } |
bwang | 220:ff69c230aa6d | 10 | |
bwang | 220:ff69c230aa6d | 11 | float CurrentModel::getFluxPosition(float id, float iq, float w) { |
bwang | 220:ff69c230aa6d | 12 | _im = _im + _tsw * _tauinv * (id - _im); |
bwang | 220:ff69c230aa6d | 13 | float wf = w + _tauinv * iq / _im; |
bwang | 220:ff69c230aa6d | 14 | _theta = _theta + _tsw * wf; |
bwang | 220:ff69c230aa6d | 15 | return _theta; |
bwang | 220:ff69c230aa6d | 16 | } |