It took a lot of work, but everything is great now.
First, tuning was complicated because everything is "different". The knee has to move over 1,000 lbs of metal, using a high friction mechanism, and a "springy" transmission.
Finally, I realized that I need to greatly increase P and I terms and that took the following error way down -- it is always well under
0.001".I also reduced max acceleration big time, as I realized that I was stressing the machine comlpetely unnecessarily.
The next issue was that in steady state, when not really moving it, the servo motor was heating up from residual current. This is because the PID loop in EMC2 was obsessively trying to move the motor that "last hair", against friction, not really strongly enough to actually move it.
I am sure that, if not fixed, it would fry the little motor one day. It was completely unnecessary, since the ACME screw is self locking.
Andy Pugh on EMC-Users list suggested a "timeout" component that would, after 10 seconds of inactivity, turn off the current to the knee servo motor. After 1.5 more hours of chasing a weird FPU comparison issue, the component is now working. So, the motor turns off completely after 10 seconds of inactivity.
To sum it:
1) The knee moves at a perfectly acceptable speed (1cm per second or so) 2) It moves smoothly, with low acceleration (which reduces stresses on everything) 3) The following error is always under 0.001 4) After 10 seconds following completion of a move, the motor turns off and uses zero current.There is a couple of things still to be done.
a) Install limit and home switches for the knee b) Investigate a mechanical issue with the setup, whereby the gearmotor is somehow not perfectly coaxial and wobbles aruond its axis of rotation. It is as if the crank handle shaft is bent slightly or something.
i