2.8/2.9 PID seems broken?

More
14 Dec 2019 18:04 #152659 by 3D-Master
Hello,

i have updated from 2.7.14 to 2.8/2.9 but then my servo generated a huge following error. I control it using PWM and DIR signals and have a encoder directly wired to my 7i52s.

these were my PID parameters in 2.7.14 which were not perfect but okay:

P = 7.5
I = 12.5
D = 0.2325
FF0 = 0
FF1 = 0.25
FF2 = 0

i had approx 0.01-0.02mm following error but when i updated to 2.8/2.9 the following error increased to at least a millimeter (maximum following error for feed moves, not rapid)

i can change ff1 to 1 as well as 1000 but nothing changes so i think there is something broken. The automatically changed ini and hal files dont seem to have a mistake.

Is this ini entry correct?
#********************
# Axis Z
#********************
[AXIS_Z]
MIN_LIMIT = -200.0
MAX_LIMIT = 200
MAX_VELOCITY = 166.666667
MAX_ACCELERATION = 1000.0

[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 4.0
MIN_FERROR = 1
MAX_VELOCITY = 166.666667
MAX_ACCELERATION = 1000.0
P = 15
I = 15
D = 0.02
FF0 = 0
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0.0025
MAX_OUTPUT = 0
ENCODER_SCALE = 512
OUTPUT_SCALE = 10
MIN_LIMIT = -200.0
MAX_LIMIT = 200
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 5
HOME_USE_INDEX = YES
HOME_SEQUENCE = 0


if i delete "MAX_VELOCITY = 166.666667" and "MAX_ACCELERATION = 1000.0" from joint then the homing is way slower and the axis can have a following error greater than MIN_FERROR but linuxcnc wont go into estop.
Attachments:

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

More
14 Dec 2019 20:16 #152660 by PCW
Replied by PCW on topic 2.8/2.9 PID seems broken?
2.8+ and 2.9 have a bug fix in the PID component.
Previous versions always calculated the FF1 term from
and internal derivative even if the command derivative pin
was connected. The version in 2.8+ and 2.9 does use the
externally supplied command derivative. For whatever
reason, the joint velocity does not match the old calculated
command derivative (I suspect 1 servo thread time difference)

If you want the old behaviour, disconnect the PIDs command derivative
pins and FF1 will be calculated the same way as 2.6..2.8+
The following user(s) said Thank You: andypugh

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

More
18 Jan 2020 16:49 #155103 by 3D-Master
Replied by 3D-Master on topic 2.8/2.9 PID seems broken?
But why is it, that when i change FF1 nothing happens?

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

More
18 Jan 2020 17:02 #155104 by PCW
Replied by PCW on topic 2.8/2.9 PID seems broken?
Did you comment out any statement like:
net x-vel-cmd => pid.x.command-deriv

Notice if you just dont connect net x-vel-cmd to
encoder velocity but leave the pid.x.command-deriv
connected to a signal (as shown above)
you will have a fixed 0 FF1

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

More
19 Jan 2020 18:25 #155169 by papagno-source
I use 2.9 and have this situation :

loadrt hostmot2
loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
setp hm2_5i20.0.pwmgen.pdm_frequency 6000000

setp hm2_5i20.0.encoder.04.counter-mode 0
setp hm2_5i20.0.encoder.04.filter 1
setp hm2_5i20.0.encoder.04.index-invert 0
setp hm2_5i20.0.encoder.04.index-mask 0
setp hm2_5i20.0.encoder.04.index-mask-invert 0

setp hm2_5i20.0.encoder.04.scale [JOINT_4]INPUT_SCALE
net motor.04.pos-fb hm2_5i20.0.encoder.04.position pid.4.feedback mux2.9.in0
net motor.04.pos-fbout mux2.9.out joint.4.motor-pos-fb
net Bindex-enable hm2_5i20.0.encoder.04.index-enable joint.4.index-enable pid.4.index-enable
net encodervelocityb pid.4.feedback-deriv hm2_5i20.0.encoder.04.velocity


setp hm2_5i20.0.pwmgen.04.output-type 3
setp hm2_5i20.0.pwmgen.04.scale [JOINT_4]OUTPUT_SCALE

net emcmot.04.pos-cmd joint.4.motor-pos-cmd pid.4.command

i add command derive for 2.9 ?
this is correct for 2.9 : net encodervelocityb pid.4.feedback-deriv hm2_5i20.0.encoder.04.velocity ?

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

More
19 Jan 2020 19:33 #155177 by PCW
Replied by PCW on topic 2.8/2.9 PID seems broken?
Yes fb-deriv is OK

dont connect the pid command-deriv pin

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

More
19 Jan 2020 20:57 #155195 by papagno-source
Hi.

When use fb-deriv , not use command-deriv in 2.9 ?
Because ?

But in 2.9 i write : setp pid.x.error-previous-target true or not important ?

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

More
19 Jan 2020 22:21 - 19 Jan 2020 22:23 #155202 by PCW
Replied by PCW on topic 2.8/2.9 PID seems broken?
Some background:

The PID component has a little magic it uses for both feedback and commanded
derivative terms (D*fb-deriv and FF1*cmd-deriv) If these PID component pins are not
connected (not linked to a signal) the PID component calculates these derivatives internally.

You should always use the PIDs fb-deriv pin if you need D term in your PID tuning.
The reason to use it is that the encoders velocity estimation is better than just dfb/dt
which is used by the PID component if the fb-deriv pin is not connected.

The PID component had a long standing bug where it ignored the command-deriv pin.
This was fixed sometime ago in the 2.8 branch, allowing the PIDs command-deriv
pin to be connected to the trajectory planners velocity pin but unfortunately the way
the PID calculates the derivative and the trajectory planners velocity pin are not the
same ( there's a 1 servo cycle delay between them ) Because of this, if you wish to
retain the previous behaviour and tuning, its best to leave the PIDs command-deriv
pin unconnected (not connect to any signal)

You should in general always setp pid.x.error-previous-target true
regardless of version
Last edit: 19 Jan 2020 22:23 by PCW.
The following user(s) said Thank You: Dbsharp

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

More
26 Jan 2020 12:13 - 26 Jan 2020 17:27 #155791 by papagno-source
Hi.
I don't use D part for PID, but only P and FF1 part .
I use servo motor in closed loop on encoder with analog +/- 10volt command on M5i20

In this case for actual 2.9 master i use only Fb-deriv(D part not used ) or only Commnad-deriv(FF1 part) or both.

Thanks for reply
Last edit: 26 Jan 2020 17:27 by papagno-source.

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

More
26 Jan 2020 13:05 #155804 by bbsr_5a
Replied by bbsr_5a on topic 2.8/2.9 PID seems broken?
is there a BASE Setup for a PID driving a Stepper to Comen Drivers M542/Tb6600 Famile Drivers Step DIR

im on the way to get rid of a ATCRACK using axis Comands transfering to PID Carousell at position Commandings
and lost in all this values

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

Time to create page: 0.131 seconds
Powered by Kunena Forum