# my calculations are off... aparently need help with spacial math...

20 Sep 2023 15:06 #281225
my probing routine for testing tool length:
github.com/travis-farmer/linuxcnc/blob/m...iles/probe-print.ngc
machine is a 48in x 48in x 6in working area (roughly) woodworking CNC router table, with a tool length sensor at Z0, Y0, X0, for now. the distance from the nose of the ATC spindle to the tool sensor, as measured by a probe motion, is -5.303in, and i have stored that value into #<_ini[TOOLSENSOR]SENSOR_SPINDLE>.
what i want is to measure the length of the tool from tip to spindle nose, for storage in my tool table. but a short tool comes out with a longer length than a longer tool. maybe my idea of the tool table is wrong, but shouldn't a longer tool have a longer number?
so i have established that my math is wrong. the formula i use is on line 28 of the ngc routine above.

i tried subtracting the SENSOR_SPINDLE length from the probed length, but that just gave me the difference. so i tried subtracting the SENSOR_SPINDLE length again from the difference trying to invert it, but then i came up with a number that was meaningless...

maybe my constant, SENSOR_SPINDLE, was measured wrong, or is used wrong... my brain just isn't calculating right now...

thanks in advance for any help.

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

20 Sep 2023 17:02 #281235
The first mistake I think I see is that you subtract the value of #5063 from your #<_ini[TOOLSENSOR]SENSOR_SPINDLE>, then subtract the answer of that from #<_ini[TOOLSENSOR]SENSOR_SPINDLE> again. which essentially just puts you back where you started from with the original value of #5063. Also I'm pretty sure all of the numbers you will be looking at are going to be negative numbers, so an offset with a larger absolute value is actually a smaller number.

If you put in a tool that is 1 inch below your spindle nose and you prob it I believe that you should get a value of -4.303 for #5063. If you want your #<probe-val> to = +1 use:
#<probe-val> = [#5063 - #<_ini[TOOLSENSOR]SENSOR_SPINDLE>]
If you want it to = -1 then use
#<probe-val> = [#<_ini[TOOLSENSOR]SENSOR_SPINDLE> - #5063]
The following user(s) said Thank You: travis036

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

06 Oct 2023 18:05 #282456
dealing with github.com/travis-farmer/linuxcnc/blob/m...iles/probe-print.ngc again...
so, here is the issue, something is off in my program. here is my test method after probing in two tools.
i change to one tool, "T1 M6" and move to a location on the material where the tip of the tool just touches the material. i set X, Y, and Z zero at this point. then i change to the second tool, "T2 M6". then "G0 Y0 X0" back over to location, and use jogging on my pendant to slowly lower Z until the tool just touches the material. i expect the Z should now read very close to zero, but it does not. it reads 5 point-something, depending on where i stop jogging.

when probing tools, should i turn tool length compensation on or off? my tool change program adds a "G43" after a change. it seems to me, and i am clueless, but it seems like it is compounding the tool length for some reason.
also, in the tool length offset database, should i be entering the values positive or negative? currently i am entering negative, as that is the value i get probing. i tried changing to a positive value, and it was still off by 5 point-something, only the sign changed.

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

13 Oct 2023 18:21 #282921
disabling tool compensation during probing had no effect. still the result between probes is off by 5 inches, give or take fractions.
i think my method is all wrong...

after homing, i clear the tool-table and reload it (to enter the values to attempt again). i set the Z values to 0.
then i load tool 1, "T1 M6".
then i probe the tool 1, "o<probe-print> call", which loads the above mentioned routine (in last post, link).
the machine probes down, touches off on the tool sensor and pops up a dialog showing the value. i run it two or three times to get a rough average number.
i enter the value, with 3 digits of decimal, including the sign (-) as displayed into the tool table entry for the loaded tool, Z, save and reload.
then i change to tool 2, "T2 M6".
probe that tool as above.

now, i move to a spot over a piece of wood, and zero X and Y to save the spot.
then i use my pendant MPG to slowly (0.001in) jog down Z until the tool tip is near or touching the wood.
the wood is cantilevered over another piece of wood so it has some "give" to it.
i set zero for Z with the loaded tool, 2 in this instance.
then i Z up, and return to 0,0,0 in machine.
i change to tool 1, "T1 M6".
move back to previous location with "G0 X0 Y0".
then i again slowly jog down to the wood. but the reedout says around 5 inches when just touching the wood. should it not read 0 for Z?

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

13 Oct 2023 19:31 #282936 by rmu

#### File Attachment:

File Name: tool_touch_off.ngc
File Size:4 KB
##### Attachments:

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

13 Oct 2023 19:43 #282937
not selling my machine, as said on IRC...
i am just so damn frustrated that something that is supposed to work, doesn't. and it is all because of me. all i want to do is use my machine, but i keep getting stuck by the fact that despite having a 111 tested IQ, i am so very dumb when this thing is involved.
just taking a break before i get so worked up i destroy the machine, or myself. don't know when or if i will come back to it... but it will likely be when i can afford to...
until then, sorry for my annoying existance...

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

