Arm Mbed OS support forum

Using PID functions from arm_math.h

I have a questions about using PID regulator functions from arm_math.h library.
In that lib there are 3 different types of handling PID regulator:

  • arm_pid_f32(),
  • arm_pid_q31(),
  • arm_pid_q15().

My questions are:

  1. In which case to use which regulator?
  2. My case is: I need to use PID regulator to control current generated from PWM signal by regulate Duty Cycle of that PWM. Which of those 3 PID types is the best for that implementation?

the algorithm is the same for all pid controllers, the cmsis has variants for different data types.
The algorithm itself is not complicated and you’ll find also some Mbed components or other libraries for this. A CM4 with FPU will calculate the formula pretty fast, so I guess using it with any C/C++ code will work as well.