PID issues or calibration help

More
03 Jan 2019 01:30 #123381 by hatch789
OK Guys here you go. I took a video showing a low P of 2 and zero'd everything else out. Both my X and Y axis behave the same way so I'm showing the Y in this video for you.

I increase my FF1 from .0001 all the way up to 5 or something like that in increments of 10x.

I'm really wondering if something else isn't going on here.

photos.app.goo.gl/oqbGoHKv87WvgT6G6

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 02:17 - 03 Jan 2019 02:23 #123384 by gmouer
What sort of feed rate are you commanding and what is your acceleration set to in your ini file?

Whatever your commanded feedrate is, is that the value that is showing on the screen while the axis is moving? They should agree. If not, there may be a problem in the velocity loop rather than the positioning loop that your are working on. To put it another way, if you command a move of several inches at say 20 inches per minute, does the display screen show "Vel 20" ?? It should.

Reasonable values of FF1 would be in the range of 1 to 4 as a rough idea.

The halscope display changes are not what would be expected for reasonable values of FF1. Your problem does not appear to be related to tuning of the position loop, I think its elsewhere, possibly the velocity loop which is between the motor and its drive.

Have you verified and/or tuned the velocity loop as PCW suggest in a previous post? That has to be right or tuning the position loop with halscope is hopeless.
Last edit: 03 Jan 2019 02:23 by gmouer.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 03:33 #123387 by hatch789
Hi Gmouer, Thank you for the reply. OK where to start!

First I did try the tuning that PCW first recommended, but it never said it was velocity tuning, it merely said tuning a velocity mode drive. So if you look back and see I was trying to ask the question of the group if I have velocity mode drives. So I was getting the impression that I do and therefore I was trying to do the tuning that PCW recommended.

Now to that Servo Tuning Tutorial from John T., he never says this is to tune your velocity loop, do this first then tune your positioning loop. He just speaks of tuning in general so it's great that you guys are finally saying do things in this order. That is not clear in either Tommy's tutorial or John's tutorial. -Maybe we can make that more clear with some edits.

So in John's velocity tuning tutorial, it gives me an equation for FF1 10/Velocity in units per second. My machine moves 98 inches per minute (yes I just verified this) giving me a value, if my math is right, of about 6.135 for my FF1. But am I setting FF1 right now to 6.135 then trying to find my max P? Or as in the other tutorial am I to set FF1 to a very low value at first to find max P?

Also am I to use a short jog as in Tommy's tutorial or a long jog? Furthermore am I to use a high velocity jog (long or short?) or a low velocity job as in Tommy's tutorial. -You see John's tutorial might seem great to everyone who does this stuff a lot, but to me just learning; it's leaving out some important details.

If you guys help me fill in these questions I just asked I think I can get it! :) Then I suggest we fix John's tutorial up a bit for others. I'll be happy to then go through Tommy's tutorial with the same eye to detail and help call out areas where we can be more clear with instructions.

So the big questions on John's velocity loop tuning tutorial are:
- do I set P to max stiffness with
-A: FF1 set to 6.135 or
-B: FF1 set to .001
-And do I do a rapid long jog or a rapid short jog?
-Or do I do a slow long jog or a slow short jog?

Also, what the F is hand tweaking FF1? Does that mean using my hand controls on the machine instead of the servos? -And then again he speaks of that darn low P here which led me to trying the super low 2 in my P value for that video. -Hopefully this helps to clear up why I am so confused.

