linear scale and AC servo set up - sanity check
- chienMouille
- Offline
- Senior Member
- Posts: 73
- Thank you received: 3
I'm attempting to convert a rather standard milling machine. I have an AC servo as well as a 5um linear glass scale. I have a really hard time setting the feedback PID of the scale. I am coming to you all for a sanity check.
I haven't connected the servo feedback to the 7i95 mesa card, but have tuned it as best as I could to have it react fast and be stiff. The TTL signal of the scale is connected to the first encoder input of the 7i95. The servo is commanded by a dir/pulse position output. Any type of tuning I'm attempting with the scale seems to make things much worst than without the scale feedback at all.
Am I wrong with the basic set up, e.g. the fact that the servo encoder is not feedbacking to the mesa card messes it all up?
Thanks a lot in advance
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
- Posts: 5067
- Thank you received: 1437
Start by testing the servo's movements with the linear scale and the normal Mesa open loop stepper configuration, except connect the feedback from the linear scale to "joint.N.motor-pos-fb" (keep the stepgen's position feedback connected to the PID loop). Then compare the joint position feedback and following error with the stepgen position feedback and PID error with Halscope. You may be surprised with how much they may disagree and when. Doing this is going to show you two things, the state of tune of your servo drive's position loop, and how much lost motion you have.
This will also be a sort of a baseline, you won't be able to expect to achieve better stability than the drive's current state of tune.
You will also find that the P settings when using real position feedback will need to be significantly lower than the P setting for the openloop stepgen system (in other words P will need to be a lot less than 1000.)
You need to remember that any lost motion (aka backlash) in the system between the servo, it's feedback and the linear scale will result in either reduced response performance, cause instability or both. Adding a linear scale does not eliminate the problems caused by backlash. Adding linear scale the can reduce and change the effects of the backlash but won't remove them. Best to fix your mechanical problems rather than try to band-aid them.
PS, No, the fact that the servo's rotary encoder isn't feeding back to Linuxcnc, should not be causing any problems.
Please Log in or Create an account to join the conversation.
- chienMouille
- Offline
- Senior Member
- Posts: 73
- Thank you received: 3
The problem mainly is that however I try and tune it (following guides on the forum) it quickly ends up oscillating a lot on the target or moving to it in slow motion. And the following error is huge.
Indeed I have a couple of tenths of backlash as I haven't yet changed the leads crew and totally being carried away at trying to tune this motor on the current setup.
I will post pictures of the scopes tomorrow, I'd be very curious of your analysis in reading them, if you don't mind.
I will reduce the Hal configuration to your suggestion too. If you could point me to a guide or example of stepgen-encoder Hal configurations it would be super useful for later as well. I'm having a hard time understanding the feedback and pid Hal setup. I have so far made a dummy encoder configuration in pncconf and copied what seemed relevant to my Hal file.
I could post the state of the Hal and ini files tomorrow too if useful.
Thanks a lot!
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
- Posts: 5067
- Thank you received: 1437
Switching from the usual PNCconfig open loop stepgen configuration to an encoder feedback closed loop one is relatively simple and only requires changing and or adding a few lines of halcode to disconnect the pid feedback from the stepgen's feedback and replacing it with the encoders. Then you have to tune the PID.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
- Posts: 5067
- Thank you received: 1437
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
- Posts: 18822
- Thank you received: 6320
step dir encoder site:linuxcnc.org
www.google.com/search?q=step+dir+encoder...ABAQ&sclient=gws-wiz
Please Log in or Create an account to join the conversation.
- chienMouille
- Offline
- Senior Member
- Posts: 73
- Thank you received: 3
Hi, I have changed the Hal file to run the test you described here as best as I could. I'm attaching a screenshot of the scopes, as well as the INI and HAL files.Start by testing the servo's movements with the linear scale and the normal Mesa open loop stepper configuration, except connect the feedback from the linear scale to "joint.N.motor-pos-fb" (keep the stepgen's position feedback connected to the PID loop). Then compare the joint position feedback and following error with the stepgen position feedback and PID error with Halscope. You may be surprised with how much they may disagree and when. Doing this is going to show you two things, the state of tune of your servo drive's position loop, and how much lost motion you have.
Would you be kind to have a look and help me make sense of it?
thanks a lot
Attachments:
Please Log in or Create an account to join the conversation.
I would recommend leaving the linear scales off at first, run Step/dir open loop to the drivers, tune the drivers as well as possible, and then set up LinuxCNC's open loop backlash compensation as best you can. Once you have that set up working, use it to machine the parts for a ground ballscrew conversion. I wouldnt try closing the position loop to linear scales without a mechanically stiff system.
Mark
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
- Posts: 5067
- Thank you received: 1437
With those settings Linuxcnc is running open loop, so all of the oscillation you see there is all just from your servo drive's tuning (or lack of). This indicates you need to work on the tuning in your drive some more. It looks like it has too much P and or not enough D, but we don't know for sure not knowing your drive or being familiar with it's tuning software. (They aren't all the same or use standard PID loops.)
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Away
- Platinum Member
- Posts: 5067
- Thank you received: 1437
Plotting the commanded velocity and velocity feedback (from the encoder) might also prove enlightening. For example if your commanded acceleration is exceeding the drive's acceleration capabilities, might contribute the above results.
Please Log in or Create an account to join the conversation.