1- The basic control position for servo motor Ac with TI Dsp f28335 is:
Is a model with Id /Iq.
You can read all teory at http://processors.wiki.ti.com/index.php/TMS320C2000_Motor_Control_Primer
It is the original speed control with a fourth pid for position control.
And a second qep2 module to have the real position count.
2- The problem is that motor spins abruptly. Motor damages. Ever have overshoot at end profile. I add a little low pass filter to init more smoothly ( not a fast 0 to 1). Now motor does not damage. (see clear blue line)
3- The same before in matlab figure. All are real time measures. The PID works bad. Impossible to get better adjusting parameters.
4- People use S-curve instead of 0-1 transitions for comanded position control motor.
Now for motor position control I generate 3 profiles on Pc at real time. I send by usb. I inject them on the three pid loops.
5- If I only use the position profile (newpi_iq.Kff = 0 ; newpi_spd.Kff= 0), I have a delay between comanded position and real position ( blue lines)
6- If I use the three profiles (newpi_iq.Kff = 1.8 ; newpi_spd.Kff= 0.58), the delay between commanded and real position is minimal.
7- With short cicles, at a rate of 60 pieces for minute