(Solved) Synchronize multiple spindles? (lathe subspindle)

More
09 Feb 2024 04:21 #292909 by spumco
Major progress synchronizing the spindles tonight after re-reading Andy's earlier post(s) for about the 100th time.

mux2 #1 to connect main spindle encoder position to subspindle stepgen position-command
mux2 #2 to switch sub stepgen-type from velocity to position mode

Now the main spindle accel/decel PID doesn't matter as the sub just follows the main, including the caxis.comp return-to-last-position move.

 

Very slight delay on spindle start, but the encoder positions don't lie - following looks tight.  Sub PID is still open-loop.

Still to work out...
  • M-codes to
    • Orient sub to 0
    • enable/disable sync with the two mux2 selects
  • Figure out how to set the sub position to the same value as the main position at enable.
    • If I run the main by itself on sync enable the sub rotates at max speed to align the two positions.  No following error as it's not an axis/joint... but still not ideal.
    • Can't reset the main position as I'd lose the C-axis home or zero position
Hmmm...
Attachments:
The following user(s) said Thank You: tommylight

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

More
10 Feb 2024 23:21 #293042 by spumco
Well that took some mental gymnastics but it works like magic now.

After a few days and a million iterations it finally sunk in what values and connections needed to be joined up.

First hurdle... Andy's 'sample-hold' mux2 just wasn't sinking in, no matter how many times I read it or fiddled around.  Probaby a character defect on my part.

I did manage to understand that the whole point of his mux2 was to overcome the glaring deficiency in LCNC's standard sample-hold.comp.  i.e. that it only works with s32 data type.  So... what if I just copied the existing sample-hold.comp, substituted 'float' for 's32', and renamed & installed it?

Holy [insert vulgar exclamation here], it worked.

I now have a tidy sample-hold-float component and don't need the mysterious mux2 feeding back in to itself.

So now the logic looks like this, in English (mostly):
  • sum2 #1: main-spin position - sub-spin position = sub position offset
  • sum2 #2: main-spin position - latched sub offset = difference between main and sub is 'locked'
  • At synch command
    • Sample-hold-float - capture sub position offset value from sum2 #1
    • Mux2 #1 - switch sub stepgen from velocity to position mode
    • Mux2 #2 - sum2 #2 sent to sub stepgen position command
When off, both spindles are independent.
When enabled, neither spindle does 'catch-up' or wild antics.
Start the main spindle and the sub is tightly slaved to the main, including with CSS and when the main does the caxis.comp return-to-last position rapid.
Turn it off again, still no ill behavior - Magic.

So I now have:
  • C-axis main spindle
  • Subspindle w/CSS & orient
  • Synchronized main & sub w/CSS on-demand
YAY!

Next step - interlocking so I can only turn on sync when spindles are stopped.

Side note - this comp seems really useful.  Wonder if it should be added to the LCNC mainstream?

Warning: Spoiler!



Warning: Spoiler!

 
The following user(s) said Thank You: tommylight, Aciera, jpg

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

More
10 Feb 2024 23:40 #293045 by tommylight
Shooting from the hip here, but since the comp is quite simple, maybe adding a check for both spindle speeds could be easy enough by getting the spindle.0.out and spindle.1.out or whatever spindle out values are in use (getting rusty here) and sending those through inverted and2.
Also renaming the comp to avoid confusion.
Great work, and thank you for detailed explanations.
The following user(s) said Thank You: spumco

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

More
11 Feb 2024 00:29 #293047 by spumco
I named the new file 'sample-hold-float.comp' before running halcompile.  Couldn't believe it was that easy.

I'm not too worried about the spindle speed interlock.  I've already got an interlock in classic ladder so my drawbars can't open while the spindles are running.  I'll probably tie the M100/M101 to another rung with the same interlock so I can't sync or unsync unless the spindles are stopped.
The following user(s) said Thank You: jpg

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

More
13 Feb 2024 02:05 #293186 by spumco
Last piece of the puzzle is driving me nuts.

While watching the sub do it's thing, it occurred to me that the sub needs to spin opposite the main during normal M3 commands.  Reason being that the backside tooling hasn't changed handedness, and a RH drill or tap needs a 'normal' M3 spindle direction.

But they still need to turn the same direction when synchronized.

Step 1 - reprogram drive so M3 results in opposite direction.  Done.
Step 2 - reprogram drive so M3 results in positive encoder direction.  Done

So now I've got to rearrange the encoder value choreography somehow so that
  • Main-spin encoder count increase
  • Opposite output to sub stepgen
  • AND the offset remains the same
My first few attempts inverting the main encoder value failed.  The invert worked, but my math or connections didn't. Tried an ABS component on the latched offset value, but that wasn't it.

Any bright ideas?

Current not-working attempt:
Warning: Spoiler!

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

More
13 Feb 2024 05:12 #293196 by spumco
YES!

Trick is not to worry about the offset.
  • Step 1
    • Sample-hold the main position
    • Sample-hold the sub position
  • Step 2
    • Subtract main position from latched main value
    • This is the incremental value the main moves
  • Step 3
    • Invert the increment value
  • Step 4
    • Add the inverted increment value to the latched sub position
  • Step 5
    • Send the incrementing position to the stepgen position

My brain is hamburger now, but I have a well-behaved subspindle that rotates opposite the main at M3 while rotating with the main when synchronized.

@Tommy - you want me to change the title to [SOLVED]?
The following user(s) said Thank You: tommylight, Aciera, jpg

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

More
13 Feb 2024 12:51 #293219 by tommylight
The following user(s) said Thank You: spumco

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

Time to create page: 0.093 seconds
Powered by Kunena Forum