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

    Inverting heightmaps (z endstop & probe in opposite directions)

    Scheduled Pinned Locked Moved
    General Discussion
    2
    3
    134
    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.
    • mynameisdevundefined
      mynameisdev
      last edited by

      Hey folks,

      The machine I am working on at the moment has an unusual Z axis configuration where the ABL probe and Z end stop are at opposite ends of the tool's travel. That is, Z homes away from the work bed and drives towards the work bed to take ABL probe measurements.

      I tried a few different combinations of axis direction and end stop position to get this to work but always ended up with the probing and homing direction being the same (and smushing the tool head into the end stop or the work).

      Currently, I have a work around where:

      • Z-axis is homed
      • Flip the Z-axis direction
      • Do the ABL probe pass
      • Save the result
      • Flip the Z-axis back again

      Which produces a good looking height map and CSV.

      For reference - here's what that looks like:

      M561											;remove any existing ABL profile
      
      ;Make sure the Z axis is the right way around (Z+ tward the canvas)
      M569 P121.0 S1                               	; reset physical drive 121.0 goes forwards - Z
      M584 X0.1:0.2 Y0.3 Z121.0 E122.0             	; set drive mapping Xbot MB0-Driver0, Xtop MB0-Driver1, Y MB0-Driver2, Z TB121-Driver0, Extruder TB122-Driver0
      M208 X0 Y0 Z0 S1                             	; set axis minima
      M208 X4800 Y3300 Z100 S0                     	; set axis maxima
      G28                                             ;home all axes
                                        
      G1 Z25                                          ;move Z to be closer to the canvas so it doesn't bash against the end stop
      
      ;Reverse the Z axis for bed levelling
      M569 P121.0 S0                               	; reverse direction of Z drive motor
      M584 X0.1:0.2 Y0.3 Z121.0 E122.0             	; set drive mapping Xbot MB0-Driver0, Xtop MB0-Driver1, Y MB0-Driver2, Z TB121-Driver0, Extruder TB122-Driver0
              
      ;Z+ is now AWAY from the canvas and Z- is TOWARD the Canvas
      
      ; Z-Probe config
      M558 P8 C"121.io0.in" H20 F1500:800 T40000      ; set Z probe type to unfiltered active high and the dive height + speeds
      G31 P500 X0 Y10 Z3                          	; set Z probe trigger value, offset and trigger height
      
      ;M557 X20:4650 Y120:3190 S310                    ; define mesh grid - full canvas
      M557 X20:4680 Y100:3100 P21:21	
      ;M557 X20:4650 Y120:3190 S310                    ; define mesh grid - full canvas
      
      ;Do the probing
      G29 S0											; do bed levelling - save to SD card
      
      ;Reset the Z axis
      M569 P121.0 S1                               	; reset physical drive 121.0 goes forwards - Z
      M584 X0.1:0.2 Y0.3 Z121.0 E122.0             	; set drive mapping Xbot MB0-Driver0, Xtop MB0-Driver1, Y MB0-Driver2, Z TB121-Driver0, Extruder TB122-Driver0
      M208 X0 Y0 Z0 S1                             	; set axis minima
      M208 X4800 Y3300 Z100 S0                     	; set axis maxima
      

      The height map which is produced by this process is also flipped, so I am currently downloading the CSV, multiplying all the height values by -1 and reuploading the 'inverted' file. This fully works - and I can see the Z axis moving around and taking the height variations into account while it travels.

      Is there a way I can have the duet invert all the values for me when it takes the readings, or invert the mesh when calculating the bed levelling so I don't have to do that step manually? I have seen there's an invert tick box in the mesh viewer in DWC but this only seems to flip the view of the mesh in the browser rather than how its actually applied.

      Alternatively, is there some configuration option I have missed which would allow for the probe and end stop to be at opposite ends of the Z-axis travel and forgo all these shenanigans in the first place?

      Any pointers much appreciated,
      Cheers,
      D

      gloomyandyundefined 1 Reply Last reply Reply Quote 0
      • gloomyandyundefined
        gloomyandy @mynameisdev
        last edited by

        @mynameisdev Is there a reason why you can't just home towards the bed and use the probe for homing? If you are going to use a mesh then having both it and the home position produced using the probe pretty much always produces the best results.

        If for some reason that will not work for you then you should be able to simply set your Z endstop to be a high end stop rather than a low end one (using M574 Z2) and then home away from the bed. You will however then need to make sure that you have set your Z size in M208 correctly otherwise the mesh position will be incorrect.

        mynameisdevundefined 1 Reply Last reply Reply Quote 0
        • mynameisdevundefined
          mynameisdev @gloomyandy
          last edited by

          @gloomyandy Due to the design of the tool holder, the probe and the tool (paint brush) can't be fitted at the same time. We have to swap one in, do the ABL measurements, and then put the brush back in again.

          I'll take a look at changing the endstop configuration from low to high and let you know how it goes -

          Thanks for the top!
          Best,
          D

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