if pid needed or not with 5i25&7i76

More
18 Jul 2016 14:37 #77597 by dbskccc
i install linuxcnc 2.7.5 with mesa 5i25&7i76 first time, now use pncconf to generate the ini&hal file for a lathe, there is pid within it,
=============================================================
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_pci config=" num_encoders=1 num_pwmgens=0 num_stepgens=5 sserial_port_0=00xxxx"
setp hm2_5i25.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.z,pid.s

addf hm2_5i25.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf hm2_5i25.0.write servo-thread

# external output signals


# external input signals


#*******************
# AXIS X
#*******************

setp pid.x.Pgain [AXIS_0]P
setp pid.x.Igain [AXIS_0]I
setp pid.x.Dgain [AXIS_0]D
setp pid.x.bias [AXIS_0]BIAS
setp pid.x.FF0 [AXIS_0]FF0
setp pid.x.FF1 [AXIS_0]FF1
setp pid.x.FF2 [AXIS_0]FF2
setp pid.x.deadband [AXIS_0]DEADBAND
setp pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp pid.x.error-previous-target true
setp pid.x.maxerror .0005

net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-vel-cmd => pid.x.command-deriv
net x-pos-fb => pid.x.feedback
net x-output => pid.x.output

# Step Gen signals/setup

setp hm2_5i25.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
setp hm2_5i25.0.stepgen.00.dirhold [AXIS_0]DIRHOLD
setp hm2_5i25.0.stepgen.00.steplen [AXIS_0]STEPLEN
setp hm2_5i25.0.stepgen.00.stepspace [AXIS_0]STEPSPACE
setp hm2_5i25.0.stepgen.00.position-scale [AXIS_0]STEP_SCALE
setp hm2_5i25.0.stepgen.00.step_type 0
setp hm2_5i25.0.stepgen.00.control-type 1
setp hm2_5i25.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL
setp hm2_5i25.0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAXVEL

# ---closedloop stepper signals---

net x-pos-cmd <= axis.0.motor-pos-cmd
net x-vel-cmd <= axis.0.joint-vel-cmd
net x-output <= hm2_5i25.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_5i25.0.stepgen.00.position-fb
net x-pos-fb => axis.0.motor-pos-fb
net x-enable <= axis.0.amp-enable-out
net x-enable => hm2_5i25.0.stepgen.00.enable

# ---setup home / limit switch signals---

net x-home-sw => axis.0.home-sw-in
net x-neg-limit => axis.0.neg-lim-sw-in
net x-pos-limit => axis.0.pos-lim-sw-in
=============================================================

now i wonder whether pid is actually needed? my driver is step/dir servo with 10000ppr
Attachments:

Please Log in or Create an account to join the conversation.

More
18 Jul 2016 15:37 #77598 by PCW
PID is used with velocity control instead of the built in driver position mode for a couple of reasons:
1. The PID feedback is more robust with respect to host servo thread jitter and has smaller following errors (better performance)
2. The structure is the same for open and closed loop ( Closed loop just substitutes encoder feedback for stepgen feedback)

Note the step/dir system _always_ uses feedback, its just more hidden and less adjustable in the position mode

Please Log in or Create an account to join the conversation.

More
18 Jul 2016 23:59 #77621 by dbskccc
thanks, so the answer is pid is _always_ needed for performance,
i am confused that the encoder of X/Z axis is only feedback to the driver, not send to linuxcnc, in such case, How the PID function properly.

Please Log in or Create an account to join the conversation.

More
19 Jul 2016 14:34 - 19 Jul 2016 14:40 #77650 by PCW
If the drive provides simulated encoder outputs, you can close the loop with encoder feedback

When the PID is used with the stepgen only (no external feedback) the PID loop insures that the hardware
step generator always generates the proper number of pulses at the proper times despite delays caused by direction
changes, timebase differences between the CPU clock and the step generator clock, and delays between reading
the position and writing the velocity
Last edit: 19 Jul 2016 14:40 by PCW.
The following user(s) said Thank You: dbskccc

Please Log in or Create an account to join the conversation.

Time to create page: 0.102 seconds
Powered by Kunena Forum