Bug in G53 calculation with axis compensation and tool offset
-
Hi there,
When I run
G53
withM579
and a non-zero tool offset the resulting position adds the axes compensation ratio of the tool offset. To demonstrate what I mean, I wrote a little macro:M579 X1.01488 Y1.0067 ; axis compensation T0 P0 ; select first Tool G10 P0 X0 Y0 ; set Tool offset to zero G53 G1 X150 Y150 G4 S2 echo "X:" ^ move.axes[0].machinePosition ^ " Y:" ^ move.axes[1].machinePosition ; X = 150*1.01488 = 152.232 ; Y = 150*1.0067 = 151.005 G10 P0 X-0.5 Y62 ; set Tool offset to non-zero G53 G1 X150 Y150 G4 S2 echo "X:" ^ move.axes[0].machinePosition ^ " Y:" ^ move.axes[1].machinePosition ; X = (-0.5+150)*1.01488 - (-0.5) = 152.225 ; Y = (62+150)*1.0067 - 62 = 151.421
When I run
G53
i would expect the same position even when i change the tool. It is not possible to go the a specific point. When I run the following code, the tool head is colliding with the axes:M564 S0 ; allow movement outside boundaries (i need it sometimes) G53 G1 X{move.axes[0].max} Y{move.axes[1].max}
Specs:
I have a Duet 3MB6HC with two 3HC in standalone mode.
The printer is running in CoreXY-mode (M669 K1
) so i need to use theM579
Command to compensate the axes.
I have multiple tools attached and each of them has its own offset.To strip down my complete configuration i reproduced the bug with the following configuration (using the ConfigTool) :
; Configuration file for Duet 3 MB 6HC (firmware version 3.3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.3.16 on Fri Jun 30 2023 10:21:33 GMT+0200 (Mitteleuropäische Sommerzeit) ; General preferences M80 C"pson" M575 P1 S1 B57600 ; enable support for PanelDue G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"Konus2264" ; set printer name M669 K1 ; select CoreXY mode ; Wait a moment for the CAN expansion boards to start G4 S2 ; Network M552 P0.0.0.0 S1 ; enable network and acquire dynamic address via DHCP M586 P0 S1 ; enable HTTP M586 P1 S1 ; enable FTP M586 P2 S0 ; disable Telnet ; Drives M569 P0.4 S0 ; physical drive 0.4 goes backwards M569 P0.5 S0 ; physical drive 0.5 goes backwards M569 P0.0 S1 ; physical drive 0.0 goes forwards M569 P1.0 S1 ; physical drive 1.0 goes forwards M584 X0.4 Y0.5 Z0.0 E1.0 ; set drive mapping M350 X256 Y256 Z256 E256 I0 ; configure microstepping without interpolation M92 X1280.00 Y1280.00 Z25600.00 E6530.73 ; set steps per mm M566 X3000.00 Y3000.00 Z180.00 E1200.00 ; set maximum instantaneous speed changes (mm/min) M203 X12000.00 Y12000.00 Z300.00 E3000.00 ; set maximum speeds (mm/min) M201 X3000.00 Y3000.00 Z20.00 E10000.00 ; set accelerations (mm/s^2) M906 X800 Y800 Z1200 E1000 I20 ; set motor currents (mA) and motor idle factor in per cent M84 S30 ; Set idle timeout ; Axis Limits M208 X-27 Y-82 Z0 S1 ; set axis minima M208 X325.7 Y312.6 Z370 S0 ; set axis maxima ; Endstops M574 X2 S1 P"!io2.in" ; configure switch-type (e.g. microswitch) endstop for high end on X via pin !io2.in M574 Y2 S1 P"!io1.in" ; configure switch-type (e.g. microswitch) endstop for high end on Y via pin !io1.in M574 Z1 S2 ; configure Z-probe endstop for low end on Z ; Z-Probe M950 S0 C"io7.out" ; create servo pin 0 for BLTouch M558 P9 C"io7.in" H15 F240 T600 ; set Z probe type to bltouch and the dive height + speeds G31 P500 X29.5 Y-2 Z3.5 ; set Z probe trigger value, offset and trigger height M557 X30:285 Y-67:255 S15 ; define mesh grid ; Heaters M308 S0 P"temp0" Y"thermistor" T98801 B4185 ; configure sensor 0 as thermistor on pin temp0 M950 H0 C"out0" T0 ; create bed heater output on out0 and map it to sensor 0 M307 H0 B1 S1.00 ; enable bang-bang mode for the bed heater and set PWM limit M140 H0 ; map heated bed to heater 0 M143 H0 S130 ; set temperature limit for heater 0 to 130C M308 S1 P"1.temp0" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin 1.temp0 M950 H1 C"1.out0" T1 ; create nozzle heater output on 1.out0 and map it to sensor 1 M307 H1 B0 S1.00 ; disable bang-bang mode for heater and set PWM limit M143 H1 S275 ; set temperature limit for heater 1 to 275C ; Fans M950 F0 C"1.out3" Q100 ; create fan 0 on pin 1.out3 and set its frequency M106 P0 C"T0 Heatsink" S1 H1 T70 ; set fan 0 name and value. Thermostatic control is turned on M950 F1 C"1.out6" Q50 ; create fan 1 on pin 1.out6 and set its frequency M106 P1 C"T0 Nozzle" S0 H-1 ; set fan 1 name and value. Thermostatic control is turned off ; Tools M563 P0 S"T0" D0 H1 F2:1 ; define tool 0 G10 P0 X0 Y0 Z0 ; set tool 0 axis offsets G10 P0 R0 S0 ; set initial tool 0 active and standby temperatures to 0C ; Custom settings are not defined ; Miscellaneous M501 ; load saved parameters from non-volatile memory M911 S22 R23 P"M913 X0 Y0 U0 G91 M83 G1 Z0.3 E-5 F1000 G1 Z3" ; set voltage thresholds and actions to run on power loss
Thanks for your time.
-
@shugo1110 thanks for reporting this. I created https://github.com/Duet3D/RepRapFirmware/issues/883.
Which firmware version are you running? If I provide a new firmware binary with a likely fix in it, would you be able to test it?
-
3.5.0-beta.3 on 6MB and 3HC. The problem existed already in earlier firmwares but at that time i couldn't figured out why.
Yes i would able to test it.
Thanks
-
@shugo1110 thanks. Please try the build at https://www.dropbox.com/sh/vxzb68lep3fg9yj/AAAK0vYIrOd2oR7HlotdOPcQa?dl=0. This is based on 3.5.0-beta.4 so you should upgrade your 3HC boards to that version.
-
Sorry for the delay, i had to fix some beta.4-related problems with my configuaration (Led Strip, invalid value for parameter '-')
When I do a
G53 G1 X150 Y150
the position is now independend of the current tool offset. This works fine.Just for reference: The resulting machine-position is not 150 as i expected; it is 150*axis-compensation-factor. In the example in my first post:
... G53 G1 X150 Y150 G4 S2; wait echo "X:" ^ move.axes[0].machinePosition ^ " Y:" ^ move.axes[1].machinePosition ; X:152.232 Y:151.005
I don't know if it's correct, maybe this is a design decision. But when i want to move to the highest edge i have to do a
G53 G1 X{move.axes[0].max/1.01488} Y{move.axes[1].max/1.0067}
Thanks
-
@shugo1110 Thanks for testing and confirming the fix!