Thank you guys for taking the time to care enough to help me!

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 19:05 #123420 by hatch789
I fear I have scared everyone off with my more detailed questions on John's Tuning guide. :( If you have the answers I need please consider helping me out with your knowledge.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 19:33 #123423 by tommylight
I do not know how to put this nicely, but i will try:
Follow the tutorial i linked to from the beginning, especially the part about wiring the drives to Mesa boards, your wiring is not set up properly and you are risking of making a lot of damage to the machine and/or yourself. That is not negotiable.
Another thing to consider before tuning and in case the machine uses DC servo motors, open the motors and check the brushes and clean the dust collected on the copper parts ( motor collector ), do the same thing for the tacho brushes. Any of the above issues will make the tuning impossible.
On retrofits, if the servo drives work when enabled, meaning they do drift slowly, do not touch the drives, ever ! Tuning properly a velocity loop is not easy.
All the tuning in Linuxcnc regarding PID and other things, that is tuning the position loop.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 21:22 #123430 by Todd Zuercher

Hi Gmouer, Thank you for the reply. OK where to start!

First I did try the tuning that PCW first recommended, but it never said it was velocity tuning, it merely said tuning a velocity mode drive. So if you look back and see I was trying to ask the question of the group if I have velocity mode drives. So I was getting the impression that I do and therefore I was trying to do the tuning that PCW recommended.

Now to that Servo Tuning Tutorial from John T., he never says this is to tune your velocity loop, do this first then tune your positioning loop. He just speaks of tuning in general so it's great that you guys are finally saying do things in this order. That is not clear in either Tommy's tutorial or John's tutorial. -Maybe we can make that more clear with some edits.

So in John's velocity tuning tutorial, it gives me an equation for FF1 10/Velocity in units per second. My machine moves 98 inches per minute (yes I just verified this) giving me a value, if my math is right, of about 6.135 for my FF1. But am I setting FF1 right now to 6.135 then trying to find my max P? Or as in the other tutorial am I to set FF1 to a very low value at first to find max P?

Also am I to use a short jog as in Tommy's tutorial or a long jog? Furthermore am I to use a high velocity jog (long or short?) or a low velocity job as in Tommy's tutorial. -You see John's tutorial might seem great to everyone who does this stuff a lot, but to me just learning; it's leaving out some important details.

If you guys help me fill in these questions I just asked I think I can get it! :) Then I suggest we fix John's tutorial up a bit for others. I'll be happy to then go through Tommy's tutorial with the same eye to detail and help call out areas where we can be more clear with instructions.

So the big questions on John's velocity loop tuning tutorial are:
- do I set P to max stiffness with
-A: FF1 set to 6.135 or
-B: FF1 set to .001
-And do I do a rapid long jog or a rapid short jog?
-Or do I do a slow long jog or a slow short jog?

Also, what the F is hand tweaking FF1? Does that mean using my hand controls on the machine instead of the servos? -And then again he speaks of that darn low P here which led me to trying the super low 2 in my P value for that video. -Hopefully this helps to clear up why I am so confused.

Thank you guys for taking the time to care enough to help me!


All of the tutorials you've mentioned are referring to tuning the position loop in linuxcnc when using velocity mode drives.

When tuning, to start out, I would send a comand to move the motors at about half the max velocity, with a move long enough to have a steady flat cruse at that velocity so that you can easily see the servo settling at a steady constant speed.
(for the machines I've worked with about 1/2" is often a good distance. But what the best increment may be will depend on the velocity of the command and your acceleration setting. You also need to be certain that your acceleration rates are set to something that is actually achievable for your system.

I will often rough tune the P first, finding the highest value that doesn't osculate, both during the move and at rest.
Then for tuning the FF1, Set the P to about half of the above, and then set FF1 to the value that minimizes following error during the steady constant velocity part of the move (the flat top.)
Then use FF2 to minimize the following error during the acceleration parts of the move.
Finally go back and fine tune the P to the largest value that doesn't oscillate during the move and at rest.

None of this will work if you don't have the max acceleration (or max velocity) set correctly. The PID loop needs to have enough headroom to correct itself during acceleration. Watching the output of the PID loop when tuning, to make sure it never saturates is a good idea.

Your calculated FF1 isn't right. If your machine moves 98ipm (= 1.63333 inches/sec) when 10v is applied. The FF1 should be .163333. (but I'm not certain that will be right) What I am certain of is that you should probably have the max velocity in Linuxcnc set to about 1.3333ips (80ipm).

