Bayley Wang
/
foc-ed_in_the_bot_compact
robot
Diff: main.cpp
- Revision:
- 37:ba7ebf4f8a78
- Parent:
- 36:cac9785c91cb
- Child:
- 38:07cb4ae6c1bd
diff -r cac9785c91cb -r ba7ebf4f8a78 main.cpp --- a/main.cpp Sun Nov 27 09:10:09 2016 +0000 +++ b/main.cpp Sun Nov 27 11:36:54 2016 +0000 @@ -91,26 +91,13 @@ } //fill in d, q ref based on torque cmd and current velocity -void get_dq(float torque, float w, float *d, float *q) { - /* - *d = 0.0f; - *q = torque / KT; - if (*q > IPHASE_MOTOR_LIMIT) *q = IPHASE_MOTOR_LIMIT; - if (*q > IPHASE_INVERTER_LIMIT) *q = IPHASE_INVERTER_LIMIT; - */ - - /* +void get_dq(float torque, float w, float *d, float *q) { torque = fabsf(torque); get_mtpa_dq(torque, d, q); if (torque < 0.0f) { *d = -*d; *q = -*q; } - */ - - float is = torque / KT; - *d = (-FLUX_LINKAGE + sqrtf(FLUX_LINKAGE * FLUX_LINKAGE + 8 * (Ld - Lq) * (Ld - Lq) * is * is)) / (4.f * (Ld - Lq)); - *q = sqrtf(is * is - *d * *d); } void commutate() {