I have closed the loop, need a little help with PID tuning
- slowpoke
- Offline
- Elite Member
Less
More
- Posts: 166
- Thank you received: 25
24 Mar 2024 16:05 - 24 Mar 2024 23:55 #296626
by slowpoke
I have closed the loop, need a little help with PID tuning was created by slowpoke
Focus is on X axis, if I can get that sorted should be easy to implement the other joints.
System:
Ditron linear scales feeding both a Ditron DRO and encoder 0 on Mesa 7i95t.
ac servo that has integrated encoder feeding back to ac servo driver hardware, So I could also tune the ac servos PID parameters, however when operating in LinuxCNC open loop mode the ac servo settings are behaving rather well. Fast, no hunting basically perfect except ballscrew error of about 0.005" that is easily measured between external DRO displayed value vs. value in Axis.
Update on backlash: I created two near identical versions (one open loop with backlash compensation) and the other closed loop. The open loop with compensation is actually quite accurate. With backlash compensation enabled in the the closed loop version it actually makes things much worse and introduces an error of the backlash value on each move, so interesting but not helping.
Using tommylights as well as Hakan's zx45 hal and ini examples I now have my system operating closed loop.
With high vales of P(1000) my system hunts excessively, as I decrease P; 400,200,100,50,25,10, 5 the hunting goes from pretty wild to barely perceivable with error oscillating very slowly (a few tenths over 2 seconds). Sometimes it undershoots an other times it overshoots and then corrects.
I have no experience tuning PID loops other than using the self tuning feature for the ac servos which seemed to work however I learned little during the process.
I have attached my .ini and hal files
Advice please.
System:
Ditron linear scales feeding both a Ditron DRO and encoder 0 on Mesa 7i95t.
ac servo that has integrated encoder feeding back to ac servo driver hardware, So I could also tune the ac servos PID parameters, however when operating in LinuxCNC open loop mode the ac servo settings are behaving rather well. Fast, no hunting basically perfect except ballscrew error of about 0.005" that is easily measured between external DRO displayed value vs. value in Axis.
Update on backlash: I created two near identical versions (one open loop with backlash compensation) and the other closed loop. The open loop with compensation is actually quite accurate. With backlash compensation enabled in the the closed loop version it actually makes things much worse and introduces an error of the backlash value on each move, so interesting but not helping.
Using tommylights as well as Hakan's zx45 hal and ini examples I now have my system operating closed loop.
With high vales of P(1000) my system hunts excessively, as I decrease P; 400,200,100,50,25,10, 5 the hunting goes from pretty wild to barely perceivable with error oscillating very slowly (a few tenths over 2 seconds). Sometimes it undershoots an other times it overshoots and then corrects.
I have no experience tuning PID loops other than using the self tuning feature for the ac servos which seemed to work however I learned little during the process.
I have attached my .ini and hal files
Advice please.
Attachments:
Last edit: 24 Mar 2024 23:55 by slowpoke.
Please Log in or Create an account to join the conversation.
- chris@cnc
- Offline
- Platinum Member
Less
More
- Posts: 529
- Thank you received: 139
24 Mar 2024 18:45 #296636
by chris@cnc
Replied by chris@cnc on topic I have closed the loop, need a little help with PID tuning
You must decide what PID is the master.
In open loop is P1000 normal value in linuxcnc ini. In closed loop you should start with P1 and go slowly higher.
Quick and dirty guide -> If your axis starts to oscillating, decrease P 10%. You could also try to add a deadband value.
Next step cut a circle and if round good job.
Other idea is to decrease the PID in Servodrive and increase P in linuxcnc. High end tune is to look in halshow how close command and feedback position together.
But this need much time, much coffee and little luck.
In open loop is P1000 normal value in linuxcnc ini. In closed loop you should start with P1 and go slowly higher.
Quick and dirty guide -> If your axis starts to oscillating, decrease P 10%. You could also try to add a deadband value.
Next step cut a circle and if round good job.
Other idea is to decrease the PID in Servodrive and increase P in linuxcnc. High end tune is to look in halshow how close command and feedback position together.
But this need much time, much coffee and little luck.
Please Log in or Create an account to join the conversation.
- cakeslob
- Offline
- Platinum Member
Less
More
- Posts: 797
- Thank you received: 231
24 Mar 2024 20:01 #296643
by cakeslob
Replied by cakeslob on topic I have closed the loop, need a little help with PID tuning
if its using linear scales, do you even need backlash comp?
Please Log in or Create an account to join the conversation.
- slowpoke
- Offline
- Elite Member
Less
More
- Posts: 166
- Thank you received: 25
24 Mar 2024 20:41 - 24 Mar 2024 20:42 #296644
by slowpoke
Answer appears to be NO, backlash compensation in closed loop makes things worse.
Focus is now on PID tuning, any PID tuning advice is welcome.
Replied by slowpoke on topic I have closed the loop, need a little help with PID tuning
if its using linear scales, do you even need backlash comp?
Answer appears to be NO, backlash compensation in closed loop makes things worse.
Focus is now on PID tuning, any PID tuning advice is welcome.
Last edit: 24 Mar 2024 20:42 by slowpoke.
Please Log in or Create an account to join the conversation.
- PCW
- Offline
- Moderator
Less
More
- Posts: 17912
- Thank you received: 4797
24 Mar 2024 20:53 #296645
by PCW
Replied by PCW on topic I have closed the loop, need a little help with PID tuning
Backlash compensation makes no sense with linear scale feedback
(since the scales don't have any backlash and represent the actual position very closely)
With linear scale feedback, you can correct for various ballscrew
errors, including scale, periodic and expansion, BUT you cannot easily fix
backlash, This is best eliminated mechanically.
(since the scales don't have any backlash and represent the actual position very closely)
With linear scale feedback, you can correct for various ballscrew
errors, including scale, periodic and expansion, BUT you cannot easily fix
backlash, This is best eliminated mechanically.
Please Log in or Create an account to join the conversation.
- slowpoke
- Offline
- Elite Member
Less
More
- Posts: 166
- Thank you received: 25
24 Mar 2024 21:40 #296652
by slowpoke
I sort of figured that out with my backlash compensated open-loop vs, closed-loop test (results above).
I do have some angular contact bearings that I might install to reduce, however for the moment I'm going to try and see if I can find PID parameters that will work, at the moment I need to turn P way down to stop hunting.
Any and all PID tuning advice is welcome.
If all else fails, I'm going to go back to the ac servo tuning software but I much prefer to try and solve this with Linux PID control.
Replied by slowpoke on topic I have closed the loop, need a little help with PID tuning
Thanks,Backlash compensation makes no sense with linear scale feedback
(since the scales don't have any backlash and represent the actual position very closely)
With linear scale feedback, you can correct for various ballscrew
errors, including scale, periodic and expansion, BUT you cannot easily fix
backlash, This is best eliminated mechanically.
I sort of figured that out with my backlash compensated open-loop vs, closed-loop test (results above).
I do have some angular contact bearings that I might install to reduce, however for the moment I'm going to try and see if I can find PID parameters that will work, at the moment I need to turn P way down to stop hunting.
Any and all PID tuning advice is welcome.
If all else fails, I'm going to go back to the ac servo tuning software but I much prefer to try and solve this with Linux PID control.
Please Log in or Create an account to join the conversation.
- tommylight
- Offline
- Moderator
Less
More
- Posts: 19434
- Thank you received: 6508
25 Mar 2024 00:54 #296664
by tommylight
Replied by tommylight on topic I have closed the loop, need a little help with PID tuning
FF1 is still 1 in the ini file, chances are that will not be correct for almost any machine with normal output scaling, so have a play with some values, start from 0.1 increments, watch the f-error on the scope if it gets bigger or smaller after a change, if lower, try smaller increments, example 0.3 makes the least f-error so try 2.5 and 3.5, again example 2.5 has lower f-error and we know 0.3 is better than 0.2 then it must be between those values, so try 2.6, 2.7 etc.
The following user(s) said Thank You: slowpoke
Please Log in or Create an account to join the conversation.
Time to create page: 0.090 seconds