When John talks about hand tweeking FF1 he is talking about fine tuning the final value according to the real measurements in hal scope and not relying on a calculated value.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 22:29 #123434 by hatch789
Hello Tommy you probably don't know me or where I started with this project but I was getting a lot of help from cncbasher, Andy and PCW back in 2011 when I first acquired my machine. You can watch the early videos I made where I was doing all of my analysis on the machine and taking everything apart to find the problems you speak of. www.youtube.com/user/hatch789y is my YouTube channel and go to my earliest videos ...you'll see what I mean.

My machine has hard stops and switches that will literally disconnect the servo drives if it goes to any of the limit switches, so the only thing unsafe is that I don't have the E-stop switch in LinuxCNC wired up properly ...Yes I know that but no one has ever really given me a good example of how to hook it in: Series, parallel, at the hand button or at the relay in the machine. These are things that I would only be guessing at. I tried a number of things with cncbasher long ago to wire in parallel to the end stop relays but we found that they were holding the relay loops closed because of some grounding issue in my mesa card and me not understanding exactly how to avoid the shared ground issue. So that WAS dangerous because it would keep the relay active even if a limit switch was depressed. I was forced to disconnect those until a later time when someone is kind enough to help me with advice on properly wiring those up to my system. At that time I'll be happy to do it.

It's dangerous if I don't understand my limitations or if I am new to this sort of work. I am not new to this stuff and I am quite careful so thank you for being kind and offering your assistance and caution. I would love to get everything wired up properly but let's first figure out if I even have a viable machine before going into all of that.

I've been using my machine for years for small jobs and even manual CNC maneuvers, cutting larger circles, and some odd stuff. It was working fine (or so I thought) until I really wanted to dig in and understand precision CNC work on my old machine. That's when I realized it was not OK for fine detail. It's the reason I'm reaching out for help. cncbasher is gone and he was great for helping me but often just said do this or that and I didn't understand why. I am trying to learn and understand everything now so that I can be self sufficient here.

I am a quick study and self taught in all I do. If you watch my YouTube channel or look at my OUPower.com website, you'll see I do know what I'm doing ...this is just new to me and these analog drives might still be giving me issues that I never realized before. So I have to get to a starting point and work up from there. Surely you can understand that need and that logic.

I have replaced my entire Westamp servo drive unit with a new one that does not squeal anymore and I have tuned that Westamp drive according to the PDF file you saw me attach several posts back. To anyone who is not an expert, watching my machine it seems to be working perfectly and move accurately. Fast, slow circles, repetitive operations. You name it, the machine seems to be fine.

Only when pressed into high accuracy work were these problems evident to me.

You may not believe this but I have even fixed my spindle which had .0115" runout when I got it. Yes that 115 tenths! I hear most machinist freak out if they have > 2 tenths runout. That is another story entirely but suffice it to say I now have about .0001" of runout on my spindle and I can live with that.

At this point I want to fix my servo drives because if I can't get them to run more accurately, then I might as well get rid of the machine and invest my time in something else that performs better. I have faith that this can be saved and work nearly perfect if I can just get some help.

Please don't get mad at me for pointing out that the tutorials have a lot of "gaps" or things left out of them. I'm a bright person if you are just willing to help me. In return I will be happy to re-write the tutorials to better explain things to the next people who come along. I believe that's a fair trade... don't you?

I have the unique perspective to help you in that I'm quick to learn and quite versed in many skills. This however, is just new to me so if we can write things so that I understand them; it will only help everyone else in the long run who knows less than I do. Think of me as a bridge.

We keep going back and forth on this "velocity loop tuning" phrase but I think you finally answered it for me. It sounds like velocity tuning is the raw analog tuning from my PDF paper I attached before in this thread. Would you agree? To my knowledge that appears to be done properly and I don't mess with the servo drives anymore accept for possibly tweaking my balance POT once in a while. It is however entirely possible that the TC (time constant) and TACH settings are off somehow and that could be causing my issues. But I do not have any better guide on how to tune those components in a helpful way.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 22:44 #123435 by hatch789

