vedderb / bldc

The VESC motor control firmware
2.22k stars 1.37k forks source link

[MCPWM_FOC] Make rotor lock feature use D axis #393

Closed kubark42 closed 2 years ago

kubark42 commented 2 years ago

Changes rotor lock feature from Q axis to D axis. This has two advantages:

  1. Now the angle you put in is the angle you really get in the alpha beta frame (no 90 degree offset).
  2. Now when the rotor is being locked, the D axis is really the D axis and Q is really the Q axis. This helps for FRF measurements.

HT to @ElwinBoots

Tested extensively by @mxlemming and @ElwinBoots.

Guillaume227 commented 2 years ago

For consistency, should m_iq_set and m_id_set be swapped when locking the rotor in mcpwm_foc_measure_resistance?

kubark42 commented 2 years ago

For consistency, should m_iq_set and m_id_set be swapped when locking the rotor in mcpwm_foc_measure_resistance?

Good catch. @ElwinBoots, what's your take on that? It certainly makes sense to me, and from a user perspective it shouldn't make any tangible difference.

ElwinBoots commented 2 years ago

Yes that would make sense.