Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    G29 Mesh Level: Pass / Fail Tolerance

    Gcode meta commands
    5
    10
    154
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CCS86
      CCS86 last edited by

      I think it would be very useful to add a parameter to the G29 command which allows a maximum threshold for either:

      • Maximum deviations
      • Mean error
      • RMS error

      Once you have characterized your bed, you could add some threshold above these deviations that you are comfortable with / seem realistic. If the G29 returns values that exceed these defined values, it would return a failed result and stop the printer.

      I just had an odd case where I got a few errant points that are way out of my expected flatness. This caused the nozzle to drag badly on the bed. A G29 threshold could have prevented this.

      52938dfe-e43a-4e5a-b9fa-9231014e56ac-image.png

      moth4017 OwenD 2 Replies Last reply Reply Quote 1
      • moth4017
        moth4017 @CCS86 last edited by moth4017

        @CCS86 i do the deviation check in the bed.g G32

        ;G32  Auto calibration routine for large bed
        M561                    ; clear any 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
        M98 P"/macros/ProbePickUp"	; probe pick up
        
        ; Probe the bed and do auto calibration
        ;G1 X149.5 Y179.5 Z30 F6000        ; go to just above the first probe point
        ;G30 P0 X152.5 Y152.5 S-2
        G28 Z
        ;echo sensors.probes[0].lastStopHeight , "REF center probe"
        
        while true
          if iterations = 5
            abort "Too many auto calibration attempts"
          G30 P0 X5 Y5 Z-99999               ; probe starboard bow 
          echo sensors.probes[0].lastStopHeight, "P0"
          if result != 0
            continue
          G30 P1 X305 Y5 Z-99999             ; probe port bow
          echo  sensors.probes[0].lastStopHeight, "P1"
          if result != 0
           continue
          ;G30 P2 X305 Y276 Z-99999          ; probe port stern
         ; echo  sensors.probes[0].lastStopHeight, "P2"
          ;if result != 0
          ; continue
          G30 P2 X152.5 Y276 Z-99999  s3           ; probe port bow
          echo  sensors.probes[0].lastStopHeight, "P3"
          if result != 0
           continue
          if move.calibration.initial.deviation <= 0.02
           break
          echo "Repeating calibration because deviation is too high (" ^ move.calibration.initial.deviation ^ "mm)"
        ; end loop
        echo "Auto calibration successful, deviation", move.calibration.final.deviation ^ "mm"
        M558 F200
        ;G1 F6000 X152.5 Y152.5				; probe to center bed 	
        echo" center probe"
        ;G30 P0 X152.5 Y152.5 S-2								;single probe
        ;echo  sensors.probes[0].lastStopHeight 
        G28 Z
        M98 P"/macros/ProbeDropOff"	; probe drop off
        M558 F600
        G1 Z30 F10000                ; get the head out of the way
        

        and just use the mesh.g file G29 for fine tuning

        <

        1 Reply Last reply Reply Quote 2
        • OwenD
          OwenD @CCS86 last edited by

          @CCS86
          I think that would be valid option, so +1 from me.
          You can achieve it using the object model, after you load the mesh.
          A macro like this should work.
          You'd have to tune to suit what is correct for you, but you'd have to do that with a firmware option as well.

          ;macro to check bed mesh deviation
          var abortNoMeshLoaded = true ; options true/false - choose whether to abort print if no mesh loaded, or just exit macro
          var RMSdeviationLimit = 0.05 ; or whatever you want (use positive values)
          var meanLimit = 0.003 ; or whatever you want (use positive values)
          
          if var.RMSdeviationLimit < 0 || var.meanLimit < 0
             abort "RTFM - limits set must be positve numbers"
          
          if move.compensation.file = null
             if var.abortNoMeshLoaded = true
                abort "No mesh loaded. Print cancelled"
             else
                echo "No mesh loaded.  Print will have no compensaton applied"
                M99
          
          echo "checking validity of mesh: " ^ move.compensation.file
          echo "Mean limit =", var.meanLimit, "RMS limit =", var.RMSdeviationLimit
          
          var meshMean = move.compensation.meshDeviation.mean
          var meshRMS = move.compensation.meshDeviation.deviation
          
          echo "Mesh mean =", var.meshMean, "Mesh RMS =", var.meshRMS
           
          if abs(var.meshRMS) > var.RMSdeviationLimit ; absolute value used to account for negative values in mesh
             abort "Mesh RMS deviation limit exceeded. Print aborted"
          if abs(var.meshMean) > var.meanLimit ; absolute value used to account for negative values in mesh
             abort "Mesh mean deviation exceeded.  Print aborted"
          
          echo "Mesh is within limits"
          
          o_lampe 1 Reply Last reply Reply Quote 3
          • CCS86
            CCS86 last edited by

            Thank you, both of you guys, for sharing your work. Much appreciated!

            @OwenD that is a very efficient macro that does exactly what I was looking for. I need to work on my object model knowledge.

            1 Reply Last reply Reply Quote 0
            • o_lampe
              o_lampe @OwenD last edited by

              @OwenD It would be cool, if this check would happen before the old heightmap was overwritten.
              Or if bed.g would create a backup of the current heightmap before probing.

              Forgive me if that is already happening, I don't know for sure what's the latest and greatest

              OwenD CCS86 2 Replies Last reply Reply Quote 1
              • OwenD
                OwenD @o_lampe last edited by

                @o_lampe said in G29 Mesh Level: Pass / Fail Tolerance:

                @OwenD It would be cool, if this check would happen before the old heightmap was overwritten.

                That could only be done in the firmware

                Or if bed.g would create a backup of the current heightmap before probing.

                You could do this by using M374
                More likely in mesh.g than bed.g

                G29 S1 ; load heightmap
                M374 P"heightmap.bak" ; create backup
                
                ;do rest of probing
                
                1 Reply Last reply Reply Quote 1
                • Moved from Firmware wishlist by  Phaedrux Phaedrux 
                • CCS86
                  CCS86 @o_lampe last edited by

                  @o_lampe said in G29 Mesh Level: Pass / Fail Tolerance:

                  @OwenD It would be cool, if this check would happen before the old heightmap was overwritten.
                  Or if bed.g would create a backup of the current heightmap before probing.

                  Forgive me if that is already happening, I don't know for sure what's the latest and greatest

                  I think this is a good reason to implement in the firmware vs the macro approach.

                  1 Reply Last reply Reply Quote 0
                  • Phaedrux
                    Phaedrux Moderator last edited by

                    With flash space so tight on the older boards new features would have to be pretty unique. When something can be achieved with conditional gcode and a macro instead that's a pretty tough sell.

                    Z-Bot CoreXY Build | Thingiverse Profile

                    o_lampe 1 Reply Last reply Reply Quote 1
                    • o_lampe
                      o_lampe @Phaedrux last edited by o_lampe

                      @Phaedrux The code to backup a file before editing is already implemented for config.g. It's probably not a big step to implement it for other files, too?
                      I've manually backup'd the heightmap a few times. Not a big deal either.

                      Phaedrux 1 Reply Last reply Reply Quote 1
                      • Phaedrux
                        Phaedrux Moderator @o_lampe last edited by

                        @o_lampe I'll bring it up.

                        Z-Bot CoreXY Build | Thingiverse Profile

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA