closed loop position control and feedback

More
17 Nov 2021 13:25 #226732 by myval
I have been scratching my noggin over closed loop position controls.
I have servo driver running in position control mode fed with step/dir when I try to run stepgen in position control no matter what I do with PID I only get two results does not move at all or it oscillates around null f-error like crazy.
I am sure I am doing something super silly. I can run it in velocity control and close the loop with linear scales and I get fairly decent f-error but I don't feel it is correct to have driver running in position control but linuxcnc feeding it in velocity control.
I feel I could get more accuracy if I run in position control.
I have read number of threads about this subject but non helped, so the question is can anyone show me correct and working hal example for closed loop control?
Step/dir output from MESA and linear scale input sounds super simple and obvious but ...
 

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

More
18 Nov 2021 18:48 #226908 by andypugh
A PID typically needs to be off-by-one from the controlled quantity. So a classic position loop would use a velocity-control servo., for example.

Typically with a setup like yours (step-dir and scales) you would set the LinuxCNC stepgen to velocity mode, send velocity commands from the pid to the stepgen and use the scale as position feedback to the pid. You might need to tune but I think that in most cases a p-gain of 1000 is right for such a system.

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

More
20 Nov 2021 15:56 #227094 by myval
so well my head is about to explode.
so it is ok to have servo driver in position control mode and feed it velocity commands with the final linear scale feedback into Mesa?
I quickly sketched it, one picture is thousand words they say. it is in attached pdf
 

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:

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

More
20 Nov 2021 16:17 #227100 by tommylight
That should work.

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

More
20 Nov 2021 16:25 #227102 by myval
well this is the only way I could get it working.
But I thought it should be all position.

Or the question is what should it be or how should I do it to make it 100% correct and right and accurate?

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

More
22 Nov 2021 15:40 - 22 Nov 2021 15:47 #227304 by Todd Zuercher
Technically you are not sending velocity commands to the drive. You are sending velocity commands to the hardware step-generator in the Mesa card. The Mesa card converts the velocity commands to the position step pulses that the servo drive is reading. Then the position loop is closed in Linuxcnc either using the position feedback from your encoder/linear scale or position feedback from the step-counter in the Mesa card.

And yes that is the correct way to do it.

PS: It is possible to send position commands to the Mesa card and have it generate the step pulses from that, but it has been proven to be less accurate than this way, and that way would not allow you to use the linear scale's feedback to close the position loop.
Last edit: 22 Nov 2021 15:47 by Todd Zuercher.

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

More
09 Dec 2021 16:57 #228715 by myval
OK so it seems to be all good. Created first chips today and it seems to be spot on.
I will have to doo much more testing and much more learning too.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum