Spindle orient PID tuning [re-solved, yay]

More
24 Jun 2022 13:28 #245785 by spumco

You have actually found the issue that ended up with me making the multi-spindle patch, but which I have still not got round to.
The idea is that spindles should be included in the home sequence. And to do that they neede to act more like joints, and then there might as well be support for more than one and...

Anyway, sorry I didn't think of this earlier when we were discussing the problem. It should have been obvious to me.

You should be able to "sets" the _signal" that links all the index-enable pins. But once they are in a net you cant "setp" the individual pins.

It should be possible in HAL to arrange for the spindle to run at constant speed if orient-enable is true and index-enable is true. (and you would need to "sets" that signal true in HAL just as you do now)

One way would be to switch-in an FF0 input on the orient PID (of you are not already using that) switched in and out by a mux2 in turn controlled by index_enable AND orient_enable.

This is already looking complicated enough for a custom component...

 

I'll change HAL to setS rather than setP for now, seems a bit more tidy.  And I'll plan on 'homing' the spindle at startup with the other axes with the little orient testing gcode I wrote.  I've already lowered the initial M3 speed so I don't make my spindle probe angry if I leave it in the spindle and spin it up to 1kRPM.
One way would be to switch-in an FF0 input on the orient PID (of you are not already using that) switched in and out by a mux2 in turn controlled by index_enable AND orient_enable.

I'm not using FF0 for the orient PID.  I'm still using the lincurve to P-term you set me up with, D=160, no I-term, and no FF0/1/2.  It's working quite well now.
This is already looking complicated enough for a custom component...

Oh, dear.  Can open, worms everywhere.  I think I've seen posts of your going back a number of years describing the intended spindle homing function, followed by "I've have still not got round to..."

Wouldn't it be easier to just get the spindle homing function off your plate?

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

More
30 Jun 2022 02:18 - 30 Jun 2022 02:46 #246242 by spumco
It's always something...
Tonight's snag: orient.

I'm finally ready to start testing my ATC/M6 remaps with the new carousel component the the Probe Basic GUI buttons.

I've got sets spindle-index-enable true in hal, so when the machine starts up it's ready to home the spindle.

Problem is that if I turn on the spindle and turn it off (i.e. a warmup), that clears spindle-index-enable to false and then orient goes to the wrong location.

I'd like some way to positively set spindle-index-enable TRUE inside my remap files, so whenever I do an M19 it forces it to use the index pin.

Connecting spindle-index-enable to motion.0.digital-out-nn didn't work: error at startup (signal already has a writer).

Someone have an idea how to force a signal (or any of the pid/spindle/encoder index-enable pins) to go high in gcode?
 
EDIT - connecting motion.digital-out-nn through an or2 to one of the index-enable pins doesn't work.  spindle.n.index-enable and encoder.n.index-enable are in/out and don't like being connected to an out signal.  And pid.n.index-enable is an in-pin, but it too doesn't like being connected to an or2 component.
Last edit: 30 Jun 2022 02:46 by spumco. Reason: more failed testing

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

More
30 Jun 2022 03:48 #246245 by PCW
You can connect to bit in/out pins using the tristate_bit component
The following user(s) said Thank You: spumco

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

More
30 Jun 2022 04:38 #246248 by spumco
That was magic.  Thank, PCW

net spindle-index-trigger-in     <= motion.digital-in-07
net spindle-index-trigger-in     => tristate-bit.0.enable
setp tristate-bit.0.in               1
net spindle-index-enable        <=> tristate-bit.0.out

Add an M64 P7 and M65 P7 to the start of the orient process and it works every time, from any starting point.

Can I remap M19 to incorporate the tristate function, or would it be better to create an "M119.ngc" that is my spindle orient function used inside the various ATC remapped M-codes?

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

More
30 Jun 2022 20:42 #246310 by andypugh
I am not sure why it is a problem to zero the encoder early. Once the encoder has zeroed at index it should remain zeroed to the index.

Adding a spindle-index-enable option to the orient component might be a helpful idea.

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

More
30 Jun 2022 21:25 #246316 by spumco
I don't know the inner working of LCNC, but I wonder if those g-codes which require an index signal (tapping, threading) have an internal equivalent of index-enable?  And thus an edge-case (arguably, anyway) like orient never had one?

I'm not the only person who orients their spindle.  Why haven't other people reported the same inability to maintain the same orient-0 position between LCNC sessions?

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

More
30 Jun 2022 22:44 #246327 by andypugh

I don't know the inner working of LCNC, but I wonder if those g-codes which require an index signal (tapping, threading) have an internal equivalent of index-enable?


It isn't "internal", they actively toggle the status of the spindle.N.index-enable pins when they want to zero the spindle index.

I'm not the only person who orients their spindle.  Why haven't other people reported the same inability to maintain the same orient-0 position between LCNC sessions?


No, but I am wondering if your encoder ratio is not exactly correct. Every full turn of the spindle should increase the spindle position by exactly 1.0000
Orient assumes this, and simply commands a position that is relative to the current number of full turns.
Try zeroing the spindle (manually set index-enable then rotate through index) and then manually turn the spindle a further 10 times. Does 10.0 align with where 0.0 was?


You should only leed to re-home if your encoder loses counts at high speed or the encoder ratio is not exactly 1:1
The following user(s) said Thank You: spumco

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

More
01 Jul 2022 01:07 #246335 by spumco
Manually turned the spindle 10 times and encoder.00.position = 10.000978, right where  it dropped to 0 after index-enable triggered the reset.

And orient.0.position has the same value as encoder.00.position.

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

More
01 Jul 2022 12:23 #246355 by andypugh
OK, that ought to mean that it doesn't matter when the index reset happens, everything should still be correct for the M19.

You could run a short G33 move before the M19, to force a new index-reset.

G33 Z#<_z> -0.1 K0.1
G33 Z#<_z> +0.1 K0.1
The following user(s) said Thank You: tommylight

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

More
01 Jul 2022 13:13 #246363 by spumco
That would do it.  Basically, I can do anything which triggers the index-enable.

Since I need to turn on/off the air cylinder lock a simple M19 isn't going to be enough on its own and I need a multiple-step orient sequence.

Might as well use the tristate-bit through a digital-out; no G33 head movement required.

G64 P7 (tristate)
G65 P7
M3 S300
M5
M64 P4 (spindle lock)
M19 R0
M65 P4
M5

I'm sure something will go wrong, but for now the above seems to get the spindle oriented under all circumstances.
The following user(s) said Thank You: tommylight

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

Time to create page: 0.094 seconds
Powered by Kunena Forum