All of the tutorials you've mentioned are referring to tuning the position loop in linuxcnc when using velocity mode drives.

When tuning, to start out, I would send a comand to move the motors at about half the max velocity, with a move long enough to have a steady flat cruse at that velocity so that you can easily see the servo settling at a steady constant speed.
(for the machines I've worked with about 1/2" is often a good distance. But what the best increment may be will depend on the velocity of the command and your acceleration setting. You also need to be certain that your acceleration rates are set to something that is actually achievable for your system.

I will often rough tune the P first, finding the highest value that doesn't osculate, both during the move and at rest.
Then for tuning the FF1, Set the P to about half of the above, and then set FF1 to the value that minimizes following error during the steady constant velocity part of the move (the flat top.)
Then use FF2 to minimize the following error during the acceleration parts of the move.
Finally go back and fine tune the P to the largest value that doesn't oscillate during the move and at rest.

None of this will work if you don't have the max acceleration (or max velocity) set correctly. The PID loop needs to have enough headroom to correct itself during acceleration. Watching the output of the PID loop when tuning, to make sure it never saturates is a good idea.

Your calculated FF1 isn't right. If your machine moves 98ipm (= 1.63333 inches/sec) when 10v is applied. The FF1 should be .163333. (but I'm not certain that will be right) What I am certain of is that you should probably have the max velocity in Linuxcnc set to about 1.3333ips (80ipm).

When John talks about hand tweeking FF1 he is talking about fine tuning the final value according to the real measurements in hal scope and not relying on a calculated value.


Hi Todd, thank you for the reply. My max velocity is set to 60 ipm on the machine, so I am surprised it does 98ipm. Again this is probably something set wrong and I need a more basic starting point. Perhaps my analog drives as I stated before. It may be that my TC and TAC are out of wack in some way. It seems hard to fathom that the machine would run so "well" if they are out of sync that badly but who knows? I need someone who's good with old servo drives to help me there possibly.

So yes maybe that needs to be my starting point but I might need some help/advice in that realm.

So thank you for the answer on how fast to set my speed (half my max) and far to move (perhaps half an inch, long enough to get a steady flat top on my F-Error channel?) -not sure which channel I'm supposed to watch, maybe velocity cmd channel?

Also you must forgive me but if John's tutorial is right he states: FF1 - Should be 10/Velocity@10V (velocity in machine units per second). We both agree my velocity is about 1.6315 ipm ...if that's the case then John's equation, as he has it written is (10 / 1.6315) which equals 6.129 in my case. But what you said is John's equation is backwards and should be: FF1 - Should be Velocity@10V (velocity in machine units per second) / 10. Which in my case is 1.6315 / 10 ( .163 ). So hopefully you guys can see what I mean when I state that there are some glaring problems we need to work together to fix if people are to follow these tutorials. I am happy to help fix them if you guys will just help me figure things out.

Please Log in or Create an account to join the conversation.

More
03 Jan 2019 23:23 #123440 by hatch789
So with Todd's help in figuring out that John's equation was inverted, I was able to achieve max stable P values of 65 with FF1 at .163

Now I'll start to see if I can (as Todd said) drop my P to 30 (about half) and start trying to tune FF1 as per the tutorials. Here's a screenshot of my Follow error with P at 65 and FF1 at .163 just so you guys have a reference.

Attachments:

Please Log in or Create an account to join the conversation.

More
04 Jan 2019 01:26 #123446 by PCW
Replied by PCW on topic PID issues or calibration help
A FF1 tuning hint is that if the following error is in the same direction as the velocity,
you need more FF1...

Please Log in or Create an account to join the conversation.

Time to create page: 0.206 seconds
Powered by Kunena Forum