Fix bilinear ABL grid_start probe/nozzle coordinate mixup - #28380
Fix bilinear ABL grid_start probe/nozzle coordinate mixup#28380PenguinAkiko wants to merge 6 commits into
Conversation
The variable abl.probe_position_lf is in probe-space, but bedlevel.grid_start is consumed as a nozzle-space origin for mesh interpolation. This caused the entire bilinear mesh to be shifted by the probe offset on machines with a non-zero XY offset. Convert the bilinear lower-left grid origin before comparing or storing the mesh, and apply the same conversion in M420 S2. Add Probe::convert_to_nozzle_xy() to centralize the conversion.
|
In my recent experiments with probing, I set up the probe as a dedicated tool (dummy extruder) with hotend offsets for the probe being equal to The trouble I had in getting probing to work indicates that the proposed changes are indeed needed. Or maybe we just need to improve documentation on how to set up a probe for G30, G38 and G29. |
|
Hi. I have a pull request I think yours might be connected to. My issue involves using a separate Z stop and probe #28418. I have extensively tested and regularly printed graphic representations of the bed map and still have tiny discrepancies in the mesh values I haven't identified. My machine now probes at the XY home position before commencing with G29. The probe trigger height is then taken off the probe readings for the rest of the mesh readings (probe Z offset). That should mean that when the probe measures the bed at the XY home position (bed center) during the mesh scan it should read 0 but it never does. I can see that an area roughly corresponding to the XY probe offset is very close to 0 now I have reviewed my maps. Is that what you would expect to see? The difficulty here is that the differences in the mesh values is now so small, because of all the major improvements I've made, they are almost lost in the noise caused by thermal expansion and repeatability accuracy of the probe. The first image shows a Bed map control taken a few days ago compared to one just done. with the Bed cold. Legend Red is above 0, Yellow is below 0, Blue is 0 This image below shows the surface topology after the bed has heated and soaked for 15 minutes (The bed was trammed Hot nearly a week ago) The Mesh visualizer is a spread sheet I created to display the data provided from the printer with M503. |
|
This is a comparison of the cold control from a couple of weeks ago and one done today 28/04/2026 with your fix applied to my local firmware build. note the square just above the center square which is the XY home coordinate is 0.008 and is the closest of any point on the mesh to the expected 0. I Since checked my Y offset to find it was a bit out which would account for this so I will rerun the test. Bed Mesh cold comparison with #28380 applied
I still have an issue where all the values in the mesh seam to slowly increase if I don't reset the Eprom quite often, so there is still an accumulative error getting in to the calculations somewhere. Any thoughts? |
|
Before I can merge this I will need to understand it better, and it is a bit confusing to refer to "probe space" when we don't really use such a thing. We don't select the probe as a tool by itself, but we subtract the probe offset from the target position when doing probing and move the tool to that position. So we have some functions to help us with "probe moves" in that sense. When we probe a point at X100 Y100 we put the probe at that bed point, so the nozzle might be at, for example, X90 Y105 (for a probe offset of +10, -5). Then the Z offset that was recorded at X100 Y100 will apply to the leveling adjustment later, when the nozzle is at X100 Y100. The same print space is applied in all cases, no separate "probe space" required. When another tool is set to be the active probing tool, the nozzle-to-probe offset in that case should be relative to that tool's position, not to the first tool's. Then when we want to move the probe to X100 Y100 while T1 is active, only the probe offset matters to that positioning. Later when we have T0 or T1 or Tn… selected and move it to X100 Y100 the Z offset recorded for X100 Y100 will apply. So you want to apply the probe offset to Given these considerations it is unclear why one would want the values they supply in Apologies if the variables named |
|
Hi Scott. What I can tell you is. That when I probe the center of the bed to automatically determin the probe Z offset. The centre position on the bed mesh map was never Zero and I couldn't understand why. untill I came accross #28380. I edited my version of bugfix 2.1.x to include it and the bed mapping then consistently showed the center Z value as close to zero. Well within the tolerance of the probe itself. Going back over previouse mesh maps I found that a value close to zero corresponded with the XY coordinate offset from the center by the X and Y probe offsets settings. As most of my mapped Z values tend to be very small it was a pattern that wasn't easy to spot on the graphical map printouts. I just knew the center position, becouse that is where the auto Z offset is measured, should have mapped to zero or very close but never did untill I applied #28380. You can look at the graphical maps above to see the whole mapped Z values. |
|
It's not easy to tell from mapped values whether a fix is really a fix or just working around something else, such as a config adjustment that has been acting as a kludge. Would it be possible for you to enable I'd like to compare those logs to see in each case what coordinates are being used for the bounds of the ABL mesh, how the mesh is applied during movement once leveling is enabled, and perhaps sort out where this notion comes from that the given mesh coordinates need to be shifted over by the probe offset before measurements are taken. The thing that confounds me —and I hope your logs will clear up— is that when we tell the probe to measure the bed at 100,100 we put the probe at 100,100 to take the measurement of the preheated bed there with a preheated probe. We trust the user to provide good bounds of where the mesh ought to be (when using One possibility that occurs to me is that for those using a different tool for probing, the default bounds of the ABL mesh may not be fully implemented to account for this, so experimenting with The boilerplate for
Repeat this procedure, if needed, to demonstrate inconsistencies. From these logs we should hopefully get a better idea of what's going on with this issue. I hope we can sort out what's truly going on. I can of course run some tests with and without this change to see if it makes proper sense and demonstrates some misunderstanding on my part. But I do know that our intent with the mesh bounds was to take the probe readings at the corner coordinates that are given to respect the user command. If that is the thing that is not happening, well clearly something is amiss, maybe at a deeper level, so I certainly appreciate all the data you can provide. 🤞🏻 |
|
Are your issues with the displayed values in the mesh, or with incorrect positioning of the toolhead, when moving with G1?
Here is my log file. I added shims on the bed at some probing points to simulate an uneven bed. Here my relevant config settings: |
|
Sorry Scott. I have been down this road before spent many many hours enabling debug and doing requested test. This PR #28380 is not mine. So I haven't delved deeply into what or how it does what it does.. But it did solve why I couldn't make sense of my xy home position (bed centre). Which is used to measure the probe Z offset. It did not mapp to Zero as expected. The position that did mapp to Zero was shifted by exactly the set x and y offsets and was not the centre of the bed. That only became apparent after applying #28380 as you observed its not easy to see on the mapps as they are all small values but the closest to Zero was not in the centre untill I applied #28380. My G29 pull request (#28418 which uses your suggestion of just measuring the probe Z offset before G29) doesn't do anything other than measure probe trigger height at the xy home position (bed centre) and adds it to the user Z offset. It doesn't do anything to XY coordinates. By placeing a physical marker on the bed I can observe the probe is possitioned correctly to carry out the Z offset measurement and all subsequent G29 probing points. After G29 has finished the nozzle is correctly positioned over the same point. I have not changed/set any mesh bounds, I don't even know where to set anything like that as I've never needed to. the only thing I have set is X and Y offsets from nozzle to probe. My machines are all now working perfectly without having to do daily leveling. Perfect first layers every time. At the moment sorry I don't have the spare time to get involved with extensive testing and I'm very reluctant to mess with machines that are working so perfectly. I hope this helps clarify. |




Description
This PR fixes a critical coordinate-space mixup for the
bedlevel.grid_startposition when using Bilinear Auto Bed Leveling (AUTO_BED_LEVELING_BILINEAR).The Problem:
The bilinear ABL probing process builds its mesh in probe-space, where
abl.probe_position_lfrepresents the coordinate directly under the probe. However, the resultingbedlevel.grid_startvalue is later consumed by other systems (likebedlevel.get_z_correction()) as a motion/nozzle-space origin.On machines with a non-zero
NOZZLE_TO_PROBE_OFFSETin the XY plane, this discrepancy caused the entire leveling mesh to be incorrectly shifted by the probe's XY offset, leading to inaccurate bed compensation.The Solution:
To resolve this, this PR introduces a centralized utility function,
Probe::convert_to_nozzle_xy(), to handle the conversion from probe-space to nozzle-space. This function is now used in two key locations:G29: The bilinear grid origin is now converted to nozzle-space before it is compared with a stored mesh or saved withbedlevel.set_grid().M420 S2: The test pattern generator is also updated to use the same conversion, ensuring that all methods of generating a bilinear mesh use consistent, nozzle-space coordinates for the grid origin.This change has no functional effect on setups where the XY probe offset is zero or when using
NOZZLE_AS_PROBE.Requirements
Any 3D printer configured with
AUTO_BED_LEVELING_BILINEAR.Benefits
Fixes a bug that incorrectly shifted the entire Bilinear ABL mesh by the probe's XY offset.
Configurations
No configuration files are attached as the change is hardware-independent.
To test this PR, any configuration with the following enabled will reproduce the issue and verify the fix:
Related Issues
Fixes a bug that does not appear to have a corresponding open issue.