You probably want to use a PID (Proportional Integral Derivative) control algorithm with feedback coming from potentiometers on the arm. PID control has been discussed on this forum before, but I could not find the thread. Here is a link to some lecture notes on it from an engineering class here at Notre Dame, the important stuff begins on page 8 or 9:
Feedback control notes
If anyone knows the link to the previous thread discussing PID control could you please post it.
Hope this is of some help.
Eric