Bayley Wang
/
foc-ed_in_the_bot_compact
robot
Diff: DQMapper/DQMapper.cpp
- Revision:
- 98:1051c4103900
- Parent:
- 48:a1a09c83d42c
- Child:
- 124:e70ca81676fc
diff -r 785be556c06d -r 1051c4103900 DQMapper/DQMapper.cpp --- a/DQMapper/DQMapper.cpp Sun Apr 09 23:33:10 2017 +0000 +++ b/DQMapper/DQMapper.cpp Tue Apr 11 21:51:52 2017 +0000 @@ -55,4 +55,9 @@ float is = torque_percent * _tmax / _kt; *d = (-_lambda + sqrtf(_lambda * _lambda + 8 * (Ld - Lq) * (Ld - Lq) * is * is)) / (4.f * (Ld - Lq)); *q = sqrtf(is * is - *d * *d); +} + +void AngleMapper::map(float torque_percent, float w, float *d, float *q) { + *q = _is * torque_percent * sinf(_theta); + *d = _is * torque_percent * cosf(_theta); } \ No newline at end of file