As always reference the LinuxCNC manuals and the LinuxCNC Wiki for more information.
Prepare to Tune
Get encoders working, scaled right and in the right directions
Get drive enables controlled by linuxcnc
Set per axis following error limits wide enough to allow tuning (say 1 inch or 20 mm)
Verify feedback direction (expect runaways) you may have to change the sign of the analog outputs
Tuning a Velocity Mode Drive
The following is assuming the drive itself is tuned. The axis should not drift when enabled and no position is commanded. If not set the Zero pot if there is one on the drive.
Setting up HalScope
You need a halscope plot of ferror, pid output, commanded and real velocity triggering on commanded velocity. See the HalScope Tutorial for more info.
P - Tune to maximum stiffness without oscillation.
FF1 - Tune to eliminate cruse error (about 0.03% of P).
FF2 - Tune to eliminate start and stop over/under shoots (about 0.005% of P).
Adjust P until the axis oscillates after a jog then back off till stable. Then do a long high speed cruise and adjust FF1 for minimum error during the cruise part using HAL Scope to observe the following error.
In the following image you can see the axis.1.f-error the following error after tuning P to maximum stiffness without any oscillation.
FF1 factors out the velocity error so the PID tuning is centered around the commanded velocity.
FF1 nulls the error during cruise.
FF1 copies the commanded velocity to the PID component with scaling.
It helps to have P low so the effect of FF1 is magnified. The low P is only for setting FF1 not for final tuning.
In the following image you can see the following error has been centered during the cruse phase. There is still some over/under shoot at the start and end of move. FF1 was about 0.03% of P. I did find that if I changed the P, I had to recenter the FF1.
I used FF2 to null out the start and stop over/under shoot. FF2 was about 0.005% of P
In my case no I or D was used only P, FF1, and FF2.
If "I" is compensating for FF1 it will overshoot at the end (and under shoot at the beginning)
"I" should help but usually only when you are quite close (it typically makes things worse with overshoots if the basic tuning is not close enough)