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


Results 1 to 12 of 12

Thread: PID Servo Tuning with SnapAmp Chicken and Egg Variables

  1. #1
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

    Default PID Servo Tuning with SnapAmp Chicken and Egg Variables

    I have been stumbling through the documentation for the dynomotion products, but have only been able to find disjointed steps to tune DC brushed servos. I have personally lost a lot of time and productivity during this task due to the still evolving documentation for what appears to be very robust hardware.

    Hopefully, this thread will eventually fill in the blanks for a system using the Kflop, SnapAmp, and Kanalog with brushed DC servo motors.

    I found in the wiki pages some of the variables to be set within the kmotion "Step Response Screen" here. However, the starting point appears to be skipped. I could not readily find set points for the PID variables.

    1) What PID variables should be used during the Velocity, Acceleration, and Jerk process?

    2) What is the recommended process of refining the PID's, and at what stage of the tune process should it occur?

    Thank you.

    Similar Threads:


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

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

    Hi MadTooler,

    Sorry you are having so much trouble. But you are right it is a chicken and an egg sort of thing. Servo tuning is complex. There are no fixed set of PID settings. They will all depend on each system. It is an iterative process. Start with some very low gains to have a stable system that is able to make small slow moves. Then increase/adjust gains to make these moves accurately. Then attempt larger faster moves. Increase/adjust gains to make these moves more accurately. Etc...

    It would be helpful if you provided more information. What types of motors/drives do you have? How are they connected? What have you achieved and verified so far?

    Regards

    TK
    http://dynomotion.com


  3. #3
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    Tom,

    Thanks for the reply. BTW, I am that guy that burned up a snapamp last month and had to order the replacement.

    I am trying to merge a few of your sets of instructions that either approach PID first with a set of VAJ's already in place (maybe just sort of known), or the opposite where I do not see mention of the PID values in the beginning and the VAJ values are manipulated.

    My electro/mechanical system is:
    4 Axis Gantry Router

    Power:

    • 70vDC 1500 watt unregulated toroidal power supply
    • 5v/12vDC 70 watt PC style switching power supply
    • 24vDC 150 watt regulated poser supply


    All 4 axis (only working with XYZ for now) with Baldor Brushed DC servo Model# MK-3363-BLBCN
    • Driven by SnapAmp with Diff Encoders also through SnapAmp
    • 180 oz.
    • 4,000 Max RPM
    • Max 120 V
    • Voltage Constant 31.1 V/Krpm
    • 4.76 amps Cont. Current
    • 28.5 amps Current Peak
    • Encoder Line count 1,000 (4,000 quadrature)


    Ball Screws XYZ with .2" pitch

    X,Y,Z limit switches at both ends of travel
    • 24 VDC connected independently to Opto In on Kanalog


    Porter Cable 3.25HP Router
    • IO from SnapAmp driving SSR that then drives Magnetic Contactor


    Auxiliary Air Drill motor
    • IO from SnapAmp driving SSR that then drives Air Solenoid
    • Limit switch to indicate drill cycle has ended and has returned to neutral position
      24 VDC connected to Opto In on Kanalog


    Air/mist coolant
    • IO from SnapAmp driving SSR that then drives Air Solenoid


    Simple Z touch plate (cutter grounds touch plate).
    • 24 VDC connected to Opto In on Kanalog.


    Cabling:

    • Both Motor and Encoder wiring is shielded.
    • Limit switch cables are shielded.

    Tune Settings that should be good:

    • 120,000 Determined max Velocity Value do to mechanical stability


    Old Tune settings from 1993 Centroid controller (these are not stable when used with kflop/snapamp):
    PID Servo Tuning with SnapAmp Chicken and Egg Variables-old_pid-jpg

    I am currently running back through my system grounding in case I have some bad loops and retesting plots since I have a lot of spiking with my encoder position. Here is a plot without any filters applied:
    PID Servo Tuning with SnapAmp Chicken and Egg Variables-y-pngPID Servo Tuning with SnapAmp Chicken and Egg Variables-y_start-pngPID Servo Tuning with SnapAmp Chicken and Egg Variables-y_cresting-png

    Hopefully the data for the plot is attached to this message as well.

    Attached Thumbnails Attached Thumbnails PID Servo Tuning with SnapAmp Chicken and Egg Variables-old_pid-jpg   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y-png   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y_start-png   PID Servo Tuning with SnapAmp Chicken and Egg Variables-y_cresting-png  

    Attached Files Attached Files
    Last edited by MadTooler; 08-04-2016 at 03:37 AM. Reason: typo on V value


  4. #4
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    Is there any reason my PC power supply that I am using for the 5v should have any level of continuity to earth ground (continuity and less than 1 ohm resistance from Earth GND input to DC GND Output)?

    I am running through and double checking for noise, and found my meter is claiming continuity to ground from that supply. I tested a couple of other old PC supplies I have laying around, and they also have continuity from earth ground to the DC ground.

    Is this usable?



  5. #5
    Gold Member Khalid's Avatar
    Join Date
    Apr 2006
    Location
    Pakistan
    Posts
    3426
    Downloads
    0
    Uploads
    0

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

    Why Too much noise in the signals. Check encoder wiring for electromagnetic interference. Assuming you didn't modify/extend the cable of the encoder

    http://free3dscans.blogspot.com/ http://my-woodcarving.blogspot.com/
    http://my-diysolarwind.blogspot.com/


  6. #6
    Registered
    Join Date
    Dec 2012
    Location
    Norway
    Posts
    284
    Downloads
    0
    Uploads
    0

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

    What kind of encoder? Mariss from Gecko had an article about a certain popular brand of encoder giving fits to drives and how to improve the signal. Maybe something similar can be done on your machine?



  7. #7
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    Yep, stinkin' noise in the ground.

    This is a retrofit project of a USA made machine from about 1993. I pretty much have replaced all electrical except the shielded cables to the motors and encoders. I made the mistake of not 100% checking and keeping some of the prior ground connections with the assumption that they must of known something about what they were doing... Hard to tell who was the bigger fool. The guys that tied the encoder shield at the motor end to earth ground and tied the motor power shield to earth at both ends, or me for not checking before I said the new wiring was done.

    In any case, I have eliminated the spiked encoder readings. Things are running a bit smoother, so back to tuning.

    Thanks to Khalid and Stigoe for the suggestions.

    I still am unclear the best method in determining the both PID and VAJ when almost none are known. My max V should be 120,000 (I need to go back and make sure my math was correct), but I am having fun trying to simultaneously determine P, I, D, A, and J. When I simply start with A = 2xV, and J = 10xA, the stops are rough and over correcting. I have to pretty much keep my A=V and J is only about 1.5xA. I have also found the Lead/Lag filter and the Low pass 2nd are helping it not have such rough overshooting stops, but the whole thing is very sluggish and starting to growl. Most of my Bode plots with this setup is either reading 50hz or under for cross over, or keeping below the center of scale.

    I will post some more plots tomorrow.

    Thanks again.



  8. #8
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    I have further removed noise from my system by throwing out the computer style power supply (does connect earth to DC ground), and replacing it with an isolated supply. I am a bit concerned the supply may be a little under rated. It is good for 3amp at 5v. I had a mystery shutdown of Kflop that makes me wonder if I need more juice. Is that enough with Kflop, 1 SnapAmp, Kanalog, 4 encoders, and 8 Solid State Relays (160-320ma)?

    With a lot of work, I have been able to get decent results with short movements and bode plots. I still need to tighten things up and fine tune my C programs. Before I get too carried away, here are some questions.

    I have found the KmotionCNC does a great job of moving my machine for all if I set "Rapids as Feeds" (just need to make my servos a bit more quite). Without, the rapids are based upon my tune which is sluggish and troublesome at stopping after long moves. The big question about servo motor tuning... do all the tuning variables, such as integrator, error, feed forward, acceleration, jerk, iir filters, and some of the others matter if I am going to use the trajectory planner to handle ALL of the moves? If not, what are the needed variables?

    Is the initialization C program for KmotionCNC to be run by the Init button on the gcode control window and be run on thread 1?

    Is it within that same code that any watchdog programs for eStop and adjustsoftlimits should reside?

    I have been trying to get Kmotion 4.34 working on an old XP SP3 machine without luck just yet. Says invalid 32 application. Are the near future releases going to require a newer OS that my time to get this up and current are not worth putting off buying a newer PC?

    Relative to a new control PC, I saw some on GitHub playing with running Kmotion through Linux or web based here. Is there any official support for other platforms, such as Raspberry Pi 3 or better, and linux machines in the near future?

    Thanks again for everyone's support.



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

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

    Hi MadTooler,

    I am a bit concerned the supply may be a little under rated. It is good for 3amp at 5v. I had a mystery shutdown of Kflop that makes me wonder if I need more juice. Is that enough with Kflop, 1 SnapAmp, Kanalog, 4 encoders, and 8 Solid State Relays (160-320ma)?
    I would expect 3A to be enough. Powering the Dynomotion boards should require less than 2Amps. You would need to calculate and sum up all your IO beyond that.

    I have found the KmotionCNC does a great job of moving my machine for all if I set "Rapids as Feeds" (just need to make my servos a bit more quite). Without, the rapids are based upon my tune which is sluggish and troublesome at stopping after long moves. The big question about servo motor tuning... do all the tuning variables, such as integrator, error, feed forward, acceleration, jerk, iir filters, and some of the others matter if I am going to use the trajectory planner to handle ALL of the moves? If not, what are the needed variables?
    It probably doesn't make sense for you to be selecting "Rapids as Feeds". This should only be selected for highly non-linear kinematic systems where straight line rapid paths actually require the motor actuators to perform complex "curved" interpolated motions with varying constraints. It has the disadvantage of performing rapids with infinite Jerk rather than limited Jerk. Which should result in slower and rougher motion not the other way around. It sounds like you don't have your system characterized properly for Jerk Limited Motion and Un-limited Jerk Motion. Please re-read this article:

    Dynomotion

    There are really two different types of parameters: "Servo Tuning Parameters" and "Motion Profile Parameters". The first control how the servo performs to correct errors and follow trajectories accurately. The second are basically used to define the trajectory of motion based on Maximum Jerk, Acceleration, and Velocity. Although there is some disagreement on terminology. For example Mach3 has no servo capability at all and operates completely open loop. It refers to its Motion Profile Parameters as "Motor Tuning".

    KFLOP only has one set of Servo Tuning Parameters that are always active whenever the axis is enabled. But there are multiple modes of motion that can generate different trajectories that may or may not use the Motion Profile Parameters set in KFLOP.

    Is the initialization C program for KmotionCNC to be run by the Init button on the gcode control window and be run on thread 1?
    Normally yes

    Is it within that same code that any watchdog programs for eStop and adjustsoftlimits should reside?
    Normally yes

    I have been trying to get Kmotion 4.34 working on an old XP SP3 machine without luck just yet. Says invalid 32 application. Are the near future releases going to require a newer OS that my time to get this up and current are not worth putting off buying a newer PC?
    There isn't a Version 4.34. Only a Test Version 4.34a. Apparently it is missing some VS2015 Library files which is why it is said to be invalid. We haven't figured out the minimum files needed and how to install them automatically yet. If VS2015 is installed it should run. But that is like a 5GB install and I'm not sure if it is supported on XP. If you have time please try loading the VS2015 re-distributable to see if it resolves the problem:

    https://www.microsoft.com/en-ca/down....aspx?id=48145

    Relative to a new control PC, I saw some on GitHub playing with running Kmotion through Linux or web based here. Is there any official support for other platforms, such as Raspberry Pi 3 or better, and linux machines in the near future?
    This is great work contributed by several KFLOP Users. It should allow the KMotion Libraries to run under Raspberry Pi3. We encourage and support it where possible.

    HTH
    Regards

    TK
    http://dynomotion.com


  10. #10
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    Tom,

    I was able to run a couple of old jobs, but it was sketchy.

    I still had to keep the rapids as feeds, otherwise it varies from sluggish to violently fast leading to instant fault. I know I need better tunings, which is why I started this thread, but at least it is mostly running for the moment with the feed setting. My concentration is more on other functionality while I also try to catch up on backlogged production. I will re-tune as soon as I can shut down for a break again.

    I am still running Kmotion 4.33.

    My biggest and most serious issue at this time is a very problematic feed hold or gcode pause syndrome. Whenever I use the feed hold or pause, either at the time of, or more commonly some fairly random period later, I get either a generic gcode error and abort message or an end of arc error. In either case, I have to abort the program, backup to the nearest start of a subprogram (most of my gcode has the individual toolpaths noted), then start from there without issue. It then does not give an error or find an end of arc error unless I use the feed hold or pause again.

    The end of arc error was earlier very troublesome with any helix, or higher accuracy paths, so I have had to post my helix as lines and reduce my precision. This seems to be related to an old known issue in EMC. Do you have any guidelines or fixes in the works for this? Yes, I realize this is probably way too vague to answer without my machine and system information, just checking for any known good practices or issues.

    One additional hiccup I noticed when starting from mid program, the dialog box comes up and asks about the previous settings, such as feed and spindle, that where found earlier in the program and if I would like to execute them. When I do this, and it asks about starting the spindle, the spindle does not start. Is this something I need to add in, or is it not properly following the settings for the M3 command?

    Regarding the loaded gcode...
    How to unload them?
    I didn't think it would matter, but then I discovered that changes in the loaded code saves immediately to the file. I discovered that when I tried deleting the code from the window to see if it would unload.
    My initial setup intent was to have my control PC networked to my CAD/CAM workstation. I started with loading the gcode over the network. With it autosaving, I realized I may not want to do that, then I was really convinced it was a bad idea when I had a network hiccup and the gcode was aborted. Even though the file was loaded and running, when the wifi blipped, the job was aborted. My procedure now is not affected since I will only run the files local, but thought I would mention the behavior since it seemed surprising and in case it was useful feedback.

    An observations that may be in the documentation somewhere already... when running within Win XP, 100% of all power saving and screen saving must be turned off. I had everything disabled, except to let the monitor power off after 20 minutes. When it turned off, that led to the gcode being aborted. It isn't surprising there was a problem since my experience is no version of windows ever has yet to handle power and standby functions flawlessly. Yes, I am very well aware the system should never be allowed to go into a power saving or standby mode during operation of Kmotion. Maybe Kmotion can force those features to be disabled?

    In spite of the growing pains, I am enjoying the Dynomotion product line and very much appreciate your guidance.



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

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

    Hi MadTooler,

    I wasn't able to duplicate your first two issues. Maybe you could provide all your settings, your GCode, and an exact sequence that shows a problem.

    Regarding "unloading GCode Files": Whenever you make changes to a file the changes are not saved immediately but rather automatically saved as soon as you run the Job or select a different file. We feel always having to push "Save" or displaying a message "Are you sure you would like to save the changes" would be a nuisance. Possible ways to avoid changing a file inadvertently would be to immediately save it to a new name or make your files read only. To "unload" a file you can push the "New" button to create an empty file with a default name.

    Regards

    TK
    http://dynomotion.com


  12. #12
    Registered
    Join Date
    Nov 2006
    Location
    USA
    Posts
    37
    Downloads
    0
    Uploads
    0

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

    Tom,

    I think I may now get a chance to start re-tuning my drive system. After a bit of use, I have been running into issues with cut quality that I can no longer get by with as is. I hope to be diving into this more accurately now and better document my issues.

    For now, I will mention the major issue that is pushing me to resolve my tune is an inconsistent consistency where I find repeatable scalloping in cut path where only one axis is moving, yet at somewhat random points about the full range of motion (yes that is a totally confusing description). While there is plenty of mechanical issues I have to point fingers at here as well, it has become clear this is also some kind of control issue, almost definitely my hacked tunes. I will be taking some pictures and trying to fully document the system configuration and gcode so a correction can be found.

    Best Regards,

    Jason



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