Proper spindle orientation using 2.6

More
08 Sep 2014 23:44 #50958 by tnl.lambert
Before 2.6 was released, I hacked together a ladder program to recognize the index pulse on the spindle at low speed, after which I would stop the spindle, setting the index location. I could then perform a toolchange.

When 2.6 became available, I upgraded, remapped the T- command, and started in on the M19 procedure. I've followed what I think is the correct procedure so far - I've connected the orient pins to the orient-pid as recommended by linuxcnc.org/docs/html/man/man9/orient.9.html . I still need to work on the PID tuning, but I also need a signal to indicate that the spindle has found the index location.

I understand that M19 is used for more general orientation commands, but I'd like to set it up so that it can be used to find the index pulse. I'm fine working in HAL, comp, or whatever - but I want to do it properly. One complication is that because the index pulse needs to be used every time the M19 command is called, the position gets reset, which screws up the PID feedback.

I can provide more detail if needed. Thanks!
The following user(s) said Thank You: akb1212

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

More
15 Sep 2014 02:27 #51166 by akb1212
Great!

M19 is vital for most of us with an ATC. Most ATC's needs the spindle to be in a specific orientation, and so does mine.

To be honest I didn't know M19 was missing as a feature in LCNC. But if it's not implemented properly yet I'm sure there are several others besides me who are hoping to get their ATC to work. And to be able to do that we are dependent on M19 to work properly as expected.

And if you are able and willing to make a decent working version of M19 we can use then I would think there are several users who would be very thankful!

Here is a thread about implementing ATC's where I refer to this thread and that you are working on implementing M19. I hope this can be encouragement enough for you to understand what you are doing is important and a much wanted feature! ;)

I guess if I want to stop the spindle as precise and accurately as my moving axes I would need to tune it. Is there any work done on tuning the spindle with PID loop? I guess it’s not that much different than one of the axes really?

Anders

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

More
15 Sep 2014 07:46 #51176 by andypugh

I understand that M19 is used for more general orientation commands, but I'd like to set it up so that it can be used to find the index pulse. I'm fine working in HAL, comp, or whatever - but I want to do it properly. One complication is that because the index pulse needs to be used every time the M19 command is called, the position gets reset, which screws up the PID feedback.


M19 (or generic spindle orient) does not have to use the index-enable signal. In fact it is better if it doesn't.

Also, your tool-change does not necessarily have to use M19. You can trigger the orient on other HAL pins, and the tool change is not likely to need to variable-orient-angle offered by M19.

Enable an instance of the "orient" HAL component and an associated PID using the iocontrol.0.tool-change HAL pin and it all ought to pretty-much just work.

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

More
15 Sep 2014 11:36 - 15 Sep 2014 11:39 #51179 by tnl.lambert
If M19 doesn't use the index pulse, how can I be sure that it will accurately orient the spindle? Even if I don't use it for toolchange, I want to be sure that it's calibrated properly.

I suppose that I can just automatically orient when the tool-change pin comes up, but I need to be able to confirm the alignment of the spindle.

M19 is nice because it performs the mod() and directional logic for me (so that my PID goes to the right spot). I can't just go to the pulse, because that's 90deg off from the toolchange location, so I need to set a new point exactly 90deg off from the point where the pulse shows up. That gets messy in hal, because I have to set up a bunch of mux components, and then add in the offset after the pulse trips the trigger. All of this seems overly complicated when there's a nice M-code just sitting there.

If M19 isn't the 'proper' way to orient for toolchange - what is the method that 'should' be used? That's really the question I'm trying to answer.

P.S. I also have to pass the index pulse through a classicladder timer or through a delay hal component in order to get the pulse to register with the rest of linuxcnc. Not sure if that's how it should go either.
Last edit: 15 Sep 2014 11:39 by tnl.lambert.

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

More
15 Sep 2014 16:45 #51186 by cncbasher
M19 works fine for me , but it does require an encoder with index
you dont need to look or test for the index , just set the degrees of the angle required , in some cases if the machine has been set correctly , then the index may well align with the required angle
just don't run the spindle past say 200 rpm .

i manually turned the spindle and watched the spindle encoder index to see when it was triggered , in one case it matched the angle required , so one less problem
the other was 90 deg out ,either way it has not given me any problems or missed the positions

i modified my sections based on this
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrientation

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

More
15 Sep 2014 19:11 - 15 Sep 2014 19:13 #51192 by andypugh

If M19 doesn't use the index pulse, how can I be sure that it will accurately orient the spindle?


