System variable for current Z machine position

More
02 Sep 2014 16:53 #50622 by emcPT
Hello

I am writing a subprogram to suit my machine and I need to get the current Z machine position.

Looking at:
linuxcnc.org/docs/html/gcode/overview.html, I would use:
#<_z> - Return current machine Z coordinate. Same as #5422.

I tested using 5022 or 5422, but both return the actual relative position, not the machine position that I am looking for.

Would this be a bug or am I looking at the wrong variable?
I am using a custom 2.6 pre

Thank you

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

More
02 Sep 2014 17:42 #50623 by ArcEye
Hi

I think it is a case of imprecise phraseology

5420-5428
Current Position including all offsets and in the current program units for X, Y, Z, A, B, C, U, V & W, volatile.


5422 returns the current relative position in the active co-ordinate system I believe, so it definately does not return machine position despite
what this says

#<_z> - Return current machine Z coordinate. Same as #5422.


I have never needed to access actual machine position from gcode and was rather surprised to find there was no set of parameters for it,
unless I too cannot see them.

You can get machine position programmatically from halui.axis.n.pos-commanded (float, out) - Commanded axis position in machine coordinates
but that does not assist you much.

One way would be to touch off one of the co-ordinate systems to 0,0,0 at home and then it will mirror machine position and you can use that

regards
The following user(s) said Thank You: emcPT

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

More
02 Sep 2014 17:47 - 02 Sep 2014 17:56 #50624 by emcPT
Thank you,

I will wait a bit more to see if there is anyone using it (maybe it already exists). If not I will think about possible turnarounds but yours is quite good: "One way would be to touch off one of the co-ordinate systems to 0,0,0 at home and then it will mirror machine position and you can use that"
Last edit: 02 Sep 2014 17:56 by emcPT.

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

More
02 Sep 2014 17:49 #50625 by Rick G

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

More
02 Sep 2014 17:55 #50626 by emcPT
Yes, my original post was related with that list, so no more relevant information there. Thank you anyway.

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

More
02 Sep 2014 18:59 #50627 by BigJohnT

Hi

I think it is a case of imprecise phraseology

5420-5428
Current Position including all offsets and in the current program units for X, Y, Z, A, B, C, U, V & W, volatile.


5422 returns the current relative position in the active co-ordinate system I believe, so it definately does not return machine position despite
what this says


The description is more precise now :)

JT
The following user(s) said Thank You: ArcEye

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

More
02 Sep 2014 19:10 #50629 by alan_3301
It would take a whole lot of if/thens but how about a subroutine to check #5210 and #5220 to check what offsets are active.
Then subtracting the correct parameter #5211 through #5219 or #5221 through #5390 from #5420 - #5428.

what do you think?
The following user(s) said Thank You: emcPT

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

More
02 Sep 2014 19:12 #50630 by andypugh

I tested using 5022 or 5422, but both return the actual relative position, not the machine position that I am looking for.


A roundabout way to get machine absolute position is to perform a G30.1 then read #5183

www.linuxcnc.org/docs/html/gcode/gcode.html#sec:G30-G30_1
The following user(s) said Thank You: emcPT

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

More
02 Sep 2014 19:39 #50631 by Rick G
I believe Chris used something like this to find X Y when looking for the center of a circle..
G91 G38.3 Z.00001
#1001=#5061
#1002=#5062

Or as Alan suggested if you know what coordinate system you are going to work in work with the parameter and the offset.

Rick G
The following user(s) said Thank You: emcPT

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

More
02 Sep 2014 19:46 #50632 by emcPT

I tested using 5022 or 5422, but both return the actual relative position, not the machine position that I am looking for.


A roundabout way to get machine absolute position is to perform a G30.1 then read #5183

www.linuxcnc.org/docs/html/gcode/gcode.html#sec:G30-G30_1


This was the most straight forward method, so I believe I will use it.
Thank you

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

Time to create page: 0.155 seconds
Powered by Kunena Forum