This is quite a common question. It's difficult to answer, because it something you must learn to do. When you see an experienced user changing the feedback parameters while they scan, it can seem like magic - but there IS a method.

Most AFMs use a PI controller. This is a kind of simplified PID controller. To control the feedback circuits, you change the P and I values. P stands for proportional and I for Integral. However, commonly in the AFM software they are referred to simply as P and I. To understand what these really mean, look at the wikipedia page on PID controllers. In some instruments, D (derivative) may also be avialable.

For both P and I values, increasing the value increases the amount of the input signal (from the photodetector) which is fed back into the output signal (the z piezo). SO, the higher the values, the faster the AFM will react to changes in topogprahy in the sample. Thus, the higher you can have them, the better. The problem is that if they become TOO high, feedback oscillations will result (see figure 4.6 of my book, which shows the effect of having the PID values too high and too low). So, the trick is to set them as high as possible while avoiding oscillations in the image. Typically, I is increased first, followed by P.  The setpoint is related to how well the feedback behaves as well. In fact, PID values, setpoint scan size and scanning speed all affect the correct sample tracking by the AFM, and are interelated with each other.