Coordinate System Offset in HAL

More
12 Jul 2018 13:41 #114056 by HalaszAttila
Hello,

i thinking about how can i calculate the real (measured), peripheral speed (cutting speed) on lathe.

If i know the coordinate of tool edge on X axis (diameter), and the speed of spindle (measured form encoder), it is easy to calculate and write out in pyvp box.

The spindle speed i can use in HAL file from encoder... module.

But the question is does it possible in HAL file, to get or calculate the tool edge position (depending on G54 coordinate offset and Tool Offset), or with other words the diameter of manufacturing, and from this and real spindle speed to calculate the real cutting speed?

Best regards, Attila.

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

More
12 Jul 2018 15:43 #114073 by andypugh
If you run the lathe in CSS mode then you don't need to know this...

But HAL can easily multiply the spindle speed by the X position:
linuxcnc.org/docs/2.7/html/man/man9/mult2.9.html
You would need to add another mult2 to add the factor of Pi.

X (radius) position is available as halui.axis.N.pos-relative.
linuxcnc.org/docs/html/gui/halui.html
The following user(s) said Thank You: HalaszAttila

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

More
13 Jul 2018 08:54 #114117 by HalaszAttila
Thanks for your quick answer, i will try this method.

My other calculation is the real (measured) distance on axis per spindle rotation (used during Variable Pitch Helix threading).

My calculation need the index signal from spindle encoder (Heidenhein ROD420).

The problem is, when i use hm2_5i25.0.encoder.01.input-index signal to measure time between two index edge, i realized that the mesa card (or linuxcnc driver) don`t read every index signal from encoder. (i checked the encoder with oscilloscope, and the encoder gave index signal on every rotation, and the LOW=0.02V HIGH=3.2V). But when i check in LinuxCNC scope, here is just every 5-50 rotation / INDEX signal. I checked the encoders for X and Z axis (heidenhein) and both are behaves like spindle encoder (the A B signals is OK on every encoder with the same high low voltages). I try to home x z axis many time to index signal, and every time was ok, never miss index signal.
Maybe the reading the signals is ok in mesa card, and not possible to use them in HAL file?
Is it possible to use the index signal form HAL file? Or what may be the problem?

Best regards, Attila.

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

More
13 Jul 2018 09:10 #114118 by andypugh

The problem is, when i use hm2_5i25.0.encoder.01.input-index signal to measure time between two index edge, i realized that the mesa card (or linuxcnc driver) don`t read every index signal from encoder.


The Mesa card is polled every 1mS. You will only see the index pulse on _that_ HAL pin if it happens to be set at the precise moment that the read is done.
Which is why we have the index-enable handshake so that we can determine that an index _has_ been seen and how many encoder counts ago it happened.

I don't understand what you need the index for? Why not just use the hm2_5i25.encoder.NN.position or hm2_5i25.encoder.NN.velocity outputs?

You might find this article on variable-pitch threading interesting:
wiki.linuxcnc.org/cgi-bin/wiki.pl?JMKsFusee
The following user(s) said Thank You: HalaszAttila

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

More
13 Jul 2018 09:31 #114120 by HalaszAttila
I just want to calculate the axis distance moved per spindle rotation (real threading pitch), and write out to pyvcp gui.

My plan was to use spindle index in ladder.
And for every rising edge of index store the "motion.distance-to-go" variable, and the next edge subtract it from present value. But this method can not work. I must find other way.

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

More
13 Jul 2018 09:45 #114121 by andypugh
Why do you need to measure the pitch? Do you not trust the machine to follow the programmed path?

You should get the same data by dividing the spindle velocity by the axis velocity. That would be calculated every 1mS rather than every revolution, but the number would theoretcally be the same. In practice it would need a low-pass filter to show stable numbers.

An untidy way to do what you want would be to convert the spindle position to an integer then back to float, then use a ddt component on that. It will jump by 1.00 every spindle rev. Pass the ddt output into a comparator (comp) module to trigger a sample/hold component and subtract.
linuxcnc.org/docs/2.7/html/man/man9/conv_float_s32.9.html
linuxcnc.org/docs/2.7/html/man/man9/conv_s32_float.9.html
linuxcnc.org/docs/2.7/html/man/man9/ddt.9.html
linuxcnc.org/docs/2.7/html/man/man9/comp.9.html
sample hold (linuxcnc.org/docs/2.7/html/man/man9/sample_hold.9.html ) is for S32 and can't be used here, so you need to feed the output of a mux2 back into itself to make one.
linuxcnc.org/docs/2.7/html/man/man9/mux2.9.html

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

More
13 Jul 2018 09:45 #114122 by andypugh
Or write a custom HAL component to do the calculation every time it sees the spindle position change by 1.
The following user(s) said Thank You: HalaszAttila

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

Time to create page: 0.068 seconds
Powered by Kunena Forum