It's been mentioned many times, most recently by Jon Elson, that it
would be nice if pid could take a better velocity estimate than the one
it gets by performing a two-point numeric differentiation of the error
term.
I got around to implementing this and testing it very lightly on
servo-sim. It looks promising!
servo-sim uses the software encoder counter, which has a high-quality
velocity estimate encoder.#.velocity. This estimate can be hooked to
the modified pid component as follows:
halcmd: net Xvel-fb encoder.0.velocity pid.0.feedback-deriv
I interactively modified the gains from the ones in the servo-sim:
Component Pins:
Owner Type Dir Value Name
18 float I/O 12 pid.0.Dgain
18 float I/O 0 pid.0.FF0
18 float I/O 1 pid.0.FF1
18 float I/O 0 pid.0.FF2
18 float I/O 0 pid.0.Igain
18 float I/O 100 pid.0.Pgain
and ran the following exercise program with FO set to 120%:
G0 X0 Y0 Z0
O100 repeat [100]
G1 X.1 F6
G1 X0
O100 endrepeat
M2
Without the new feedback-deriv pin hooked up, following is terrible and
feedback derivative estimate is all over the place:
http://emergent.unpy.net/files/sandbox/pid-trad.png
(green/cyan trace: cmd, fb; purple trace: feedback-deriv estimated from
feedback position; tan trace: pid error)
With the new feedback-deriv pin hooked up to the velocity estimate,
following is much better thanks to the high-quality velocity estimate
http://emergent.unpy.net/files/sandbox/pid-bettervel.png
(green/cyan trace: cmd, fb; purple trace: feedback-deriv from encoder
based on timestamps; tan trace: pid error; scales all the same as before)
Note that with encoder.0.scale=6000, a 1-count error is 166u, so the
following went from "all over the map" to "+-2 counts".
Both screenshots use the same pid tuning parameters. Only the source of
the feedback derivative (velocity) differs.
The patch is here:
http://emergent.unpy.net/files/sandbox/0001-pid-accept-external-command-deriv-feedback-deriv.patch
Jeff
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers