PID Tune Problem and Clarification
27 Nov 2017 12:39 - 27 Nov 2017 13:05 #102387
by Bello
PID Tune Problem and Clarification was created by Bello
Hi All,
I need to tune my Machine and my PID.
I understood from what I'm reading on the web , that this is a critical step that is struggently for all.
I read more topic about the PID tune procedure but I cannot obtain a right configuration for my machine.
Starting from this official guide linuxcnc.org/docs/html/motion/pid-theory.html I would understand:
"Increase the P until the output of the loop oscillates." What means this phrase? Which is the oscillation, how can I check it (halscope)?
From this guide also gnipsel.com/linuxcnc/tuning/servo.html I read:
"P - Tune to maximum stiffness without oscillation. "
but I cannot understand what is really required to observe here.
Can you help me please?
In case, can you suggest other guide that can help me please?
Thanks in advance
I need to tune my Machine and my PID.
I understood from what I'm reading on the web , that this is a critical step that is struggently for all.
I read more topic about the PID tune procedure but I cannot obtain a right configuration for my machine.
Starting from this official guide linuxcnc.org/docs/html/motion/pid-theory.html I would understand:
"Increase the P until the output of the loop oscillates." What means this phrase? Which is the oscillation, how can I check it (halscope)?
From this guide also gnipsel.com/linuxcnc/tuning/servo.html I read:
"P - Tune to maximum stiffness without oscillation. "
but I cannot understand what is really required to observe here.
Can you help me please?
In case, can you suggest other guide that can help me please?
Thanks in advance
Last edit: 27 Nov 2017 13:05 by Bello.
Please Log in or Create an account to join the conversation.
28 Nov 2017 13:20 #102430
by jtc
Replied by jtc on topic PID Tune Problem and Clarification
hope that will help you:
www.wiki.eusurplus.com/index.php?title=Category:Tuning
gnipsel.com/linuxcnc/tuning/index.html
João
www.wiki.eusurplus.com/index.php?title=Category:Tuning
gnipsel.com/linuxcnc/tuning/index.html
João
The following user(s) said Thank You: Bello
Please Log in or Create an account to join the conversation.
30 Nov 2017 10:58 - 30 Nov 2017 11:26 #102525
by Bello
Replied by Bello on topic PID Tune Problem and Clarification
Hello,
thank you, I have tuned the PID now. But still there is an issue when the CNC using it.
If the PID (optical line) is enabled the X axis during the program, suddenly is shifting/loosing its position of 0,004 of.
This shift will increment during the program use.
My doubts here:
1) could that depends for the PID configuration that is set in velocity mode? should be configured in position mode?
If yes, can someone help me to do it?
2) Is some misconfiguration on my PID configuration (file FEEDBACK.hal)?
3) Could depends from stepgen missing/wrong configuration?
I'm attaching my config files in order to give you all details.
NOTE: The CNS is working as expected without PID enabled but I think a tune could be required in order to improve the existing stepgen configuration
Please help me.
thank you, I have tuned the PID now. But still there is an issue when the CNC using it.
If the PID (optical line) is enabled the X axis during the program, suddenly is shifting/loosing its position of 0,004 of.
This shift will increment during the program use.
My doubts here:
1) could that depends for the PID configuration that is set in velocity mode? should be configured in position mode?
If yes, can someone help me to do it?
2) Is some misconfiguration on my PID configuration (file FEEDBACK.hal)?
3) Could depends from stepgen missing/wrong configuration?
I'm attaching my config files in order to give you all details.
NOTE: The CNS is working as expected without PID enabled but I think a tune could be required in order to improve the existing stepgen configuration
Please help me.
Last edit: 30 Nov 2017 11:26 by Bello.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
30 Nov 2017 14:54 #102533
by Todd Zuercher
Replied by Todd Zuercher on topic PID Tune Problem and Clarification
I think there are problems in your hal files.
1st I don't believe that comments at the end of a line of hal code are allowed. (this will cause the whole line to be ignored.)
2nd it doesn't look like your encoder feedback is working (it isn't addf-ed into any threads.) and without feed-back the PID won't work.
Why are you adding 6 encoder channels for a 3 axis machine and only using 1 of them?
Both of these functions need added to threads for the software encoder counter to work, encoder.update-counters needs to be addf-ed to the base thread and encoder.capture-position needs to be addf-ed to the servo thread.
1st I don't believe that comments at the end of a line of hal code are allowed. (this will cause the whole line to be ignored.)
2nd it doesn't look like your encoder feedback is working (it isn't addf-ed into any threads.) and without feed-back the PID won't work.
Why are you adding 6 encoder channels for a 3 axis machine and only using 1 of them?
Both of these functions need added to threads for the software encoder counter to work, encoder.update-counters needs to be addf-ed to the base thread and encoder.capture-position needs to be addf-ed to the servo thread.
The following user(s) said Thank You: Bello
Please Log in or Create an account to join the conversation.
30 Nov 2017 15:57 - 30 Nov 2017 15:58 #102539
by Bello
Replied by Bello on topic PID Tune Problem and Clarification
Your questions and observations are right because I haven't upload my FULL configuration.
I have attached the complete configuration now. (I'm removing the comments in a newest on)
I have 4 encoders into panel.hal file, 1 encoder on ANT_MPG.hal file and 1 encoder on FEEDBACK.hal.
I have already added to threads encoder.update-counters and encoder.capture-position (see panel.hal) and I think the PID and feedback are loaded fine because I have tuned it using halscope and calibration.
Can you help me to understand what I have missing because I still have 0.004 of shift (that increasing with the movement) and seems that isn't correct automatically.
Thanks in advance
I have attached the complete configuration now. (I'm removing the comments in a newest on)
I have 4 encoders into panel.hal file, 1 encoder on ANT_MPG.hal file and 1 encoder on FEEDBACK.hal.
I have already added to threads encoder.update-counters and encoder.capture-position (see panel.hal) and I think the PID and feedback are loaded fine because I have tuned it using halscope and calibration.
Can you help me to understand what I have missing because I still have 0.004 of shift (that increasing with the movement) and seems that isn't correct automatically.
Thanks in advance
Last edit: 30 Nov 2017 15:58 by Bello.
Please Log in or Create an account to join the conversation.
01 Dec 2017 10:38 #102557
by Bello
Replied by Bello on topic PID Tune Problem and Clarification
I'm using this optical line :
it.aliexpress.com/item/High-accuracy-mac...s.9042311.0.0.b4PES0
and after done more tests and after read more topics on the web I'm arrived at conclusion that the issue could me in the optical line TTL output and parallel port.
I understood also that I have a backslash on my CNC of 0.004 and that if I use the BACKSLASH into ini without use the optical line is corrected fine.
I have also tried to use the encoder.N.x4-mode TRUE in order to manage the quadrature but no luck, seems result and the shift is not corrected and improve during the direction change.
I hope that the issue is more clear for you also.
Have you any siggestion or experiences on that?
Thanks in advance
it.aliexpress.com/item/High-accuracy-mac...s.9042311.0.0.b4PES0
and after done more tests and after read more topics on the web I'm arrived at conclusion that the issue could me in the optical line TTL output and parallel port.
I understood also that I have a backslash on my CNC of 0.004 and that if I use the BACKSLASH into ini without use the optical line is corrected fine.
I have also tried to use the encoder.N.x4-mode TRUE in order to manage the quadrature but no luck, seems result and the shift is not corrected and improve during the direction change.
I hope that the issue is more clear for you also.
Have you any siggestion or experiences on that?
Thanks in advance
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
01 Dec 2017 14:26 #102566
by Todd Zuercher
Replied by Todd Zuercher on topic PID Tune Problem and Clarification
If you are using a linear encoder (glass scales), I am pretty sure you will need to turn off backlash compensation. Using backlash comp with the linear encoder will cause a following error equal to your backlash setting.
The following user(s) said Thank You: Bello
Please Log in or Create an account to join the conversation.
01 Dec 2017 15:25 - 01 Dec 2017 15:29 #102567
by Bello
Replied by Bello on topic PID Tune Problem and Clarification
I'm already turning off the backslash when I'm enabling the PID because I want to use ONLY the glass scales to fix the shift.
But the scenario, after enabled the PID and turned off the backslash, on the direction change(not each one, but seems is randomic) losts from 0.002 to 0.004 at first and increasing it if I will continue the tests ( i have tested till to miss 0.100).
I saw that the glass scales output is a TTL and I read that with an encoder x4 I should able to not miss any steps but really seems that isn't so.
How can check and tune the glass scales output signals in order to understand if all is ok?
Am I on the right way?
But the scenario, after enabled the PID and turned off the backslash, on the direction change(not each one, but seems is randomic) losts from 0.002 to 0.004 at first and increasing it if I will continue the tests ( i have tested till to miss 0.100).
I saw that the glass scales output is a TTL and I read that with an encoder x4 I should able to not miss any steps but really seems that isn't so.
How can check and tune the glass scales output signals in order to understand if all is ok?
Am I on the right way?
Last edit: 01 Dec 2017 15:29 by Bello.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
-
- Away
- Platinum Member
-
Less
More
- Posts: 4978
- Thank you received: 1377
01 Dec 2017 16:37 #102569
by Todd Zuercher
Replied by Todd Zuercher on topic PID Tune Problem and Clarification
Well, reading encoders with the parallel port is always going to be just a little bit sketchy. But it looks like your resolution is enough lower than your stepgen resolution that it should not be too much of a problem.
The order and location of how functions are added to the threads is important. It would be highly advisable to put all of your loadrt and addf lines of hal code in one place, at the beginning of your 1st hal file.
(not that this is necessarily causing your problem here.)
Other things to look at are electrical noise issues, causing lost or false steps in your encoder signals. Single ended TTL signals can be very susceptible to noise, especially if there are grounding or shielding issues.
Use hal scope to look at the A and B signals from the encoder. Do they look like they might have a noise issue? Does it look like there may be missed steps in the encoder signal? How about missed steps by the step motor?
The order and location of how functions are added to the threads is important. It would be highly advisable to put all of your loadrt and addf lines of hal code in one place, at the beginning of your 1st hal file.
(not that this is necessarily causing your problem here.)
Other things to look at are electrical noise issues, causing lost or false steps in your encoder signals. Single ended TTL signals can be very susceptible to noise, especially if there are grounding or shielding issues.
Use hal scope to look at the A and B signals from the encoder. Do they look like they might have a noise issue? Does it look like there may be missed steps in the encoder signal? How about missed steps by the step motor?
Please Log in or Create an account to join the conversation.
04 Dec 2017 13:28 - 04 Dec 2017 13:29 #102659
by Bello
Replied by Bello on topic PID Tune Problem and Clarification
I'm troubleshooting the issue and I will try to do the improvements that you have suggested.
How can I check if A and B signal have a noise issue?
I see with halscope that the A and B signals arrive fine but only those one that surely arrives...I only observed that someones are missing comparing the manual axis mesurement with the Linuxcnc results.
I think that it look like there may be missed steps in the PID encoder signal because if I exclude it the CNC is working as expected.
How can I check if A and B signal have a noise issue?
I see with halscope that the A and B signals arrive fine but only those one that surely arrives...I only observed that someones are missing comparing the manual axis mesurement with the Linuxcnc results.
I think that it look like there may be missed steps in the PID encoder signal because if I exclude it the CNC is working as expected.
Last edit: 04 Dec 2017 13:29 by Bello.
Please Log in or Create an account to join the conversation.
Time to create page: 0.109 seconds