- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- my calculations are off... aparently need help with spacial math...
my calculations are off... aparently need help with spacial math...
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.
- Todd Zuercher
-
- Away
- Platinum Member
-
- Posts: 5000
- Thank you received: 1409
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]
Please Log in or Create an account to join the conversation.
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.
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.
Attachments:
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
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.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, my routine does work in G59.3 for probing.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)
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.You probably also need to check that G92 and G52 are zero too:
linuxcnc.org/docs/stable/html/gcode/over...tml#gcode:parameters
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.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 )
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.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.
seems to support where i think i went wrong.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.
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.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.
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.
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.
![;-) ;-)](/media/kunena/emoticons/wink.png)
now i just have to tidy a few things up so they are bullet-proof, and it should all work.
![:-) :-)](/media/kunena/emoticons/smile.png)
Please Log in or Create an account to join the conversation.
- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- my calculations are off... aparently need help with spacial math...