As always reference the LinuxCNC manuals and the LinuxCNC Wiki for more information.

Prepare to Tune

  1. Get encoders working, scaled right and in the right directions

  2. Get drive enables controlled by linuxcnc

  3. Set per axis following error limits wide enough to allow tuning (say 1 inch or 20 mm)

  4. 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.

Tuning Order

  1. P - Tune to maximum stiffness without oscillation.

  2. FF1 - Should be 10/Velocity@10V (velocity in machine units per second).

  3. FF2 - Tune to eliminate start and stop over/under shoots (about 0.005% of P).

You can get a pretty good guess at the speed at 10V by finding the machines rapid speed and multiplying by about 1.2.

Adjust P until the axis oscillates after a jog then back off till stable.

In the following image you can see the axis.1.f-error the following error after tuning P to maximum stiffness without any oscillation.


If your hand tweaking FF1 helps to have P low so the effect of FF1 is magnified. The low P is only for setting FF1 by hand 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)