I have a use-case where I want to get the touch-off from a G38 in absolute machine coordinates. The problem that I have is the following: G38 only stores the machine coordinates in the relative current working coordinate system. This might, or might not include the tool offset (TLO), depending i.e. on whether G43 was called after the last Tn M6.
The G38.2 example (https://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g38) cleverly avoids this pitfall by issuing a G49 before the G38.2, which however erases the current TLO. At first I tried to just incorporate the TLO in the formula found in that example, to this extent:
( G53+n Z n G92 Z G92? TLO Z)
#<z_work_offset> = [#[5203 + #5220 * 20] + #5213 * #5210 - #5403]
However, this formula is only correct half the times, depending on whether the TLO Z is also applied (via a G43) or not. For other optional coordinate system offsets, there is a status property (i.e. #5210 for G92/G52, https://linuxcnc.org/docs/html/gcode/overview.html#sub:numbered-parameters) that tell us whether this offset is actually applied.
Unfortunately, as far as I can see, none such parameter is available to announce whether TLO is applied.
I have a use-case where I want to get the touch-off from a
G38in absolute machine coordinates. The problem that I have is the following:G38only stores the machine coordinates in the relative current working coordinate system. This might, or might not include the tool offset (TLO), depending i.e. on whetherG43was called after the lastTn M6.The
G38.2example (https://linuxcnc.org/docs/html/gcode/g-code.html#gcode:g38) cleverly avoids this pitfall by issuing aG49before theG38.2, which however erases the current TLO. At first I tried to just incorporate the TLO in the formula found in that example, to this extent:However, this formula is only correct half the times, depending on whether the TLO Z is also applied (via a
G43) or not. For other optional coordinate system offsets, there is a status property (i.e.#5210forG92/G52, https://linuxcnc.org/docs/html/gcode/overview.html#sub:numbered-parameters) that tell us whether this offset is actually applied.Unfortunately, as far as I can see, none such parameter is available to announce whether TLO is applied.