Inverting heightmaps (z endstop & probe in opposite directions)
-
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 -
@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.
-
@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