bldc icon indicating copy to clipboard operation
bldc copied to clipboard

PID speed control uses filtered speed

Open Zob314 opened this issue 2 years ago • 1 comments

The comment here makes it sound like m_speed_est_fast should be used for speed control https://github.com/vedderb/bldc/blob/e3d7e8624cc45f8dcc677d53b76fb18e4b2768f7/motor/mcpwm_foc.c#L3256 But in the PID speed control uses the slower and more filtered m_pll_speed. https://github.com/vedderb/bldc/blob/e3d7e8624cc45f8dcc677d53b76fb18e4b2768f7/motor/foc_math.c#L464 I switched this out for m_speed_est_fast and was able to achieve much better PID speed control performance. The setup I had used a magnetic encoder, so it likely has a much cleaner speed input than hall or sensorless setups, but I would think that filtering / de-tuning should be done in the PID tuning and not the input to the PID algorithm.

Zob314 avatar Jun 30 '23 20:06 Zob314

Good observation. I have added an option to choose the speed source in https://github.com/vedderb/bldc/commit/9eb978ef15cfffffc135710d3a5d63de1502fbd1 Should be in the next beta.

vedderb avatar Jul 01 '23 12:07 vedderb