Closed thomasvnl closed 4 months ago
Could we do some kind of average of the new 6x6 matrix back to a 4x4 matrix? Here is what chatgpt gave me , not sure at all it is correct, but maybe an idea at least.
import numpy as np
def convert_to_4x4(matrix_6x6):
matrix_4x4 = np.zeros((4, 4))
for i in range(4):
for j in range(4):
submatrix = matrix_6x6[i:i+2, j:j+2]
average_value = np.mean(submatrix)
matrix_4x4[i, j] = average_value
return matrix_4x4
# Updated 6x6 matrix
matrix_6x6 = np.array([
[0.251, 0.165, 0.054, 0.082, -0.055, -0.063],
[0.262, 0.164, 0.065, 0.012, -0.060, -0.133],
[0.249, 0.162, 0.076, -0.058, -0.065, -0.073],
[0.221, 0.152, 0.084, 0.009, -0.021, -0.051],
[0.317, 0.221, 0.125, 0.030, 0.005, -0.020],
[0.359, 0.290, 0.166, 0.051, 0.031, 0.001]
])
# Convert to 4x4 matrix
matrix_4x4 = convert_to_4x4(matrix_6x6)
# Round values to three significant digits
matrix_4x4_rounded = np.around(matrix_4x4, decimals=3)
# Convert values to strings with '+' sign for positive values
matrix_4x4_strings = np.char.add(np.where(matrix_4x4_rounded >= 0, '+', ''), matrix_4x4_rounded.astype(str))
# Print the formatted 4x4 matrix
for i, row in enumerate(matrix_4x4_strings):
print(f"{i} {' '.join(row)}")
# output
# 0 +0.211 +0.112 +0.053 -0.005
# 1 +0.209 +0.117 +0.024 -0.043
# 2 +0.196 +0.119 +0.028 -0.034
# 3 +0.228 +0.146 +0.062 +0.006
Have you guys tried the beta version of the converter?
https://bbbenji.github.io/PMSBLM/beta/
I've had others mention it works well, but let me know how it works for you. If all is good, I'll replace the current converter with it.
Hi, i tried to paste the output of the G29 T command into the beta, i dont think it works, e.g the max value seems wrong. Also, the beta version says "output from G29" command, not "G29 T" comand. But i am certainly no expert on this..
@stromg looks like if you remove the leading row values 5 4 3 2 1 0
, it works. The converter currently does not account for this. I'll see what I can do.
Ok! Thank you! did not try that for some reason..
@stromg I just pushed a fix that removes any leading descending line numbers. It should work without you having to remove them manually now. It's on the beta.
Great! The G29 T command seems more verbose than the G29, as listed in the first post, so manual editing of output is still necessary, but as long as the expected format is visible on the page its all good.
@stromg it should be more lenient with the input now. Ignoring any leading and trailing column numbers as well as leading row numbers (from 0 or to 0)
Great! It accepts the values in the beta page. However something is off (for me). I think. As an example, to fix the blue part, that is lowest, it want me to rotate the bottom-left screw 53 degree Clockwise, lowering it even more.
What if you flip the invert
switch to off?
Can you post your MBL output here?
I believe this was the raw printout from G29 T in OctoPrint, flipping the invert switch seem to make a little more sense since the suggestion to fix "Back Left "(-0.15 mm) is 107 CCW. I dont understand the mapping to the image however, cant get the blue part to be back left in the diagram regardless how i spin the image (assuming x is front). i was using the beta page.
Recv: 0 1 2 3 4 5
Recv: 5 | -0.126 -0.124 +0.089 +0.136 +0.059 +0.096
Recv: 4 | -0.164 -0.056 +0.051 +0.069 +0.049 +0.029
Recv: 3 | +0.009 +0.011 +0.014 +0.001 +0.039 +0.076
Recv: 2 | -0.012 +0.023 +0.058 +0.019 +0.038 +0.056
Recv: 1 | -0.017 [+0.023] +0.063 +0.033 +0.035 +0.038
Recv: 0 | -0.012 +0.023 +0.068 +0.046 +0.033 +0.051
@stromg please take a look now. You'll probably need the invert
switch off and flip
switch on.
Ok, i think the scrips works, but i cannot test it all the way, regardless how careful i am with the last degrees on the screws, i always end up with new 20-30 degree adjustments, almost random. But i see my pinda probe does not measure consistently between the tests either, so maybe it is something with that, have to check with support. For the script it would however be nice to maybe have a box to paste in the values in. I think it can maybe be confusing to paste it in in one line for people. I used invert: off
flip: on
Besides that, thanks for the work :)
Recv: 0 1 2 3 4 5
Recv: 5 | +0.026 +0.035 +0.044 +0.005 -0.017 +0.003
Recv: |
Recv: 4 | -0.006 +0.003 +0.011 +0.001 +0.000 -0.001
Recv: |
Recv: 3 | -0.039 -0.030 -0.021 -0.002 +0.018 +0.038
Recv: |
Recv: 2 | +0.040 +0.033 +0.025 +0.053 +0.033 +0.013
Recv: |
Recv: 1 | -0.002 [-0.010] -0.017 +0.028 +0.008 -0.012
Recv: |
Recv: 0 | -0.045 -0.052 -0.060 +0.003 -0.017 -0.037
can do something like this to get the 4x4 output back, have to reverse the Y axis, since UBL starts from the back now. If you use octoprint, the bed visualizer plugin has an option to do
G29 P1
@BEDLEVELVISUALIZER ; instruct plugin to start recording responses from printer.
G29 T1 ; plot mesh bed leveling
G29 P3 ; UBL
...
@notacoat there are switches to flip and invert the data. Is this not enough?
@bbbenji one less thing I have to remember to do, if I only have to set it once.
Ok, i think the scrips works, but i cannot test it all the way, regardless how careful i am with the last degrees on the screws, i always end up with new 20-30 degree adjustments, almost random. But i see my pinda probe does not measure consistently between the tests either, so maybe it is something with that, have to check with support. For the script it would however be nice to maybe have a box to paste in the values in. I think it can maybe be confusing to paste it in in one line for people. I used
invert: off
flip: on
Besides that, thanks for the work :)Recv: 0 1 2 3 4 5 Recv: 5 | +0.026 +0.035 +0.044 +0.005 -0.017 +0.003 Recv: | Recv: 4 | -0.006 +0.003 +0.011 +0.001 +0.000 -0.001 Recv: | Recv: 3 | -0.039 -0.030 -0.021 -0.002 +0.018 +0.038 Recv: | Recv: 2 | +0.040 +0.033 +0.025 +0.053 +0.033 +0.013 Recv: | Recv: 1 | -0.002 [-0.010] -0.017 +0.028 +0.008 -0.012 Recv: | Recv: 0 | -0.045 -0.052 -0.060 +0.003 -0.017 -0.037
I am getting exactly the same behaviour. The output from the G29 T command gives different slightly different results on each run - even though all conditions are exactly the same. I have attached three screenshots of the visualizer for my bed after G29. As you can see, I am getting almost random variations in the output.
I rolled back my firmware to 4.1.1 which uses Bilinear as opposed to unified bed levelling and the problem goes away and I get much more consistent values between runs.
Are you also able to downgrade to 4.1.1 to see if you can replicate what I get? Initially I thought my SPINDA was bad!
I wonder if this is a bug in the Unified Bed Levelling that was introduced as part of the 5.0 firmware.
Either:
Interesting find, unfortunately i will not be able to test it for a while due to other duties.. Dunno it was the reason, but one mistake i remember doing sometimes, was that i tried to modify the bed height by only using screwdriver from the top while not properly holding the locknut with a wrench :thumbsup: Next time i will create a variant of this adapter. to aid adjustments.
I Feel like the positions that the pinda measures changed and one of them is too close to the magnets?
I Feel like the positions that the pinda measures changed and one of them is too close to the magnets?
This is a possibility well worth exploring - I am going to downgrade and compare later today
Probing positions on 4.1.1. are in the same positions as 5.0. That being said I still picked up some variations on 4.1.1 firmware but not as bad. Could be that the whole bed needs to be left up to temp for a while...
I have recently found out that you can retrieve the mesh leveling data in the good old format on 5.0+ by doing G29 P1
(then get the data with G29 T
).
I've put together a very short script to change the output to the old format so you can use the old version of the tool: https://colab.research.google.com/drive/13qLM5J1pG5fu6vlo2JZG0oRpZ1dqymwN
Probing positions on 4.1.1. are in the same positions as 5.0. That being said I still picked up some variations on 4.1.1 firmware but not as bad. Could be that the whole bed needs to be left up to temp for a while...
I am not sure if that is true, I looked at the probe offset dimmensions and those are the same, but this commit shows that the mesh_min and mesh_max have changed.
While the scope of this tool is for the Mini, I was able to get it working with the MK3.5 because it uses the same unified mesh leveling system. However, it requires some manual editing to be compatible with this tool.
The output of G29 T
gives a lot of data:
Recv:
Recv: Bed Topography Report:
Recv:
Recv: ( 10,220) (260,220)
Recv: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Recv: 20 | +0.041 +0.035 +0.022 +0.009 -0.006 -0.028 -0.051 -0.067 -0.067 -0.059 -0.061 -0.085 -0.120 -0.139 -0.125 -0.095 -0.079 -0.091 -0.115 -0.140 -0.199
Recv: |
Recv: 19 | +0.044 +0.034 +0.025 +0.016 +0.003 -0.017 -0.041 -0.058 -0.060 -0.056 -0.057 -0.073 -0.094 -0.106 -0.093 -0.070 -0.064 -0.089 -0.131 -0.173 -0.215
Recv: |
Recv: 18 | +0.040 +0.034 +0.028 +0.023 +0.013 -0.007 -0.031 -0.049 -0.054 -0.053 -0.053 -0.060 -0.068 -0.072 -0.061 -0.045 -0.049 -0.088 -0.147 -0.206 -0.265
Recv: |
Recv: 17 | +0.035 +0.033 +0.031 +0.029 +0.022 +0.003 -0.021 -0.039 -0.047 -0.049 -0.049 -0.047 -0.043 -0.039 -0.029 -0.020 -0.034 -0.087 -0.163 -0.239 -0.314
Recv: |
Recv: 16 | +0.034 +0.034 +0.034 +0.034 +0.028 +0.010 -0.014 -0.033 -0.043 -0.048 -0.047 -0.039 -0.025 -0.016 -0.007 -0.002 -0.022 -0.084 -0.171 -0.258 -0.346
Recv: |
Recv: 15 | +0.041 +0.039 +0.038 +0.036 +0.029 +0.010 -0.014 -0.034 -0.045 -0.051 -0.050 -0.039 -0.021 -0.009 +0.002 +0.007 -0.015 -0.078 -0.167 -0.257 -0.347
Recv: |
Recv: 14 | +0.050 +0.046 +0.041 +0.036 +0.026 +0.007 -0.018 -0.037 -0.049 -0.056 -0.056 -0.044 -0.026 -0.012 +0.001 +0.008 -0.010 -0.070 -0.156 -0.243 -0.329
Recv: |
Recv: 13 | +0.053 +0.046 +0.040 +0.033 +0.023 +0.004 -0.018 -0.036 -0.047 -0.052 -0.052 -0.043 -0.028 -0.016 -0.003 +0.008 -0.007 -0.063 -0.145 -0.226 -0.307
Recv: |
Recv: 12 | +0.043 +0.037 +0.031 +0.025 +0.017 +0.004 -0.013 -0.025 -0.030 -0.032 -0.032 -0.030 -0.026 -0.022 -0.010 +0.003 -0.008 -0.059 -0.133 -0.207 -0.281
Recv: |
Recv: 11 | +0.025 +0.022 +0.018 +0.015 +0.011 +0.004 -0.004 -0.009 -0.008 -0.004 -0.003 -0.011 -0.023 -0.029 -0.019 -0.004 -0.011 -0.054 -0.120 -0.185 -0.250
Recv: |
Recv: 10 | +0.011 +0.010 +0.009 +0.008 +0.007 +0.006 +0.004 +0.004 +0.009 +0.017 +0.017 +0.005 -0.014 -0.026 -0.018 -0.002 -0.008 -0.049 -0.111 -0.173 -0.234
Recv: |
Recv: 9 | +0.003 +0.005 +0.007 +0.009 +0.010 +0.009 +0.008 +0.009 +0.013 +0.019 +0.021 +0.014 +0.002 -0.005 +0.003 +0.016 +0.007 -0.040 -0.109 -0.178 -0.246
Recv: |
Recv: 8 | -0.001 +0.003 +0.008 +0.013 +0.015 +0.014 +0.012 +0.010 +0.012 +0.014 +0.017 +0.020 +0.023 +0.026 +0.035 +0.043 +0.027 -0.030 -0.111 -0.192 -0.273
Recv: |
Recv: 7 | -0.007 +0.001 +0.009 +0.017 +0.022 +0.021 +0.017 +0.013 +0.013 +0.013 +0.017 +0.028 +0.042 +0.051 +0.060 +0.064 +0.042 -0.023 -0.114 -0.205 -0.297
Recv: |
Recv: 6 | -0.017 -0.003 +0.011 +0.025 +0.033 +0.032 +0.026 +0.022 +0.023 +0.026 +0.032 +0.043 +0.057 +0.066 +0.073 +0.075 +0.049 -0.020 -0.117 -0.214 -0.310
Recv: |
Recv: 5 | -0.028 -0.007 +0.013 +0.033 +0.045 +0.045 +0.038 +0.033 +0.036 +0.043 +0.050 +0.060 +0.070 +0.076 +0.080 +0.080 +0.051 -0.021 -0.121 -0.221 -0.320
Recv: |
Recv: 4 | -0.038 -0.014 +0.010 +0.034 +0.049 +0.051 +0.045 +0.041 +0.042 +0.046 +0.052 +0.062 +0.075 +0.081 +0.085 +0.082 +0.052 -0.021 -0.122 -0.223 -0.324
Recv: |
Recv: 3 | -0.048 -0.025 -0.001 +0.022 +0.039 +0.045 +0.045 +0.042 +0.036 +0.027 +0.026 +0.042 +0.065 +0.080 +0.085 +0.082 +0.051 -0.021 -0.120 -0.219 -0.317
Recv: |
Recv: 2 | -0.058 -0.037 -0.016 +0.004 +0.020 +0.033 +0.041 +0.040 +0.021 -0.005 -0.016 +0.007 +0.047 +0.074 +0.083 +0.079 +0.049 -0.020 -0.115 -0.210 -0.305
Recv: |
Recv: 1 | -0.067 [-0.050] -0.032 -0.014 +0.002 +0.020 +0.036 +0.038 +0.007 -0.038 -0.058 -0.027 +0.029 +0.068 +0.080 +0.076 +0.047 -0.019 -0.110 -0.201 -0.292
Recv: |
Recv: 0 | -0.083 -0.062 -0.047 -0.033 -0.017 +0.007 +0.032 +0.036 -0.007 -0.070 -0.100 -0.062 +0.010 +0.062 +0.078 +0.073 +0.044 -0.018 -0.105 -0.192 -0.287
Recv: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Recv: ( 10, -10) (260, -10)
But, G29 P1
followed by G29 T
greatly simplifies it:
Recv:
Recv: Bed Topography Report:
Recv:
Recv: ( 10,220) (260,220)
Recv: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Recv: 20 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 19 | . +0.047 . . +0.013 . . -0.026 . . +0.023 . . +0.039 . . +0.191 . . +0.224 .
Recv: |
Recv: 18 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 17 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 16 | . +0.034 . . +0.023 . . -0.011 . . +0.028 . . +0.152 . . +0.285 . . +0.242 .
Recv: |
Recv: 15 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 14 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 13 | . +0.054 . . +0.025 . . -0.016 . . +0.028 . . +0.189 . . +0.370 . . +0.391 .
Recv: |
Recv: 12 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 11 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 10 | . +0.019 . . +0.005 . . +0.026 . . +0.102 . . +0.199 . . +0.425 . . +0.551 .
Recv: |
Recv: 9 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 8 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 7 | . +0.013 . . +0.022 . . +0.031 . . +0.110 . . +0.296 . . +0.492 . . +0.546 .
Recv: |
Recv: 6 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 5 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 4 | . -0.002 . . +0.049 . . +0.066 . . +0.157 . . +0.336 . . +0.504 . . +0.541 .
Recv: |
Recv: 3 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 2 | . . . . . . . . . . . . . . . . . . . . .
Recv: |
Recv: 1 | . [-0.010] . . +0.024 . . +0.085 . . +0.054 . . +0.330 . . +0.499 . . +0.595 .
Recv: |
Recv: 0 | . . . . . . . . . . . . . . . . . . . . .
Recv: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Recv: ( 10, -10) (260, -10)
Recv:
Recv: ok
If I input only the lines with data, and remove all line numbers, Octoprint cruft, and dots, I get a usable output from the visualizer. Yes I know my right side is high, it's a work in progress :)
@sdh2 it should work just fine with that output without editing. If you are still having issues, please open a new issue.
Should be all working now. Closing.
Hi,
I've used your tool and mod in the past to greatly improve my bed leveling on the Mini. Ever since the update to 5.1.0 however I can no longer use your tools as the output from the Mini no longer produces the original mesh but instead outputs nothing when just probing with G29. If requested to output a mesh, the mesh is a lot different than before.
G Code:
This produces a mesh that looks like this (and yes, my arm is not square at the moment as indicated by the mesh):
Would you be able to modify your tool at https://bbbenji.github.io/PMSBLM/ to allow for this new Unified Bed Leveling mesh output?
Details (from marlin) regarding the UBL: https://marlinfw.org/docs/features/unified_bed_leveling.html
With kind regards, Thomas