G30Auto-Tilt creates hidden Z-offset-Duet 3-3.0RC2, DSF1.2



  • Hello Again!

    New bug, I believe there's something goofy going on whenever I use triple-z motor leveling that's adding in a hidden 5mm offset that my machine doesn't "see" anywhere but yet means I can't get a print to adhere on the bed as it starts printing ~5mm or so in midair.

    To start off, I have a similar setup (without G30) on a machine running a Duet 2, (so not a duet 3) nor is it running RRF 3.0. But otherwise, I'm familiar with Z-probe setup with a BLtouch. I've determined my z-offset and confirmed that it works by probing Z, and using G1 Z0 to check that the nozzle is properly positioned. I'm confident that it is performing correctly - I'm able to get very representative mesh outputs from it (I use a 3/8" piece of mic6 and It produces a mesh that aligns with those specs) So at this time I assume my probe isn't the problem. You can take a look at the config and tell me I'm wrong, but I'm very confident I've set it up correctly.

    As best I can tell, this only happens when I use the bed tramming feature (G30 S3; for calibrating with 3 lead screws, are defined in config.g) after probing my 3 points. I do not have this issue when I use mesh calibration by itself or just skip calling G32 in general. As you can see in my configs below, I run both a Re-home (Just incase my G30 made a new dumb offset or something) and clear prior meshes.

    When I run the 3 auto-tramming points and then tell it to fix itself, it will give me a reasonable deviation and then correct the bed. Subsequent re-trials result in very small corrections that are significantly smaller. If I re-home and run mesh calibration, the chart looks pretty good, reporting an RMS deviation of .054mm centering roughly around 0mm (which would make sense!) but the print still starts 5+mm off the bed while reporting that its at .3mm!

    Config.g:

    ; Configuration file for Duet 3 (firmware version 3)
    ; executed by the firmware on start-up
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.4 on Thu Dec 26 2019 17:05:21 GMT-0600 (Central Standard Time)
    
    ; General preferences
    G90                                          ; send absolute coordinates...
    M83                                          ; ...but relative extruder moves
    M550 P"StableBot"                               ; set printer name
    
    M667 S1                                      ; select CoreXY mode
    
    ; Drives
    M569 P0.1 S1                                 ; physical drive 0.1 goes forwards
    M569 P0.0 S1                                 ; physical drive 0.0 goes forwards
    M569 P0.2 S0                                 ; physical drive 0.2 goes forwards
    M569 P0.3 S1				     ; physical drive 0.3 goes backwards
    M569 P0.4 S1				     ; physical drive 0.4 goes backwards
    M569 P0.5 S0                                 ; physical drive 0.5 goes backwards
    M584 X0.1 Y0.0 Z0.3:4:5 E0.2                     ; set drive mapping
    M350 X16 Y16 E16 I1                      ; configure microstepping with interpolation
    M350 Z16 I0				; No interpolation on Z Axis
    M92 X160.00 Y160.00 Z1600.00 E409.00         ; set steps per mm
    M566 X900.00 Y900.00 Z9.00 E120.00          ; set maximum instantaneous speed changes (mm/min)
    M203 X18000.00 Y18000.00 Z600 E3000.00    ; set maximum speeds (mm/min)
    M201 X1000.00 Y1000.00 Z16.00 E250.00        ; set accelerations (mm/s^2)
    M906 X1800 Y1800 Z1800 E1100 I30             ; set motor currents (mA) and motor idle factor in per cent
    M84 S30                                      ; Set idle timeout
    
    ; Axis Limits
    M208 X0 Y0 Z0 S1                             ; set axis minima
    M208 X622 Y622 Z950 S0                       ; set axis maxima
    M671 X272.0:-44.45:666.45 Y688:180:180 S10 ; leadscrews at rear middle, front left+right
    
    ; Endstops
    M574 X1 S1 P"!io2.in"                         ; configure active-low endstop for low end on X via pin io2.in
    M574 Y1 S1 P"!io0.in"                         ; configure active-low endstop for low end on Y via pin io0.in
    ;M574 Y2 S1 P"!io1.in"			      ; configure active-low 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" H10 F120 T3600      ; set Z probe type to bltouch and the dive height + speeds
    G31 P500 X5 Y48 Z3.354                        ; set Z probe trigger value, offset and trigger height
    ;M557 X15:600 Y15:600 S30                     ; define mesh grid - Whole Bed
    M557 X220:400 Y220:400 S50                     ; define mesh grid - Center Small
    
    ; Heaters
    M308 S0 P"temp0" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp0
    M308 S0 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 0 as thermistor on pin temp1
    M950 H0 C"out1" T0                           ; create bed heater output on out1 and map it to sensor 0
    M140 H0						;make this the bed heater
    M143 H0 S120                                 ; set temperature limit for heater 0 to 120C
    M307 H0 A133.1 C1828.2 D2.6 V12.3 B0		; Set Heater Config
    M140 H0                                      ; map heated bed to heater 0
    M308 S1 P"temp2" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor on pin temp2
    M950 H1 C"out2" T1                           ; create nozzle heater output on out2 and map it to sensor 1
    M143 H1 S280                                 ; set temperature limit for heater 1 to 280C
    M307 H1 B0 S1.00                             ; disable bang-bang mode for the nozzle heater and set PWM limit
    
    ; Fans
    M950 F0 C"out7" Q500                         ; create fan 0 on pin out7 and set its frequency
    M106 P0 S0 H-1                               ; set fan 0 value. Thermostatic control is turned off
    M950 F1 C"out8" Q500                         ; create fan 1 on pin out8 and set its frequency
    M106 P1 S1 H1 T45                            ; set fan 1 value. Thermostatic control is turned on
    
    ; Tools
    M563 P0 D0 H1 F0                             ; 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
    
    

    Bed.G -

    ; bed.g
    ; called to perform automatic bed compensation via G32
    ;
    ; generated by RepRapFirmware Configuration Tool v2.1.4 on Thu Dec 26 2019 17:05:21 GMT-0600 (Central Standard Time)
    M561 ; clear any bed transform
    M558 P9 C"io7.in" H10 F120 T3600 S.05 A2 ; Ensure that Dive Height is safe for Bed Tramming
    G1 X270 Y570 F7200 ; Move Fast to next spot
    G30 P0 X270 Y580 Z-99999 ; probe near a leadscrew
    G1 X10 Y136 F7200 ; Move Fast to next spot
    G30 P1 X0 Y136 Z-99999 ; probe near a leadscrew
    G1 X560 Y136 F7200 ; Move Fast to next spot
    G30 P2 X580 Y136 Z-99999 S3 ; probe near a leadscrew and calibrate 3 from the 3 motors
    M558 P9 C"io7.in" H5 F120 T3600 ;Sets Smaller Dive Height for Mesh Calibration (SPEED, have tried disabling this just in case this isn't a good use of it)
    G1 X322 Y322 F7200  ; recenter fast
    G28 Z	; Rehome Z | Diagnostic to see if G30 motor calibration was "overcorrecting"
    M561 ; clear any bed transform | Diagnostic to see if G30 motor calibration was "overcorrecting"
    G29  ; probe the bed and enable compensation | Have tried with this disabled
    
    

    Starting Gcode from File

    M104 S215 ; Set nozzle temperature
    M140 S60 ; Set bed temperature
    G28 ; Home 
    M190 S60 ; Ensure bed has reached temperature
    G21 ;metric values
    G90 ;absolute positioning
    M82 ;set extruder to absolute mode
    G92 E0 ;zero the extruded length
    G1 F200 E7 ;extrude 3mm of feed stock
    G92 E0 ;zero the extruded length again
    G32;
    M109 S215 ; Ensure nozzle has reached temperature
    
    ; PATHIO: Pathio necessary settings
    G21 ;Set printer to use mm
    G92 E0 ;Set Extrude to 0
    G90 ; Set absolute positioning
    M83 ;Set extruder to relative mode
    M200 D0 ;Set printer to treat E as mm, not mm^3)
    
    ; PATHIO: New layer
    ; layer 1, Z = 0.300000
    G92 E0.00 ; Set the current filament position to E=0.00
    G1 E-0.25 F3600 ; Retract
    M106 P0 S255 ; Fans turned to 100% of the maximum speed.
    ; PATHIO: Starting new track
    ; tool H0.300000 W0.480000
    ; skirt
    ; indexLimit: 41
    G1 X321.89 Y296.08 Z0.30 F7680 ; Travel
    G1 E0.25  F3600 ; Unretract
    G1 X322.75 Y296.32 Z0.30 E0.0535 F2400
    G1 X323.56 Y296.70 E0.0535
    

    Thanks for reading!



  • @Luke-sLaboratory
    Update:
    Tested out on a non-print using the G30 Bed Tilt -

    It definitely adds 5mm invisibly somewhere.

    I just ran these commands:

    M561 ; clear any bed transform
    M558 P9 C"io7.in" H10 F120 T3600 S.05 A2 ; Ensure that Dive Height is safe for Bed Tramming
    G1 X270 Y570 F7200 ; Move Fast to next spot
    G30 P0 X270 Y580 Z-99999 ; probe near a leadscrew
    G1 X10 Y136 F7200 ; Move Fast to next spot
    G30 P1 X0 Y136 Z-99999 ; probe near a leadscrew
    G1 X560 Y136 F7200 ; Move Fast to next spot
    G30 P2 X580 Y136 Z-99999 S3 ; probe near a leadscrew and calibrate 3 from the 3 motors
    M558 P9 C"io7.in" H5 F120 T3600 ;Sets Smaller Dive Height for Mesh Calibration (SPEED, have tried disabling this just in case this isn't a good use of it)
    G1 X322 Y322 F7200  ; recenter fast
    G28 Z	; Rehome Z | Diagnostic to see if G30 motor calibration was "overcorrecting"
    

    And when I sent G1 Z0, there was still 5mm of gap between where the machine thought it was 0 and the actual bed.

    Looks like there's something goofy afoot!



  • Alright -

    To prove I'm not insane, I took a video that shows in its entirety the process I'm doing and the error I'm seeing. It shows that before I use any kind of adjustment, The z-axis homes and G1 Z0 takes the nozzle right to where it should be. However - Once I use G30 OR G29 (I just show G30 S3 in the video) I get a hidden Z-offset that the machine has NO idea what to do with, even after rehoming, not only with G28Z (calling Homez.g) but also a regular G28 that homes all axes.
    VIDEO
    https://youtu.be/tdWajc_Q3ks

    Thank you!



  • I'm having problems as well, maybe not exactly like yours but similar.
    What's your homez.g file look like?



  • @gtj0 in that video it was just a simple drop bed->probe center

    G91                  ; relative positioning
    G1 H2 Z5 F3600       ; lift Z relative to current position
    G90                  ; absolute positioning
    G30 X322 Y322                   ; home Z by probing the bed 
    

    Reviewing the tape looks like its been ignoring my instructions to go to center
    Still goofy as heck!



  • The only thing I noticed in your config was that the Z "jerk" (M566) was really low (9.00) when it should probably be between 300 and 600. That would only really affect height map correction though.

    I do have something for you to try...

    It's almost as though the G1 Z0 in your macro is resetting the internal position but the move isn't actually being executed. Here's a few things to try...

    • Start with a reset so the axes aren't homed
    • Don't do a bed levelling
    • Remove the X322 and Y322 from the G30 command in your homez.g
    • Add a M400 and G1 Z0 (in that order) to the end of your homez.g
    • Move Z away from the nozzle with a G91 ; G1 Z5 ; G90 (just in case)
    • Home XY
    • Move XY to the center G1 X322 Y322
    • Just do a home Z without your macro
    • See what happens


  • @gtj0 Yep - as you can see I'm still fussing with my Z-axis motion so I keep jerk low to ensure I'm not causing other issues.

    I'll give it a shot when I have my machine back together - parts arrive this afternoon to get rid of that wobble/Noise

    It will be noted that when I home at any time (with Homeall OR homeZ) before any compensation it homes perfectly and G1 Z0 will correctly move my nozzle to the correct height. Once correction is run, I need a full reboot.

    Thank you!



  • M566 Z9 is in mm/min, which is 0.15 mm/s which might actually be causing you more issues than you're trying to prevent because any time you try to perform a coordinated move with the Z axis it will slow to a crawl at the start of the move.

    I'd suggest a minimum of M566 Z60 which is 1mm/s.

    Not saying it's related to your current issue, but it could manifest itself in other odd behaviour.



  • @Phaedrux
    Default config gave me 12mm/min, If cutting defaults by 25% were to cause other issues, that's just weird.

    I'm confident once I get my mechanics figured out (been swapping parts most of my afternoon) i'll increase everything as much as possible, but I took a modest reduction from defaults given by reprapconfig tool.
    As an addendum - the machine prints correctly, but ONLY if i haven't used G29 or G30. G29 I could see maybe having something to do with it not allowing such small changes very quickly (like off of a very crazy mesh) but G30 lead screw compensation doesn't introduce any of those issues.

    Once i get my machine back together, I'll try out out your and gtj0's suggestions.



  • @Luke-sLaboratory said in G30Auto-Tilt creates hidden Z-offset-Duet 3-3.0RC2, DSF1.2:

    Default config gave me 12mm/min

    The default is set purposely low to prevent any damage since it has no idea what your Z axis configuration is like, so it's already being ultra conservative on your behalf. It's up to you to tune the machine with reasonable values, as I'm sure you will.

    Mesh compensation is one case where low Z axis jerk causes issues because the Z axis needs to respond to changes in height in a coordinated manner with the X and Y axis. This usually presents as stuttering X and Y motion as it pauses to let the Z axis catch up. This will depend a lot on your first layer print speed and X Y jerk and acceleration as well.

    There is likely other things at play though with the mesh compensation issue. Without seeing more details I couldn't say what. RRF3 is still in its infancy, so there could be a bug, or it could be configuration issues, or both.



  • @gtj0 @Phaedrux

    I've updated my config with a higher M566 value (60) and I've done the simpler Z-levelling procedure proposed by gtj0.

    If I don't do any sort of bed adjustment/mesh, I don't have any issues. His procedure works exactly as expected, Z0 is actually Z0. I then did the exact same thing, just with using bed compensation (auto-tilt), got rid of the scripted G28 Z and did a manual rehome, with the same G1 X322 Y322 and G28 Z from console, and got the same offset.

    I firmly believe this is some kind of bug somewhere.



  • @Luke-sLaboratory said in G30Auto-Tilt creates hidden Z-offset-Duet 3-3.0RC2, DSF1.2:

    @gtj0 @Phaedrux

    I've updated my config with a higher M566 value (60) and I've done the simpler Z-levelling procedure proposed by gtj0.

    If I don't do any sort of bed adjustment/mesh, I don't have any issues. His procedure works exactly as expected, Z0 is actually Z0. I then did the exact same thing, just with using bed compensation (auto-tilt), got rid of the scripted G28 Z and did a manual rehome, with the same G1 X322 Y322 and G28 Z from console, and got the same offset.

    I firmly believe this is some kind of bug somewhere.

    This is going to be way overkill, but try adding an M400 after every command in bed.g, homez.g and any other .g file involved except config.g. I'm trying to see if there is a code buffering problem where codes are not executed fully or executed out of order. Both have been issues in the past.



  • @gtj0
    Ok will report back once my print is finished.



  • @gtj0
    Tried it - Same result. Put a M400 in erry macro, command, etc I could think of. My print executed perfectly.



  • @Luke-sLaboratory said in G30Auto-Tilt creates hidden Z-offset-Duet 3-3.0RC2, DSF1.2:

    @gtj0
    Tried it - Same result. Put a M400 in erry macro, command, etc I could think of. My print executed perfectly.

    Hmmm. I may have lost track somewhere.... Under exactly what conditions did it work perfectly?
    With the addition of the M400s in your original macros/process that did cause the offset, did you get the 5mm offset?

    The purpose of the M400 is to cause the firmware to wait before the previous moves are done before proceeding to the next command. I was hoping that adding the M400s would fix any issues with the buffered commands not being executed correctly.



  • @gtj0

    Sorry for lack of clarity.

    There was zero change in the behavior I was describing. I still experience the hidden offset when I use the bed levelling features, even with M400 after every line in any positioning macro, custom or default.

    If I do not use the bed-levelling features, My printer performs flawlessly and creates excellent prints, and my homing procedure (both homeZ & Homeall) functions correctly.



  • Weird. The only difference between your process and mine is that your bed levelling starts at the middle rear and runs counter-clockwise. Just for the fun of it, what happens if you start at the front left and go clockwise?



  • @gtj0
    I'll give it a shot. As a comment, this also happens when I use g29 for mesh levelling as well, it's not confined to just g30.

    Hopefully something works soon!



  • @gtj0

    Alright - Just tried out the switch - still no dice. The reported Z0 even after i do a full G28 rehome still floats wayyyy above the real 0. However, I reset the board (not a power cycle, just the reset button) rehomed, and the offset went away and its currently printing a perfectly adhered print.

    This is honestly pretty frustrating 😕



  • @gtj0 More Shenanigans, still really stuck where to go with this.

    I am now using 3.01 beta, and have copied over a 4-point conditional levelling loop from @kraegar to take my hands out of it.

    ; bed.g
    ; called to perform automatic bed compensation via G32
    
    M561                         ; clear any existing bed transform
    ; If the printer hasn't been homed, home it
    if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed
      G28
      
    M558 P9 C"io7.in" H15 F240 T6000 S.05 A1 ; Ensure that Dive Height is safe for Bed Tramming
    
    ;Run initial 4 point leveling routine
    G30 P0 X30 Y30 Z-99999
    G30 P1 X30 Y540 Z-99999
    G30 P2 X480 Y540 Z-99999
    G30 P3 X480 Y30 Z-99999 S3
    
    
    
    while true
      if iterations = 5
        abort "Too many auto calibration attempts"
      if move.initialDeviation.deviation < 0.01 
        if move.calibrationDeviation.deviation < move.initialDeviation.deviation + 0.005
          if move.calibrationDeviation.deviation > move.initialDeviation.deviation - 0.005
            break
      echo "Repeating calibration because initial deviation (" ^ move.initialDeviation.deviation ^ "mm) must be < 0.01"
      echo "and (" ^ move.calibrationDeviation.deviation ^ "mm) must be within 0.005 of initialDeviation"
    
      M558 P9 C"io7.in" H5 F180 T6000 S.05 A2
      G30 P0 X30 Y30 Z-99999
      G30 P1 X30 Y540 Z-99999
      G30 P2 X480 Y540 Z-99999
      G30 P3 X480 Y30 Z-99999 S3
    
    echo "Auto calibration successful, deviation", move.calibrationDeviation.deviation ^ "mm"
    echo "Auto calibration successful, initialDeviation", move.initialDeviation.deviation ^ "mm"  
        
    G28
    
    

    However - it completely ignores the loop, does the two iterations, doesn't echo anything, and then re-homes.
    I'll ignore that part of it for now.

    Here's the readout from the two iterations:

    1/18/2020, 10:45:28 AM	Leadscrew adjustments made: -0.060 -0.043 -0.002, points used 4, (mean, deviation) before (-0.033, 0.171) after (0.000, 0.170)
    1/18/2020, 10:44:30 AM	Leadscrew adjustments made: 2.184 2.030 1.998, points used 4, (mean, deviation) before (2.051, 0.174) after (-0.000, 0.152)
    

    The key takeway i think here, however, that while the first iteration shows that its level, the bed thinks that its ~2mm off on ALL axes, then corrects for it. The second iteration has the same deviation from the mean, but is VERY close to this new mean.

    When then G28 completely rehome (using the same damn probe), it floats this ~2mm above the middle, which i proved out by manually disabling limits and moving the bed up in .05mm increments till it touched the nozzle. I think this has to be something derpy in the firmware somewhere as part of the self-calibration routine. This is AFTER I nuked the pi and re-did the image, so Now i'm going to use the erase feature on the duet 3 and try with 100000000% fresh firmware there as well.

    anything else anyone can think of, let me know. I'm stumped.


Log in to reply