Need Help! PID Servo Tuning with SnapAmp Chicken and Egg Variables - Page 2


Page 2 of 2 FirstFirst 12
Results 13 to 23 of 23

Thread: PID Servo Tuning with SnapAmp Chicken and Egg Variables

  1. #13
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    44
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Resurrecting this thread to update my status and trying to fix my biggest problem.

    To update, I have retuned, mostly, and found my simple math needed work in determining my max velocity and accel. It was way oversized and now corrected KmotionCNC is able to rapid properly without rapids as feeds.

    While retuning, I have noticed a new noise issue causing significant spikes in the encoder position noted in the plots, but not always and not consistent beyond most of them most of the time occurring at the end of the move test cycle. Where distinguishable, the spikes range from 40-120 encoder steps (my encoders are all 1k with quadrature for a total of 4k per rev). These are new and did not appear at all after I had gone through the grounding issues noted prior. However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2

    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs. The images are of 4 discs cut with a patterned gcode along the X axis with my prior tuning. With my new tunes, I found similar results while repeating in the same spot.PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223438049-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223441133-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223443533-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223447250-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223449250-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223453427-jpgPID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223457499-jpg
    I tried to keep the HDPE discs in the same x/y orientation to each other to note how the deep scalloping (some as significant as 0.025") start and stop inconsistently regarding the portion of the gcode and z elevation. When it does scallop, as you can see, it does it with a very consistent repeating pattern. The gcode should be attached here as well.

    I do need to go back over the IIR filtering and rerun the bode plot after having adjusted my V,A,J, and PID (not using any D with the IIR seeming to do a better job so far). Any hope that my filters could be culprit here?

    Thanks for any replies.

    Attached Thumbnails Attached Thumbnails PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223438049-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223441133-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223443533-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223447250-jpg  

    PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223449250-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223453427-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-img_20190823_223457499-jpg  
    Attached Files Attached Files


  2. #14
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3157
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi Jason,

    However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2
    Yes switching 80V at 30KHz causes much noise. I suspect (hopefully) the 2~3V spikes on 5V are not real. Maybe just being picked up by your scope leads.


    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs.
    Because the errors occur at random positions I would expect the problem to be tuning and not GCode or Trajectory planning issues. Probably one or more axes marginally stable and breaking into oscillation. If you post some Step Response Plots we might be able to help. Please include your initialization C Program and Trajectory Planner settings as well. It is also possible to capture data while running GCode and cutting using the program CaptureXYZMotionToFile.c. But usually Tuning problems can be resolved just by using the Step Response Screen.

    Regards
    TK http://dynomotion.com


  3. #15
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    44
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Tom,

    Regarding the spikes, they were reading 2.5v from numerous points, although, I stayed away from probing the boards in case I slipped and hit the wrong area. I tried probing from a 4" lead of solid copper from a 5v terminal block, and the results at first were the same. After running tuning for a little while, I checked again and the spikes were down to 1v. The tuning was just a coincidence. I was able to change the position of the probe and found the spikes were actually down at 1v or maybe less. Still a lot, but not necessarily as bad as it first appeared.

    I removed all IIR filtering and the axes were unstable during move tests in step response. I am completely starting from scratch on the tunes, again, to see if I can get this right.

    I will update the files and plots after I get some level of success.

    A few questions as I get the retune:

    I have looked and could not find the application notes. With a dc brushed servo system using the snapamp, is there a use for the "step" testing in the step response? If so, what follow error and plot form is ideal?

    My servos are much stronger and have much more overhead speed available than I am able to make use of with my gantry router due to whip in the ballscrews at higher RPM. They also have 1k cpr differential encoders providing 4k cpr in quadrature. With my 0.2" lead on my ballscrews and 1:1 servo to screw belting, I have 20,000 counts per inch. It is a gantry router with some less than ideal mechanical issues, but I do expect to be able to achieve fair accuracy. While making steps of 50,000 to achieve full speed of 80,000v (= 240ipm), how much of a following error in the "move" tests should I be considering as good?

    I have read a lot of your notes regarding various IIR options vs. feed forward vs. D settings and would like a bit of direction. I know there are a lot of variances between systems to drive the solution, but do you have a default order of which to use first and/or which to ideally use as a final tune configuration?

    For the Bode plot, what magnitude and frequency should I measure?

    Notes regarding large encoder spike noise...

    The very large random encoder noise has only been seen on ch1 and ch2 but not ch0. All three axes use differential encoders through snapamp.

    I saw another thread where someone was having similar snapamp noise and you had suggested connecting motor power cable shields tied to protective earth. Mine are tied to the DC motor supply - at my contactor, not at the snapamp. I tried connecting directly to protective ground, just my grounded enclosure, and the noise went crazy. Maybe it would be cleaner if I connected it to PE far away from the machine, but I doubt it because of the very noisy power at my facility. I think you may have also mentioned caps or resistors across some of the encoder lines and connecting them to a clean snapamp dc-. I am already directly connected to the header on the snapamp. Not sure about adding the other parts right now.

    The kflop home and limit digital io's are flashing under the digital io panel in kmotion. I need to double check if those are being used by snapamp for communication, otherwise I think they are unused and floating. Is that any kind of indicator?

    Thanks again.

    Last edited by MadTooler; 08-27-2019 at 05:23 PM.


  4. #16
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3157
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    I have looked and could not find the application notes. With a dc brushed servo system using the snapamp, is there a use for the "step" testing in the step response? If so, what follow error and plot form is ideal?
    I don't recommend using the "Step" button on the Step Response Screen. If an instant step is applied of any significant size it will likely result in a violent response saturating the output and not being useful. Large errors should not occur in normal operation where proper trajectories are followed. Better to use the "Move" button.


    but I do expect to be able to achieve fair accuracy.
    How accurate and under what conditions?


    While making steps of 50,000 to achieve full speed of 80,000v (= 240ipm), how much of a following error in the "move" tests should I be considering as good?
    I assume you mean "Moves" not "Steps" as a step of 50,000 would instantly generate an error of 50,000 counts.

    Every system is different but with routers maybe 0.01 inch at cutting speeds and 0.1 inch during rapids might be ok for you. Mechanical errors are likely to greater than 0.01 inches. During rapids you probably don't care what the errors are as long as it is keeping up with the trajectory.


    I have read a lot of your notes regarding various IIR options vs. feed forward vs. D settings and would like a bit of direction. I know there are a lot of variances between systems to drive the solution, but do you have a default order of which to use first and/or which to ideally use as a final tune configuration?
    D gain is somewhat simpler so I'd suggest that first. If it gives adequate results then keep it.


    I saw another thread where someone was having similar snapamp noise and you had suggested connecting motor power cable shields tied to protective earth. Mine are tied to the DC motor supply - at my contactor, not at the snapamp. I tried connecting directly to protective ground, just my grounded enclosure, and the noise went crazy. Maybe it would be cleaner if I connected it to PE far away from the machine
    Grounding is complicated. Its hard to say. Motor power is noisy so I think the idea might be to dump it away from other things.


    The kflop home and limit digital io's are flashing under the digital io panel in kmotion. I need to double check if those are being used by snapamp for communication, otherwise I think they are unused and floating. Is that any kind of indicator?
    Not sure what IO you are referring to but if they are floating then toggling could be expected.

    Regards
    TK http://dynomotion.com


  5. #17
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    44
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Quote Originally Posted by TomKerekes View Post
    Hi MadTooler,

    I don't recommend using the "Step" button on the Step Response Screen. If an instant step is applied of any significant size it will likely result in a violent response saturating the output and not being useful. Large errors should not occur in normal operation where proper trajectories are followed. Better to use the "Move" button.


    How accurate and under what conditions?


    I assume you mean "Moves" not "Steps" as a step of 50,000 would instantly generate an error of 50,000 counts.

    Every system is different but with routers maybe 0.01 inch at cutting speeds and 0.1 inch during rapids might be ok for you. Mechanical errors are likely to greater than 0.01 inches. During rapids you probably don't care what the errors are as long as it is keeping up with the trajectory.
    Yes, moves, I was referring to the size of the move as a step, sorry. I have been using "move" but unclear when "step" should be used vs "move" (I could not determine that from documentation or what the plot should look like ideally)?

    My expected tolerance of a gantry router would be +/- 0.003" for position repeatable for a sloppy system. I would think 0.01 at cut would be extreme, although, with the types of diy routers a lot of users tinker with, that is probably a dream to be that accurate. All that aside, I can fairly easily keep the follow error under 20 encoder units (0.001") with a move of 50,000 and infinite jerk, but was hoping to be under 6. I am just not sure if I am expecting too much or too little of the system.


    After trying to compare my red line output on my bode plot to those in the manual with confusion, I realized the current software changed colors of the lines. I felt a bit stupid for not noticing that for 10 minutes, but it was a relief that my output wasn't as bad as I thought.
    For the Bode plot, what magnitude and frequency should I measure?






  6. #18
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3157
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi MadTooler,

    My expected tolerance of a gantry router would be +/- 0.003" for position repeatable for a sloppy system. I would think 0.01 at cut would be extreme, although, with the types of diy routers a lot of users tinker with, that is probably a dream to be that accurate. All that aside, I can fairly easily keep the follow error under 20 encoder units (0.001") with a move of 50,000 and infinite jerk, but was hoping to be under 6. I am just not sure if I am expecting too much or too little of the system.
    Seems pretty accurate for a large router. You might put a dial indicator clamped to the table and measuring to the spindle. Then apply like 1 lb of force to the Spindle and measure how much it deflects. I'd be surprised if you don't get a few thousands of an inch deflection.



    For the Bode plot, what magnitude and frequency should I measure?
    Any low frequency (ie 1Hz) can be used as the idea is to lower energy of the high frequencies. Then increase amplitude until you get significant movement. You might read this.

    Regards
    TK http://dynomotion.com


  7. #19
    Member
    Join Date
    May 2012
    Location
    canada
    Posts
    417
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Quote Originally Posted by MadTooler View Post
    Resurrecting this thread to update my status and trying to fix my biggest problem.

    To update, I have retuned, mostly, and found my simple math needed work in determining my max velocity and accel. It was way oversized and now corrected KmotionCNC is able to rapid properly without rapids as feeds.

    While retuning, I have noticed a new noise issue causing significant spikes in the encoder position noted in the plots, but not always and not consistent beyond most of them most of the time occurring at the end of the move test cycle. Where distinguishable, the spikes range from 40-120 encoder steps (my encoders are all 1k with quadrature for a total of 4k per rev). These are new and did not appear at all after I had gone through the grounding issues noted prior. However, I do now find there is very significant noise being generated by the snapamp at it's 30khz switching. When my servo power is off and the drives disabled, the multiple isolated power supplies are all quite and smooth on the scope. As soon as the power is on and the drive active, huge spikes every 30us. On the 5v for Kflop, the spikes are around 2.5v (I need to recheck since I forgot if it was 2 or 3v spike). The wave form is similar to what was noted in the older thread: Newbie SnapAmp encoder connections (single-ended) - Page 2

    Even with the noise, I am able to run gcode. The results are not always good. Although, the results are the same as from before the new noise issue. The major cut issue is scalloping randomly yet very consistent. Randomly as in I can run the same gcode in the same spot with different results of where the scalloping occurs. The images are of 4 discs cut with a patterned gcode along the X axis with my prior tuning. With my new tunes, I found similar results while repeating in the same spot.
    I tried to keep the HDPE discs in the same x/y orientation to each other to note how the deep scalloping (some as significant as 0.025") start and stop inconsistently regarding the portion of the gcode and z elevation. When it does scallop, as you can see, it does it with a very consistent repeating pattern. The gcode should be attached here as well.

    I do need to go back over the IIR filtering and rerun the bode plot after having adjusted my V,A,J, and PID (not using any D with the IIR seeming to do a better job so far). Any hope that my filters could be culprit here?

    Thanks for any replies.
    The vibration inside the bottom of the pocket in the second picture might suggest you may have some vibrations in the machine as well. Is this a DIY machine? Any pictures of it? Could there be some part of the machine flexing/vibrating that could maybe throw poorly tuned servos into oscillation? I still think tuning is most your problem, just saying may not hurt to check everything else.

    Try adding a pole zero filter at 45 and 180 degrees and no D gain. I dont know the theory behind it, but my machine came with these settings and they work great. I added a 4th axis and tried traditional tuning methods without getting wonderful results so tried the same pole zero filter and it worked great first try, way better results then i could get any other way. I mentioned this to another user in the same situation and it worked great for him as well.

    I sort of see this type pattern on my machine on a much smaller scale. If you really look closely at shiny aluminum parts, you can kinda see a pattern like this on some interpolated moves. Always wondered if it was from tuning, vibration from my spindle, or my Y axis thrust bearing that should probably be replaced.



  8. #20
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    44
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    I retuned from scratch and have somewhat better results. I am near the +/- 6 encoder units follow error in the step response move testing at my max velocity and infinite jerk.

    Bode plots are maybe ok, not sure. Average 75hz and 35 deg results, but that is unknown if accurately applied. I can achieve over 45 degrees with some input values and down to mid 20's with others. I definitely need some guidance on the bode plotting to use it effectively. After re-reading the dynomotion documents, I am still left with ambiguously useful values for amplitude and frequency. Being able to run with stable results from "any frequency" is a bit infinite for me. Other than using as large of an amplitude as I can to achieve measurable results, I am not sure what is applicable. As far as frequency, what range is determined relevant?

    I ran a few parts and the machine did some better than before, but not good enough. About half the cut looked very awesome, then chattered in the rest but not as bad as before. The good news is the oscillation has become more predictable and other performances of the machine have improved. Now, when jogging with an analog joystick, I can see a resonating shutter at some speeds fairly constant. That appears mostly on my X, with a little on the Y. It also appears different in the + vs - directions. While this does more clearly appear a tune issue, it seems to be triggered by machine stiction and other resonance. My plan is to use the step response move test with various velocities and a travel that will go longer than 3.5 seconds, but will allow more capture of the trouble frequencies/speeds. From there I hope to be able to try other tune and filters to find a more effective solution. That seems like it might take some time with a modest chance of finding a one size fits all solutions.

    mmurray70,

    The vibration inside the bottom of the pocket in the second picture might suggest you may have some vibrations in the machine as well. Is this a DIY machine? Any pictures of it? Could there be some part of the machine flexing/vibrating that could maybe throw poorly tuned servos into oscillation? I still think tuning is most your problem, just saying may not hurt to check everything else.
    The noticeable chatter in the bottom of the pocket is mostly oscillation in the tune that very likely is barely stable then triggered by mechanics. The cutter used has a super fine and sharp point which also does not bottom well and showcases cut oscillation (that's why I used it). The machine is a 4'x4' gantry router that is not DIY, but the yahoos that made it back in the mid 90's flip flopped a lot on what they did well vs stupid bad. I can't post a picture of it right now with too many items around it that I can't exactly publicly post. The linear rails are round with plain bearings/bushings. I just replaced the bearings with some igus drylins that are much tighter toleranced and smoother, but the nature of this system and the wacked mount orientations used will keep a higher than desired amount of stiction and slop no matter what I do. There also were significant bloopers with the ballscrews that I have improved significantly, but cannot totally correct without full carriage rebuild. All that said, it can and has performed better than it was when I started this thread, so I know if I keep trying I can eventually get things running better via tuning.

    Try adding a pole zero filter at 45 and 180 degrees and no D gain. I dont know the theory behind it, but my machine came with these settings and they work great. I added a 4th axis and tried traditional tuning methods without getting wonderful results so tried the same pole zero filter and it worked great first try, way better results then i could get any other way. I mentioned this to another user in the same situation and it worked great for him as well.
    I had a pole zero and 0 D gain with my prior tunes. I currently am using a pole zero in my filter 0 and a low pass in the last filter. They really did help smooth out my output along with make the bode plots happier. I am positive I can further refine those to make it better. I also have a larger P, I, and D gain than I have ever run before. While it is performing better, I bet some of those values are unnecessarily correcting each other to keep things from over saturating.

    I know I need to post some plots and files so you all can review what I am doing wrong. I need to rush into some backlogged work first. I think I also need to better understand appropriate bode plotting and test a few slower velocities and make some tweaks to be able post relevant info.

    Thanks again for all the help.



  9. #21
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3157
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi Jason,

    Bode plots are maybe ok, not sure. Average 75hz and 35 deg results, but that is unknown if accurately applied. I can achieve over 45 degrees with some input values and down to mid 20's with others. I definitely need some guidance on the bode plotting to use it effectively. After re-reading the dynomotion documents, I am still left with ambiguously useful values for amplitude and frequency. Being able to run with stable results from "any frequency" is a bit infinite for me. Other than using as large of an amplitude as I can to achieve measurable results, I am not sure what is applicable. As far as frequency, what range is determined relevant?
    75hz and 35 deg sounds good. But unfortunately Bode plots only tell the truth if the system is linear. Linear means that if you inject signal A into the system and get some output and inject signal B into the system and get some output, then if A and B are injected at the same time then the output will be the sum of the independent outputs. Or if A is injected and Y is the output then if 2A is injected you will get 2Y. Unfortunately for most systems this is only roughly true for certain signals. A common non-linear effect is friction, A might cause no response and 2A might cause a response. If the system were linear the Bode plot would be the same regardless of the type or level of stimulus. So the Bode plot should only be used to get some insights into the system and not an absolute guarantee of stability. If there is any frequency and amplitude where the system has a gain of -1 it will likely find that frequency and amplitude and oscillate at that frequency and amplitude.

    I ran a few parts and the machine did some better than before, but not good enough. About half the cut looked very awesome, then chattered in the rest but not as bad as before. The good news is the oscillation has become more predictable and other performances of the machine have improved. Now, when jogging with an analog joystick, I can see a resonating shutter at some speeds fairly constant. That appears mostly on my X, with a little on the Y. It also appears different in the + vs - directions. While this does more clearly appear a tune issue, it seems to be triggered by machine stiction and other resonance. My plan is to use the step response move test with various velocities and a travel that will go longer than 3.5 seconds, but will allow more capture of the trouble frequencies/speeds. From there I hope to be able to try other tune and filters to find a more effective solution. That seems like it might take some time with a modest chance of finding a one size fits all solutions.
    You might use the CaptureXYZMotionToFile.c to see exactly what is going on while cutting. You might modify it to trigger on larger following errors. You also might set the following error to a very small value to see if the system ever faults.

    Testing various speeds and positions also sounds like a good idea.

    Maybe tuning for high stability rather than accuracy might be something to try,

    Regards
    TK http://dynomotion.com


  10. #22
    Member
    Join Date
    Nov 2006
    Location
    USA
    Posts
    44
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Thanks, Tom. I will give it all a try as soon as I can.

    I have tried a range of frequencies with the Bode but not sure if I am wasting my time. So I know, what range of frequencies may be applicable with the Bode?



  11. #23
    Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    3157
    Downloads
    0
    Uploads
    0

    Default Re: PID Servo Tuning with SnapAmp Chicken and Egg Variables

    Hi Jason,

    I have tried a range of frequencies with the Bode but not sure if I am wasting my time. So I know, what range of frequencies may be applicable with the Bode?
    It isn't that critical. The Stimulus is white noise that is passed through a low pass filter. White noise basically contains all frequencies and will have a lot of energy at very high frequencies (ie 1KHz) beyond the bandwidth of the servo that aren't of interest to us. The low pass filter will increasingly attenuate stimulus energy as frequency increases beyond the low pass filter frequency. This can make the lower frequency portion of the Bode plot more consistent. So pretty much any very low frequency (ie 1 Hz) can be used to obtain the desired energy distribution. But realize the lower the frequency there will be more attenuation so to get the same result the amplitude will need to be increased.

    Regards
    TK http://dynomotion.com


Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

PID Servo Tuning with SnapAmp Chicken and Egg Variables

PID Servo Tuning with SnapAmp Chicken and Egg Variables

PID Servo Tuning with SnapAmp Chicken and Egg Variables