13 Oct 2023 20:54 #282939 by rmu
are you sure you enable tool length compensation? (G43)

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

14 Oct 2023 10:52 #282982 by andypugh
I tend to tie myself in knots with this too.
I think that a good starting point would be to decide that your probe has a length of zero. And all other tool lengths are relative to that.

One thing to bear in mind is that the result of a G38,n probe is in the current user coordinate system. I think that this is probably what is throwing off your calculations.

Either note the current G54 (or whatever) coordinate system Z offset from the screen display, or print it out with an MDI (DEBUG, #5223)

You probably also need to check that G92 and G52 are zero too:
linuxcnc.org/docs/stable/html/gcode/over...tml#gcode:parameters

Toggle between machine coordinate and work coordinate view in the GUI, work out what you need to do with the #5223 to convert between them.

Alternatively, switch to a specific coordinate system for all probing, and make sure that it always has offsets of zero (You can do this with G10 L2 linuxcnc.org/docs/stable/html/gcode/g-code.html#gcode:g10-l2 )

Probe the tool sensor with the spindle probe. Set the tool length of the probe to zero, and set the ini value to the current absolute axis position, using the calculation derived above.

Now when you probe the tool sensor with a tool, the tool tip offset relative to the probe tip is the difference between the (absoute) axis position and the ini value.

Now, you can probe your workpiece with the work probe (making sure that the tool length of the probe is always set to zero...) and set the coordinate system to zero, then when you load a measured tool and issue G43 the tool and orobe tip positions should match.

At this point you can also set the work offsets using a tool, as long as you have loaded the tool and issued G43.
The following user(s) said Thank You: travis036

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

14 Oct 2023 14:01 #282992

andypugh post=282982 userid=723I tend to tie myself in knots with this too.
I think that a good starting point would be to decide that your probe has a length of zero. And all other tool lengths are relative to that.

ok, this makes sense. so that is what was ment by using the probe as a reference tool, setting the offset to zero. i previously had a value for it.

One thing to bear in mind is that the result of a G38,n probe is in the current user coordinate system. I think that this is probably what is throwing off your calculations.

Either note the current G54 (or whatever) coordinate system Z offset from the screen display, or print it out with an MDI (DEBUG, #5223)

ok, my routine does work in G59.3 for probing.

You probably also need to check that G92 and G52 are zero too:
linuxcnc.org/docs/stable/html/gcode/over...tml#gcode:parameters

i didn't have this before, but i added a check for it, and it will display a warning for now if #5210 is 1.

Toggle between machine coordinate and work coordinate view in the GUI, work out what you need to do with the #5223 to convert between them.

Alternatively, switch to a specific coordinate system for all probing, and make sure that it always has offsets of zero (You can do this with G10 L2 linuxcnc.org/docs/stable/html/gcode/g-code.html#gcode:g10-l2 )

as said, i the routine probes in G59.3, it also uses "G10 L2 P9 X0 Y0 Z0" to zero offsets. the routine also returns from G59.3 to the previous in use offset coordinate system.

Probe the tool sensor with the spindle probe. Set the tool length of the probe to zero, and set the ini value to the current absolute axis position, using the calculation derived above.

by "spindle probe", do you mean my 3d electronic probe? i understand setting tool length of probe to zero, will do that. then it becomes unclear to me. which INI value? the one that currently contains the spindle-nose to tool sensor absolute value? do i replace it with the absolute value of the Z axis derived from the probe move? maybe this is where i went wrong. i was deriving the offset value for the tool table value calculation from the spindle nose value.

Now when you probe the tool sensor with a tool, the tool tip offset relative to the probe tip is the difference between the (absoute) axis position and the ini value.

seems to support where i think i went wrong.

Now, you can probe your workpiece with the work probe (making sure that the tool length of the probe is always set to zero...) and set the coordinate system to zero, then when you load a measured tool and issue G43 the tool and orobe tip positions should match.

At this point you can also set the work offsets using a tool, as long as you have loaded the tool and issued G43.

ok, seems simple enough. i think i know where i went wrong on my offsets, though to be sure, i await clarification. but it seems like my routine program wasn't so much off in calculations, other than the INI value used. but my method of executing was off, due to my non-understanding of tool offsets.
so i will fix the INI value, remove the Z offset value from the 3d probe, set it to zero, and it will be my reference tool.

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

14 Oct 2023 19:50 #283012
Probing works!!!
i did how i interpreted Andypugh's instructions, and it worked!
now if i zero Z with the 3D probe in the spindle, and change to tool 1, and/or tool 2 (all i loaded in at this time), they all zero right where they are supposed to! it is amazing how well things work, now that i finally understand, even if in a limited sense.

now i just have to tidy a few things up so they are bullet-proof, and it should all work.
The following user(s) said Thank You: tommylight

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

Time to create page: 0.109 seconds