Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    G30: unexpected probe dive motion range

    Scheduled Pinned Locked Moved
    Beta Firmware
    probe trigger dive height build plate
    3
    11
    546
    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.
    • jp.douarvil 0undefined
      jp.douarvil 0
      last edited by

      Further investigating, I realized that the odd probing stop height was already a thing, however that I hadn't noticed, on RRF3.4. I am fairly confident that this issue is indeed related to the herementioned unexpected behavior. Diving into the origin of the problem, it looks like the odd stop height for the G30 command when the Z axis is already homed is computed differently than for G29 moves.

      1 Reply Last reply Reply Quote 1
      • jp.douarvil 0undefined
        jp.douarvil 0
        last edited by

        Regarding the odd probing start height experienced with RRF3.5 however I haven't found the origin of the issue. But it seems like I am not the only one scratching my head on it. Using large dive height value is a good enough temporary band-aid but doesn't make for very robust/maintainable configuration files in my opinion.

        1 Reply Last reply Reply Quote 1
        • jp.douarvil 0undefined
          jp.douarvil 0
          last edited by jp.douarvil 0

          Below is a bed.g configuration exhibiting the described behavior:

          ; bed.g
          ; called to perform automatic bed tilt correction via G32
          
          M400    ; wait until end of motions
          
          var probTrigHeight = 9.0
          var hoverHeight = 4.0
          var deltaZ = 0.0
          
          M671 X-105:405 Y0:0 S1.5                      ; set position of Z leadscrews
          G29 S2                                        ; disable mesh compensation
          G31 Z{var.probTrigHeight}                     ; set trigger height
          M558 K0 H{var.probTrigHeight-var.hoverHeight} ; set dive height so nozzle never dives below the "hover height" (nozzle crash prevention)
          
          while true
              G30 P0 X10 Y5 Z-99999    ; probe near -X leadscrew
              set var.deltaZ = sensors.probes[0].lastStopHeight
              G30 P1 X290 Y5 Z-99999  ; probe near left leadscrew
              ;set var.deltaZ = {var.deltaZ - (var.deltaZ + sensors.probes[0].lastStopHeight)/2}
              set var.deltaZ = 0.5*(var.deltaZ - sensors.probes[0].lastStopHeight) ; edit: just simplified the assignment above
              
              if {(var.deltaZ < 0.1) || (iterations > 5)}
                  break
          
              ; correct only the bed tilt
              G30 P0 X10.0 Y0.0 Z{var.deltaZ} H0.0
              G30 P1 X290.0 Y0.0 Z{-var.deltaZ} H0.0 S2
          
          M400    ; wait until end of motions
          
          1 Reply Last reply Reply Quote 1
          • jp.douarvil 0undefined
            jp.douarvil 0
            last edited by

            Is the described unexpected behavior unintended or did I misunderstood something about the use of the G30 command.

            I personally like the principle of probing the height range extending from Z = triggerHeight + diveHeight to Z = triggerHeight - diveHeight.
            Given that both the trigger height and dive height are GCODE configurable floats (signed), it makes for very versatile and comprehensive implementation of custom probing moves in bed.g , mesh.g or any other configuration file for that matter.

            Thank you in advance for your help.

            dc42undefined 1 Reply Last reply Reply Quote 1
            • Phaedruxundefined
              Phaedrux Moderator
              last edited by

              I think akismet didn't let all your embeded links.

              Z-Bot CoreXY Build | Thingiverse Profile

              jp.douarvil 0undefined 1 Reply Last reply Reply Quote 0
              • jp.douarvil 0undefined
                jp.douarvil 0 @Phaedrux
                last edited by jp.douarvil 0

                @Phaedrux actually, I tried posting the same message without link at all to no avail. Limiting the length of each message was the only effective solution.

                Below is my attempted workaround:

                ; bed.g
                ; called to perform automatic bed tilt correction via G32
                
                M400    ; wait until end of motions
                
                var probTrigHeight = 9.0
                var hoverHeight = 4.0
                var deltaZ = 0.0
                var zMin = move.axes[2].min
                
                M671 X-105:405 Y0:0 S1.5                      ; set position of Z leadscrews
                G29 S2                                        ; disable mesh compensation
                ;G31 Z{var.probTrigHeight}                     ; set trigger height
                
                ; temporary workaround the dive range non-centered around the trigger height "bug"
                ;;
                M400
                G31 Z0	; reset probe trigger height
                M208 Z0 S1
                G92 Z{move.axes[2].machinePosition - var.probTrigHght}
                ;;
                M558 K0 H{var.probTrigHeight-var.hoverHeight} ; set dive height so nozzle never dives below the "hover height" (nozzle crash prevention)
                
                
                while true
                    G30 P0 X10 Y5 Z-99999    ; probe near -X leadscrew
                    set var.deltaZ = sensors.probes[0].lastStopHeight
                    G30 P1 X290 Y5 Z-99999  ; probe near left leadscrew
                    set var.deltaZ = 0.5*(var.deltaZ - sensors.probes[0].lastStopHeight)
                    
                    if {(var.deltaZ < 0.1) || (iterations > 5)}
                        break
                
                    ; correct only the bed tilt
                    G30 P0 X10.0 Y0.0 Z{var.deltaZ} H0.0
                    G30 P1 X290.0 Y0.0 Z{-var.deltaZ} H0.0 S2
                
                ; temporary workaround the dive range non-centered around the trigger height "bug"
                ;;
                M400
                G31 Z{var.probTrigHght}	; reset probe trigger height
                M208 Z{var.zMin} S1
                G92 Z{move.axes[2].machinePosition + var.probTrigHght}
                ;;
                M400    ; wait until end of motions
                

                It works as expected but as you can tell it makes the code a bit confusing and long (i.e. seed for a difficult to debug spaghetti-code).

                1 Reply Last reply Reply Quote 1
                • dc42undefined
                  dc42 administrators @jp.douarvil 0
                  last edited by

                  @jp-douarvil-0 said in G30: unexpected probe dive motion range:

                  I personally like the principle of probing the height range extending from Z = triggerHeight + diveHeight to Z = triggerHeight - diveHeight.

                  That is the intention of the current code in RRF when the trigger height is not less than zero. Isn't it working that way?

                  Duet WiFi hardware designer and firmware engineer
                  Please do not ask me for Duet support via PM or email, use the forum
                  http://www.escher3d.com, https://miscsolutions.wordpress.com

                  jp.douarvil 0undefined 1 Reply Last reply Reply Quote 0
                  • jp.douarvil 0undefined
                    jp.douarvil 0 @dc42
                    last edited by

                    @dc42 said in G30: unexpected probe dive motion range:

                    @jp-douarvil-0 said in G30: unexpected probe dive motion range:

                    I personally like the principle of probing the height range extending from Z = triggerHeight + diveHeight to Z = triggerHeight - diveHeight.

                    That is the intention of the current code in RRF when the trigger height is not less than zero. Isn't it working that way?

                    Thank you for the feedback.

                    I noticed that in practice the nozzle systematically dive below Z=0. Hence I assume the observed behavior to be a bug.

                    I proposed a patch but I haven't personally compiled and tested the patched firmware. Patch is based on the code for the G29 command.

                    Could this fix the issue? If so it might be nice to patch the 3.4 as well for non-beta testers.

                    dc42undefined 1 Reply Last reply Reply Quote 0
                    • dc42undefined
                      dc42 administrators @jp.douarvil 0
                      last edited by dc42

                      @jp-douarvil-0 said in G30: unexpected probe dive motion range:

                      I noticed that in practice the nozzle systematically dive below Z=0.

                      It will do that if the probe is not triggered. If you set the dive height to some value H then that implies you are uncertain as to the exact height of the bed to within a distance +/-H. So the code starts the dive at (trigger_height + H) and ends it if the probe is not triggered first at (trigger_height - H); except that if the trigger height is negative then we just go from +H to -H.

                      Duet WiFi hardware designer and firmware engineer
                      Please do not ask me for Duet support via PM or email, use the forum
                      http://www.escher3d.com, https://miscsolutions.wordpress.com

                      jp.douarvil 0undefined 1 Reply Last reply Reply Quote 0
                      • jp.douarvil 0undefined
                        jp.douarvil 0 @dc42
                        last edited by jp.douarvil 0

                        My profuse apologies for:

                        • my (very) late answer
                        • digging up this old topic (Halloween trick or treat ?!)

                        but my answer is still relevant (based on the code base of the RRF 3.5.0 rc1 and 3.4.6).

                        @dc42 said in G30: unexpected probe dive motion range:

                        If you set the dive height to some value H [...] the code starts the dive at (trigger_height + H) and ends it if the probe is not triggered first at (trigger_height - H)

                        That is my expectation, but not what the G30 command currently does.

                        You will notice in the code of G30 command the mention of platform.AxisMinimum(Z_AXIS), variable which I can't make sense of:

                        ms.coords[Z_AXIS] = (IsAxisHomed(Z_AXIS)) ? platform.AxisMinimum(Z_AXIS) - zp->GetDiveHeight() + zp->GetActualTriggerHeight()

                        This is in contrast to the probing code of the G29 command, which works as you described without ever using platform.AxisMinimum(Z_AXIS):

                        ms.coords[Z_AXIS] = -zp->GetDiveHeight() + zp->GetActualTriggerHeight();

                        Hence my (old yet still relevant) pull request.

                        Hopefully this patch would not bring any regression, however it might save multiple RRF user from less than desirable unexpected nozzle crashes.

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