The spindle encoder should only need to be zeroed to the index once, at machine startup. From that point on it should accurately report spindle position.
Not that there is necessarily any harm in re-zeroing the encoder, but it shouldn't be necessary.
To zero the spindle encoder at startup it probably suffices to have "sets spindle-index-enable 1" in the HAL file, then the spindle will zero the first time it passes the index. (There is a risk with this that if there is a spindle orient before the spindle makes a full revolution, and if the spindle doesn't pass the index during the orient, that the orient will not be correct. Orient possibly needs to check the statis of the spindle index-enable pin to avoid this risk.)

M19 is nice because it performs the mod() and directional logic for me (so that my PID goes to the right spot).

M19 itself doesn't do that, that is (typically) handled by the "orient" component. M19 just sets a HAL pin to the requested orient angle. For a tool-changer this could be hard-coded on the HAL. M19 may be advantageous in that it has a timeout that can be used to abort toolchange, but it isn't strictly necessary to use it. Many toolchange procedures do not (and can not) run any G-code at all. A HAL component of Classic Ladder changer can't run an M19.

If M19 isn't the 'proper' way to orient for toolchange - what is the method that 'should' be used?

The "proper" way is whatever works best for you on your machine.

P.S. I also have to pass the index pulse through a classicladder timer or through a delay hal component in order to get the pulse to register with the rest of linuxcnc. Not sure if that's how it should go either.

No, there shouldn't be any need for that. How are you counting the spindle encoder? if the counter can see the A and B pulses then it should also see the index pulse.
But then it depends on what you are doing with the index pulse. It would normally only be used to reset the encoder counter, not as a direct input to HAL.

[EDIT: I should state that spindle-index-enable is a fictitious HAL signal, and you would have to use a HAL signal that actually exists in your config]
Last edit: 15 Sep 2014 19:13 by andypugh.

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

More
16 Sep 2014 04:53 #51208 by akb1212

i modified my sections based on this
wiki.linuxcnc.org/cgi-bin/wiki.pl?SpindleOrientation


Are you saying what you use are based on what's in that wiki?

There is references to classicladder pins in there. But where is the classicladder program?
I haven't used classicladder myself yet, and I'm trying to learn how to use it at the same time as I'm trying to make my ATC work here, so I might ask stupid questions here....

At the start of that wiki there are links to YouTube videos. Too bad the link in the description to where a full description of the project is no longer working.... The link is: www.linuxcnc.org/component/option,com_ku...id,559/lang,english/ . But it's no longer working. Anyone who knows of another link to that description? I'd really like to see that.

I know I have to write a fairly complicated classicladder program to control my ATC. It has an arm with 4 different hydraulic functions and a whole array of sensors to detect the different positions. So I need as many references as possible.

BTW, my original controller is using M19 at the beginning of a tool change. It is rotating the spindle at about 50 RPM before each tool change. And the exact position to where it stops is set on one of the many constants the controller has. I guess this parameter is the angle between where the index pulse is and where you want your 0 degrees to be. The orientation used by the ATC needs to be set precisely. And when using the M19 command this is the angle used.

So for my machine I will keep using M19 as part of my ATC config as that makes sense on my machine. The main encoder is the only way I'll be able to know the orientation of the spindle, so I see no other alternatives for me.

But I’m a bit confused here. Is there a M19 command implemented in LCNC? The user manual doesn’t have it listed in the index. But then again the wiki about spindle orientation is from 2010, a long time ago.

Anders

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

More
16 Sep 2014 05:00 - 16 Sep 2014 05:02 #51209 by andypugh

But I’m a bit confused here. Is there a M19 command implemented in LCNC? The user manual doesn’t have it listed in the index.


It's linked from this page (which is available from the CNC menu) www.linuxcnc.org/docs/html/gcode.html
Last edit: 16 Sep 2014 05:02 by andypugh.

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

More
16 Sep 2014 14:46 - 16 Sep 2014 14:47 #51230 by cncbasher
you may be over complicating the issue , and trying to establish what was before , to control your toolchanger , there are other ways
and it may well remove the toolchanger controller you have and simplify things quite a bit .

the classic ladder parts are only used for indications , i did not need them so their references were removed
what types of movement are required for the toolchanger ?, what machine is it , i may well have these parts already working without using classic ladder

on one machine i have the orient is actually mechanical and operated by the spindle pull stud ram and the spindle had a sensor for rpm only ( single proximity )
and also was in the position for orient , so i used that , as the ram operated it swung the spindle to the correct angle

by main encoder i presume you mean your spindle encoder , thats all you need in most cases
Last edit: 16 Sep 2014 14:47 by cncbasher.

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

Time to create page: 0.091 seconds
Powered by Kunena Forum