for an arm I'd avoid PID control. Usually you can get away with just P control and
you will avoid oscillatory problems that like to creep up with PI control.
The way P control works is very simple.
Take the actual postition of the arm (call it y) (from the pot) and subtract it from
the desired position of the arm. (call it r) (from your joystick/whatever).
This is your error signal value. e = r - y
Assuming your pots are calibrated so zero on the arm is in the appropriate location...
(if not add/subtract a fudge factor to y or r as needed)...
Multiple that error value by a constant... (called P
probably between 1 and 2) which is
determined experimentally...
and output that value + 127 to the motor.
output = 127 + ( P * e )
note that depending on directions of movement, e may be negative
and as such P may need to be negative if you are going the wrong direction.
Should work like a charm.
Matt Leese and I had a P controller working with 340's arm last sunday.
(Although I wanted a PD cause i thought it would be faster and more damped)
Man was it cool to push on the arm and watch it go back to where it was before.
