QtDragon M6 Remap Tool Measurement - Inconsistent/Wrong Offsets with VersaProbe

More
24 Nov 2025 07:24 #339120 by melayate
I’m setting up automatic tool measurement on a 6-axis CNC mill using QtDragon with VersaProbe and running into calculation errors. The M6 remap executes successfully but produces incorrect/inconsistent tool offsets.
Machine Configuration:
    •    LinuxCNC 2.9.7
    •    GUI: QtDragon 1.4
    •    Interface: Mesa 7i96s Ethernet
    •    Axes: 6-axis (dual X gantry: X1, X2, Y, Z, A, B rotary)
    •    Tool change: Manual (no ATC)
    •    Fixed tool setter at machine coordinates X=397, Y=680, Z=-100mm
    •    Touch plate height: 41.54mm
    •    Actual physical tool length difference: ~22mm
What Works:
✓ M6 remap executes without hanging
✓ Machine moves to tool setter position correctly
✓ Probe successfully touches tool setter
✓ Returns to safe position
✓ tool-prepare-loopback HAL connection working
The Problem:
Tool offsets in the tool table are completely wrong and inconsistent:
Test Run 1:
    •    Tool 1: -29.113mm
    •    Tool 2: -7.077mm
    •    Difference: 22mm ✓ (correct!)
Test Run 2 (same tools, same setup):
    •    Tool 1: 0.070mm
    •    Tool 2: -22.105mm
    •    Difference: 22mm ✓ (correct!)
The relative difference is consistently correct (22mm), but the absolute values shift by 30-50mm between runs. Sometimes offsets are even positive when they should be negative.
My Workflow:
    1.    Home all axes
    2.    Clear all tool offsets (set Z to 0.0)
    3.    Jog tool to table surface, run G10 L20 P1 Z0 (set G54 Z=0)
    4.    Run T1 M6 - measures Tool 1
    5.    Run T2 M6 - measures Tool 2
    6.    Check tool table - offsets are wrongQuestions:
    1.    Should I be using G10 L1 (absolute) or G10 L10 (relative) for tool offset?
    2.    Is capturing #5420 before switching to G91 the correct way to get machine Z position?
    3.    After probing in G91 mode, is #5063 the incremental distance traveled, or does it contain machine coordinates?
    4.    Should the calculation be:
    •    probe_machine_z - probe_height (current), or
    •    tool_setter_Z - probe_machine_z + probe_height, or
    •    Something else entirely?
    1.    I’ve read that some people use Tool 99 as a reference probe - is that required, or should direct tool measurement work?
Related threads I’ve studied:
    •    forum.linuxcnc.org/40-subroutines-and-ngcgui/52490-remap-m6-tool-setter
    •    forum.linuxcnc.org/qtvcp/51138-qtdragonhd-tool-sensor-help-for-a-maker-space
Any help would be greatly appreciated! I can provide additional config files or testing results if needed.
5_axis.ini (VersaProbe section):
[VERSA_TOOLSETTER]
X = 397.000
Y = 680.000
Z = -100
Z_MAX_CLEAR = -50
MAXPROBE = 80

custom_postgui.hal:
net probe-in => qtdragon.led-probe
net tool-change      iocontrol.0.tool-change       => hal_manualtoolchange.change
net tool-changed     iocontrol.0.tool-changed      <= hal_manualtoolchange.changed
net tool-prep-number iocontrol.0.tool-prep-number  => hal_manualtoolchange.number
net tool-prepare-loopback   iocontrol.0.tool-prepare  =>  iocontrol.0.tool-prepared

qt_auto_probe_tool.ngc (key sections):
# Line 54: Clear offset before measurement
G10 L1 P#<tool> Z0

# Lines 56-57: Move to tool setter
G53 G0 X[#<_ini[VERSA_TOOLSETTER]X>] Y[#<_ini[VERSA_TOOLSETTER]Y>]
G53 G0 Z[#<_ini[VERSA_TOOLSETTER]Z>]

# Line 61: Capture starting Z (attempted fix)
#<start_machine_z> = #5420

# Line 63: Switch to incremental mode
G91

# Lines 64-71: First probe (fast)
G38.3 Z- #<_ini[VERSA_TOOLSETTER]MAXPROBE>
G0 Z #<_hal[qtversaprobe.backoffdist]>

# Lines 75-78: Second probe (slow)
G38.3 Z- [#<_hal[qtversaprobe.backoffdist]> *1.2]

# Lines 79-80: Calculate machine Z position
#<probe_distance> = #5063
#<probe_machine_z> = [#<start_machine_z> + #<probe_distance>]

# Line 82: Return to absolute mode
G90

# Line 88: Set tool offset (THIS IS WHERE THE PROBLEM IS)
G10 L1 P#<tool> Z[#<probe_machine_z> - #<_hal[qtversaprobe.probeheight]> + #<_hal[qtversaprobe.blockheight]>]

 

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

More
24 Nov 2025 15:02 #339152 by langdons
The difference in test 1 is -22.036mm.

In test 2 its +22.175mm.

Sign does matter.

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

More
24 Nov 2025 19:15 #339167 by melayate
So sorry that meant around 22mm

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

More
24 Nov 2025 19:51 - 24 Nov 2025 19:54 #339168 by langdons
You should not need to "Clear all tool offsets (set Z to 0.0)"

Isn't that what G53 is for?

Please post .hal and ini files.
Last edit: 24 Nov 2025 19:54 by langdons.

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

More
24 Nov 2025 20:03 - 24 Nov 2025 21:00 #339171 by melayate
attached are my config files. I have been trying for over a week to get the remap to work, I don't know what am I doing wrong. thank you!
Attachments:
Last edit: 24 Nov 2025 21:00 by melayate.
The following user(s) said Thank You: langdons

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

More
25 Nov 2025 00:36 #339176 by langdons
Consider setting the HOME_SEQUENCE value for joint 4 and 5 to 2 so it can be homed with the Y axis.

Are you sure HOME_IGNORE_LIMITS = YES is a good idea?

Seems a bit potentially risky.

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

Moderators: cmorley
Time to create page: 0.120 seconds
Powered by Kunena Forum