Page 1 of 3 123 LastLast
Results 1 to 12 of 32

Thread: Optimizing servo tuning.

  1. #1
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0

    Optimizing servo tuning.

    Hi Tom,
    These are the screen shots and data files for my current setup. Some things you may want to know are the extent I got with increasing the P setting. X is rack and pinion drive and made it to 8 before going unstable. I reduced it to 7. The Y is acme 1/2-10 leadscrew and made it to 35 before being reduced to 17.5. It got very noisey as i went above 17.5. The Z is a 5 thread 5/8" ballscrew and made it to 10 before being reduced to 9. The motors are all noisey for some reason. I cut a part at 50 and 25ipm they were dead on for measurements after adjusting the steps but were no good on the corner radius. they were rough and odd shaped and did'nt show up at all below 1/8" radius. Any help is much appreciated. Thanks.
    Judleroy
    Attached Thumbnails Attached Thumbnails Optimizing servo tuning.-x.png   Optimizing servo tuning.-y.png   Optimizing servo tuning.-z.png  
    Attached Files Attached Files


  2. #2
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    I did not get the shots off the config and filter screens. I will do that tomorrow. I can say that I set all three as brush servo with encoder input and set the snapamp motor output channels. Also set max error to 10000 counts. Nothing else was changed in the configure screen from factory. Also all filters are turned off for all axis as per the manuals instructions. Thanks.
    Judleroy


  3. #3
    Registered TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    454
    Downloads
    0
    Uploads
    0
    Hi Judleroy,

    Yes there is oscillation.

    Here is first some background:

    I believe you are using our SnapAmp driving Brush Servos. In this case the servo output is commanding torque (or acceleration). Sometimes with CNC machines and Analog Servos the servo output can command velocity rather than acceleration. Simple P (proportional) gain when commanding velocity will make a stable system. But simple P gain when commanding acceleration will not.

    P gain works simply to make the commanded output proportional to the error. This means that as we approach the target the output reduces to zero.

    With a velocity command this works well it causes us to reduce speed as we get closer to the target. This results in a nice exponential curve.

    But with an acceleration command the acceleration reduces as we get closer to the target. This means we actually continue to accelerate right until we reach the target. The acceleration is reducing but still positive so speed is still increasing and more importantly not decreasing. This is like in your car taking your foot off the gas as you arrive at a stop sign. This results in overshooting the target badly. This only works at all if you are going slow and have a lot of friction. Like a car slowly dragging a heavy sled behind. If you remove the gas as you approach the stop sign you may well stop without too much overshoot.

    So the first step in CNC servo tuning is to be aware of what type of servo system amplifier you have: Velocity or Acceleration Command (note acceleration, motor current, and torque are all basically the same thing).

    In your case we have acceleration command. The key to stabilizing this type of system is D (derivative) gain. D gain is like adding artificial friction or damping. It applies a deceleration that is proportional to velocity. The P and the D gains then work together to form a nice approach to the desired stopping position.

    So back to your system: The next step is to add in some D gain. As described above increasing D gain is like adding in friction which slows the system down. This is unlike P (and I) gain where increasing gain makes the system respond harder and faster. However this only works upto a point. Increasing D gain too far will also make the system unstable due to small delays and compliances in the mechanics which make the applied "friction" become out of phase with the velocity.

    So add in increasing D gain until the system goes unstable. Then back off a significant amount (2 or 3X reduction).

    Then see if the P gain can now be increased and better performance is obtained without so much oscillation.

    Regards
    TK
    TK
    http://dynomotion.com


  4. #4
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    Thanks Tom. I will try this and then post back to see where to go from there. The examples you give make some things a little clearer.
    Judleroy


  • #5
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    I must confess a little confusion. I have tried increasing d until the system goes unstable. I made it to 500000 with channel 0 and still no instability. The other 2 I did not take that far but appear the same. At 10000 or so when I change the move size to 10000 the machine moves very slow and sluggish.
    Also the Output is set at 200 and so is the error. What will increasing the output do?
    Thank you.
    Judleroy


  • #6
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    One more thing I didn't mention. The motors at idle output a terrible sounding hissing and whining noise. The output voltage is showing nothing on x and y at idle and z is hovering about the bottom of the chart. (I assume because it is holding itself up). If it weren't for the stable voltage the noise would really scare me?
    Judleroy


  • #7
    Registered TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    454
    Downloads
    0
    Uploads
    0
    Judleroy ok great progress! :}

    Well let's see I was hoping to take this one step at a time but maybe that doesn't work well. I think we need to add a low pass filter.

    A little more background: The derivative is trying to calculate speed by observing the changes in encoder position. But KFLOP samples the encoder pretty fast (90us) and the encoder has limited resolution. So what typically happens is KFLOP sees no change in encoder for many times and then it sees a change of one encoder count. So basically it thinks the velocity is zero most of the time and every once in a while it sees a velocity of 1 encoder count change per servo tick. So with a D gain of 100 the result of the derivative feedback is to output 0x100=0 most of the time and sometimes 1x100=100. This is very spikey and SnapAmp and the motor don't handle that well. Furthermore if you crank the D gain up to 1000000 then it tries to output 0 most of the time and 1000000 sometimes, but we have the output max set at 200 so the 1000000 gets clipped down to 200 so really any gain over 200 will make no difference. BTW you should be able to see all this if you look at the plots and zoom in. Each "step" in the encoder (red) will cause the output (green) to spike up to 200 and be clipped.

    So try adding in a Low pass filter. Use the 3rd filter and specify a 2nd order Low pass filter with a frequency of 500 Hz and a Q of 1.4. Don't forget to push the "Compute" button which will comput the 5 Z domain coeficients which are what the DSP actually uses to implement the Low Pass filter. This will smooth the spikes into a more continuous current so the Amplifier and the Motor can make more use of the command. You should be able to see a difference in the plots. Please post some plots if you have time.

    BTW you asked about the Max limits. Here is a copy of a post from the Yahoo Group:

    Max Output - limits the max output of the servo which in the case of a SnapAmp will limit the max current applied to the motor. This should be set as low as possible to achieve the acceleration that you really need.

    Max Integrator - limits the amount the integrator to "wind up". Without any limit if something abnormal happens like if you force the servo off target with your hand and hold it off for a long time the integrator will continue to ramp up to a Huge value so then if you release it there will be a large overshoot most likely slamming the axis into the limit (this assumes you don't have a Max Following Error set to fault the axis). Max Integrator helps prevents this. Normally it should be set to a fraction of the Max Output.

    Max Error - Normally servo following errors are small. But in abnormal situations they might be big such as when trying to accelerate too fast. Max Error can limit the amount of error that the servo "sees" so as not to react too violently to a huge error. This should normally be set to slightly bigger that the amount of errors that you would expect under normal conditions.
    TK
    http://dynomotion.com


  • #8
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    I implemented the low pass and that quieted things down a lot but still a bit of noise. The filter made me have to decrease my p gain. I increased d but still cannot get it to go unstable. I stopped at 200 but at that the noise was loud again. I decreased to 100 and at that could almost double p. I will post plots tonite but if there's a next step I can move on to before then that will be great. I will save the plots where they are now but can't post till I get home. I believe this is moving in the right direction and I'm starting to understand what's going on with each setting. Thanks for everything.
    Judleroy


  • #9
    Registered TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    454
    Downloads
    0
    Uploads
    0
    Hi Judleroy,

    It's hard to tell the next step without seeing the plots.

    We have the Max output set very low (if it is still at 200). Max Current of 8191 corresponds to 35Amps. So 200 is only 0.85A. But I wouldn't normally start increasing the peak current until things are stable. Looking at the plots you can check if the current is being limited.

    Later I gain will improve accuracy. Start with a small number like 0.0001.

    Thanks for your patience.

    Regards
    TK
    http://dynomotion.com


  • #10
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    These are the new screenshots and data files. I have just waited and worked on other things untill you can look them over. I will wait to see what you think before adjusting anything. I have cut some more. The radius are much better but far from good. When I cut text which has alot of arcs I have a issue with the way code is run. It pauses whenever it comes to alot of arcs all together and runs the code then a little later cuts the path. Like its thinking it through before it can make the cut. Can this be taken care of? Also My x moves .032 inches when it reverses direction before it actually starts moving. (backlash). I am not sure what it is asking for in the backlash comp section? Thanks always.
    judleroy
    Attached Thumbnails Attached Thumbnails Optimizing servo tuning.-x.png   Optimizing servo tuning.-y.png   Optimizing servo tuning.-z.png  
    Attached Files Attached Files


  • #11
    Registered TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    454
    Downloads
    0
    Uploads
    0
    Hi Judleroy,

    I don't understand, there doesn't seem to be any D gain or Low Pass filter added?

    Regards
    TK
    http://dynomotion.com


  • #12
    Registered judleroy's Avatar
    Join Date
    Dec 2006
    Location
    USA
    Posts
    406
    Downloads
    0
    Uploads
    0
    Sorry I used files from the wrong folder. I will repost in just a few minutes. Sorry. Judleroy


  • Page 1 of 3 123 LastLast

    Similar Threads

    1. Servo tuning
      By ho-229 in forum General Laser Engraving & Cutting Machine Discussion
      Replies: 2
      Last Post: 11-11-2011, 10:06 AM
    2. Servo Tuning HELP!!
      By Julian M in forum Servo Motors and Drives
      Replies: 1
      Last Post: 07-17-2010, 08:06 PM
    3. Servo Tuning
      By gbowne1 in forum Fanuc
      Replies: 0
      Last Post: 11-06-2009, 11:31 PM
    4. Problem- 6t Servo tuning?
      By Jerry Shorter in forum Fanuc
      Replies: 5
      Last Post: 08-17-2009, 06:28 PM
    5. appropriate servo tuning.... help?
      By howling60 in forum Servo Motors and Drives
      Replies: 6
      Last Post: 02-27-2006, 09:48 AM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.