linear scale and AC servo set up - sanity check

More
18 Oct 2022 12:10 #254397 by andypugh

alright, yes, I wasn't getting what unit. so millimeters yes?
 

Sort-of. Each vertical graduation is (at the current scale of the f-error curve, which is too small to see detail) 500 milli millimeters, or 500 microns. 
The following user(s) said Thank You: chienMouille

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

More
18 Oct 2022 12:17 #254398 by chienMouille
extra question: would there be a way with this dual PID loop setup to link the software backlash compensation to only the inner loop? I'm thinking if the order of operation on direction change would be: 1-openloop move to commanded position 2-open-loop backlash compensation 3-PID from scale feedback to finalize position, I could then tune the PID for a much smaller range (like with a less sloppy screw)

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

More
18 Oct 2022 12:26 #254399 by andypugh
Possibly....

It would take a bit of HAL magic.

You definitely do not want backlash comp on the actual commanded position that is being compared to the linear scale. That would be very counterproductive.

If you look at linuxcnc.org/docs/stable/html/man/man9/m....9.html#JOINT%20PINS

Then you might be able to add the backlash-filt value to the commanded position of the inner loop.

But then you would need to _subtract_ it from the commanded position of the outer loop, because the outer loop needs actual commanded position to be compared to the scale.

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

More
18 Oct 2022 12:47 #254402 by chienMouille
That's super interesting, it seems like a very good way to make the best of a poor mechanical setup like mine. I'd be very interested to experiment down this road.

How do you setup math operations in HAL? I see the and2 or2 components but the are for booleans. How would one go about adding and substracting signal values?

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

More
18 Oct 2022 12:49 #254405 by andypugh
Addition uses sum2, subtraction also uses sum2, but with a negative gain on one input.
The following user(s) said Thank You: chienMouille

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

More
18 Oct 2022 12:49 #254406 by chienMouille
Also, where can I find the reference of the Hal component actually using the Backlash value of the ini file? If I could see this logic, it could help me implement the new logic, i guess, if i understand anything of it...

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

More
18 Oct 2022 13:04 #254409 by andypugh
The backlash entry in the INI file is used directly be the "motion" HAL component. (manpage already linked)

I don't know of any docs that describe the internal workings of motion, but the actual code is here

github.com/LinuxCNC/linuxcnc/blob/348b0d...tion/control.c#L1629
The following user(s) said Thank You: chienMouille

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

More
18 Oct 2022 13:24 - 18 Oct 2022 13:25 #254413 by chienMouille
i'm already doing something wrong with the additions, I don't quite get when signals and pins are forbidden. Also, how can I use a pin for my math in sum2 and also connect it to another signal? (I could avoid the substration for instance if I could use the joint.N.motor-pos-cmd both as an input to sum2 and an actual value for pid.x_external-command.


addf sum2.1 servo-thread
net sum2.1.in0 <= pid.x_external.command
net sum2.1.in1 <= joint.0.backlash-filt
net x-pos-cmd-comp <= sum2.1.out

addf sum2.2 servo-thread
setp sum2.2.gain1 -1.0
net sum2.2.in0 <= x-pos-cmd-comp
net sum2.2.in1 <= joint.0.backlash-filt
net x-pos-cmd-no-comp <= sum2.2.out
 
Last edit: 18 Oct 2022 13:25 by chienMouille.

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

More
18 Oct 2022 13:36 - 18 Oct 2022 13:39 #254414 by andypugh
You need signal names after the net commands.

At the moment you are creating signal names like "sum.1.in0" which are exactly the same as HAL pin names (which is allowed, but confusing)

To take your particular example, all these are equivalent, you can choose any signal names you want, and arrows are allowed for your own comprehension but ae ignored by LinuxCNC:
net some_signal joint.N.motor-pos-cmd
net some_signal sum2.0.in0
net some_signal pid.x_external.command
net some_signal joint.N.motor-pos-cmd
net some_signal sum2.0.in0 pid.x_external.command
net some_signal joint.N.motor-pos-cmd sum2.0.in0 pid.x_external.command
net some_signal <= joint.N.motor-pos-cmd
net some_signal => sum2.0.in0
net some_signal => pid.x_external.command
net some_signal <= joint.N.motor-pos-cmd
net some_signal => sum2.0.in0 pid.x_external.command
net some_signal joint.N.motor-pos-cmd => sum2.0.in0 pid.x_external.command
Last edit: 18 Oct 2022 13:39 by andypugh.
The following user(s) said Thank You: chienMouille

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

More
18 Oct 2022 13:42 #254415 by chienMouille
ok so this works 3 more lines, but now it says "x-ex-pos-comp is not a pin name". but that's meant to be a signal name
net backlash0 <= joint.0.backlash-filt

addf sum2.1 servo-thread
net x-pos-ex-cmd => sum2.1.in0 
net backlash0 => sum2.1.in1 
net x-pos-cmd-comp <= sum2.1.out

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

Time to create page: 0.164 seconds
Powered by Kunena Forum