Mesh Bed Compensation Screwy

Avatar

By pcsentinel 5 March 2017 11:19

Member · 42 comments

Hi, I've got a 200,200 cartersian printer with ir IR Sensor. The probe is mounted approx 1.5mm above the nozzle and 48mm back towards X0 and 28mm back towards Y0from the nozzle.

Gone through the following stages:

; Endstops
M574 X1 Y1 Z1 S1 ; Define active high microswitches
M558 P1 X0 Y0 Z1 H5 F120 T6000 ; Set Z probe type to unmodulated, the axes for which it is used and the probe + travel speeds
G31 P500 X48 Y28 Z0.095 ; Set Z probe trigger value, offset and trigger height
M557 X10:165 Y10:165 S25 ; Define mesh grid

Checked repeatability at 4 points results were
110,10: 0.582,0.587,0.590,0.582
10,10: 1.092,1.092,1.090,1.095
110,150: -0.015,-0.007,-0.013,-0.015
10,150 ; 0.023,0.023,0.027,0.027

Ran G29 and got the following heightmap:
RepRapFirmware height map file v1, mean error -0.82, deviation 0.22
xmin,xmax,ymin,ymax,radius,spacing,xnum,ynum
10.00,165.00,10.00,165.00,-1.00,25.00,7,7
      0,      0,      0,      0,      0,      0,      0
      0,      0, -0.502, -0.720, -0.785, -0.793, -0.440
      0,      0, -0.795, -0.850, -0.725, -1.155, -0.545
      0,      0, -0.880, -0.660, -0.955, -0.737, -0.488
      0,      0, -0.957, -0.803, -1.023, -0.930, -0.665
      0,      0, -0.940, -1.065, -1.082, -0.825, -0.400
      0,      0, -1.123, -1.103, -1.135, -1.062, -0.605


created a print that bulids four 25mm cubes at 50,50   50,150   150,50   150,150

when I run the print I get absolutely batty Z movment on each cube although you would have thought that the z movement on each cube should be minimal.

The first layer of some cubes has half printed fat and half printed squiged to the plate. Others are to high to adhere. Also when moving from cube to cube the movement of x and Y is juddery as it would seem it has too much Z movement to cope.

First lines of Gcode are:
; Generated with MatterSlice 1.0
; filamentDiameter = 1.75
; extrusionWidth = 0.5
; firstLayerExtrusionWidth = 0.5
; layerThickness = 0.2
; firstLayerThickness = 0.2
; automatic settings before start_gcode
M107 ; fan off
M190 S30 ; wait for bed temperature to be reached
M104 T0 S205 ; start heating extruder 1
T0 ; set the active extruder to 0
; settings from start_gcode
G28 ; home all axes
G1 Z5
G90 ; use absolute coordinates
G21 ; set units to millimeters
G92 E0
M82 ; use absolute distances for extrusion
M109 S205 ; wait for temperature to be reached
G29 S1
;G1 E10 F400 ; prime the nozzle
; automatic settings after start_gcode
T0 ; set the active extruder to 0
G92 E0 ; reset the expected extruder position
; Layer count: 50
; Layer Change GCode
; LAYER:0
M400
M107
G0 F12000 X166.75 Y166.75 Z0.2
; TYPE:SKIRT
G1 F3000 E0
G1 F2550 X33.25 Y166.75 E5.27277
G1 X33.25 Y33.25 E10.54554
G1 X166.75 Y33.25 E15.81831

Please help

Last edited by pcsentinel (5 March 2017 11:22)

Avatar

By dc42 5 March 2017 11:41

Administrator · 2,256 comments

The first thing to check is whether you are getting a consistent trigger height from the Z probe. If you are not, that could be caused by the head tilt varying as the head moves, or by big changes on the bed surface. What bed surface are you using?


Duet WiFi hardware designer and firmware engineer
http://www.escher3d.com
https://miscsolutions.wordpress.com

Avatar

By pcsentinel 5 March 2017 11:51

Member · 42 comments

4mm glass on top of black card over heat bed.

I did run consistency checks at four points as above, but even it it was way off it I dont think I should see the kind of differences I'm seeing across a small area.


If you take just one of the four cubes you've got perhaps a 1mm variation in Z over a 25mm square area.

The only thing I did think of but may be a red herring, as I'm using the probe as the end z stop as well , could its triggering be causing spurious effects?

Avatar

By pcsentinel 5 March 2017 12:18

Member · 42 comments

I've just run three G29's to check for onsistency, here are the results which look pretty consistent to me.

RepRapFirmware height map file v1, mean error -0.68, deviation 0.23                       
xmin,xmax,ymin,ymax,radius,spacing,xnum,ynum                       
10.00,165.00,10.00,165.00,-1.00,25.00,7,7                       
0,    0,    0,    0,    0,    0,    0
0,    0,    -0.462,    -0.325,    -0.440,    -0.537,    -0.282
0,    0,    -0.770,    -0.510,    -0.640,    -0.695,    -0.373
0,    0,    -0.767,    -0.527,    -0.825,    -0.615,    -0.182
0,    0,    -0.870,    -0.627,    -0.938,    -0.950,    -0.36
0,    0,    -0.867,    -0.837,    -0.910,    -0.887,    -0.57
0,    0,    -1.020,    -0.965,    -0.957,    -0.935,    -0.702
                       
RepRapFirmware height map file v1, mean error -0.68, deviation 0.23                       
xmin,xmax,ymin,ymax,radius,spacing,xnum,ynum                       
10.00,165.00,10.00,165.00,-1.00,25.00,7,7                       
0,    0,    0,    0,    0,    0,    0
0,    0,    -0.465,    -0.342,    -0.445,    -0.553,    -0.297
0,    0,    -0.770,    -0.520,    -0.645,    -0.705,    -0.375
0,    0,    -0.775,    -0.535,    -0.817,    -0.602,    -0.2
0,    0,    -0.855,    -0.625,    -0.938,    -0.935,    -0.355
0,    0,    -0.867,    -0.812,    -0.905,    -0.880,    -0.572
0,    0,    -1.013,    -0.955,    -0.957,    -0.930,    -0.705
                       
RepRapFirmware height map file v1, mean error -0.68, deviation 0.23                       
xmin,xmax,ymin,ymax,radius,spacing,xnum,ynum                       
10.00,165.00,10.00,165.00,-1.00,25.00,7,7                       
0,    0,    0,    0,    0,    0,    0
0,    0,    -0.457,    -0.355,    -0.440,    -0.560,    -0.3
0,    0,    -0.772,    -0.492,    -0.660,    -0.695,    -0.387
0,    0,    -0.750,    -0.527,    -0.830,    -0.610,    -0.202
0,    0,    -0.885,    -0.630,    -0.930,    -0.938,    -0.373
0,    0,    -0.873,    -0.810,    -0.913,    -0.887,    -0.565
0,    0,    -1.015,    -0.962,    -0.952,    -0.925,    -0.702

Avatar

By GrodanB 5 March 2017 12:18

Member · 19 comments

Perfect I have this too. Was just about to write a long question about this too.

For me it seems like the duet does the compensation wrong... But as you say, it could be my Bigbox.

This is my problem: KQx2v8v.jpg

Doing five point leveling I get this: lz9Wd0n.png

This is my printer head at X=0 Y=0 Z=5: 3krVVk3.jpg
So that is in front of the printer...  Looking at the five point picture. My bed "lean" to the back... But looking at the first layer it seem to overcompensate in the back. Or the sensor measure wrong.

I usually measure when the bed is hot (and the hotend) but not this time...

My method is this:

  • First I measure a five point
  • Then I mechanically level the bed until all corners are within 100-50 microns
  • Then I do a mesh level now I use a smaller mesh for speed but I used a 176 points mesh before.

This is the result bOMZ4sh.png

This I thought should give me a very good first layer.

My duet setup is available at E3D forum: https://forum.e3d-online.com/index.php? … 66/page-12 entry 231

And this is my Duet firmware:
Firmware Version:    1.17e (2017-02-10)
WiFi Server Version:    1.03 (ch fork)
Web Interface Version:    1.14a

Avatar

By pcsentinel 5 March 2017 15:09

Member · 42 comments

Tried everything I can think even starting from scratch but still the same issue, I've gone back to just using it for an endstop for now until I have the patience to try again.

Avatar

By dc42 5 March 2017 20:37

Administrator · 2,256 comments

Your consistency checks indicate that the probe produces a consistent result at a fixed point, but they don't tell us whether it produces the same result everywhere on the bed. I suggest you pick the highest and lowest points from the height map and measure the probe trigger height at those points. If you find a significant difference, use feeler gauges to measure the distance between the bed and the bottom of the sensor board when the nozzle is just touching the bed, at both points. That will indicate whether the difference in trigger height is caused by varying tilt.


Duet WiFi hardware designer and firmware engineer
http://www.escher3d.com
https://miscsolutions.wordpress.com

Avatar

By GrodanB 5 March 2017 21:32

Member · 19 comments

My problem seem to be the same...

Looking at the five point measuring map produced the bed is leaning towards the back...

Looking at the failed print the back is to the left of the picture. The duet seems to "over compensate" for the tilt.

This is the strange behavior I do not understand and seems like the same as pcsentinel is having.

This seem like the probe measures the "same" but the duet seem to compensate wrong...

Looking at the result from two mesh leveling's done a few hours apart it seems like it measures OK, (almost the same result but can still be wrong actual values). But I do not understand how the duet gets from this to the extrem overcompensation I get. (looking at the picture you can clearly see that the bed is pressed against the nozzle so no plastic is extruded. (the line farthest from the camera) 

26.00,299.00,12.00,188.00,-1.00,32.00,9,6
  0.062, -0.053, -0.030,  0.095, -0.018,  0.097,  0.110, -0.088, -0.005
  0.062, -0.045,  0.095,  0.120,  0.075,  0.135,  0.097,  0.047,  0.110
  0.070,  0.065,  0.060,  0.152,  0.188,  0.190,  0.293,  0.120,  0.045
  0.060,  0.040,  0.110,  0.132,  0.185,  0.188,  0.095,  0.210,  0.190
  0.067,  0.017,  0.122,  0.162,  0.090,  0.210,  0.150,  0.027,  0.142
-0.072, -0.013, -0.015,  0.020,  0.080, -0.005, -0.010,  0.057, -0.082

26.00,299.00,12.00,188.00,-1.00,32.00,9,6
  0.080, -0.043, -0.003,  0.110,  0.007,  0.112,  0.117, -0.068,  0.015
  0.085, -0.025,  0.120,  0.137,  0.097,  0.152,  0.115,  0.075,  0.127
  0.095,  0.082,  0.082,  0.175,  0.205,  0.207,  0.320,  0.135,  0.062
  0.085,  0.057,  0.125,  0.150,  0.205,  0.210,  0.107,  0.225,  0.212
  0.092,  0.033,  0.148,  0.180,  0.115,  0.232,  0.162,  0.045,  0.170
-0.053,  0.010, -0.008,  0.027,  0.095, -0.005, -0.005,  0.060, -0.078

The only explanation if the bed level compensation is OK is that the measurement is unreliable.

Last edited by GrodanB (5 March 2017 21:33)

Avatar

By pcsentinel 6 March 2017 07:25

Member · 42 comments

Hi DC42, i'll try that tonight, but as an fyi I also tried 4 point plane correction. When I try and move the bed after this I get a small jolt on the motors, which I cant identify and then the machine locks up and wont respond until power cycled. Bed.g below.

; bed.g
; called to perform automatic bed compensation via G32
;
; generated by RepRapFirmware Configuration Tool on Sun Feb 26 2017 13:25:00 GMT+0000 (GMT Standard Time)
G90
; Clear any bed transform
M561

; Probe the bed at 4 points
G30 P0 X49 Y29 H0 Z-99999
G30 P1 X171 Y29 H0 Z-99999
G30 P2 X171 Y171 H0 Z-99999
G30 P3 X49 Y171 H0 Z-99999 S4

Avatar

By CHP 6 March 2017 11:03

Member · 14 comments

There is definitely something wrong with the mesh-bed-compensation. The first thing I wondered about were the spurious pauses while printing  At first I thought it is the non-extruding-move while changing perimeter.

I investigated further and found out the "stops" are at specific positions even if I move the head manually through the paneldue. When the "stops" occur the bed moves in Z-direction a significant amount (0.5mm) although it should change only gradually according to the heightmap.csv.

I then tried to find the spots where these "stops/jumps" occur and they were always at some 5mm border, for example between 184.9mm and 185mm or 74.9mm and 75mm.

To me it seems there is some rounding error which can happen more easily when using inverse multiplication instead of division, taking a first glance at HeightMap::GetInterpolatedHeightError() I couldn't spot any issue although the HeightMap::InterpolateXY looks a bit overcomplicated in favour of just clamping the values.
I guess I'll just run some tests and debug these functions hoping that these are not some compiler or CPU specific rounding errors. ...

Avatar

By pcsentinel 6 March 2017 11:28

Member · 42 comments

Hi, that would definitely align with what I was seeing on the four square print as mentioned above. But I also found that after running through the compensation and then just executing a simple X move from X0 to X200 then the Z was very jumpy

Avatar

By CHP 6 March 2017 13:46

Member · 14 comments

Ok, so I loaded GrodanB's heightmap.csv and then sampled the whole bed ( HeightMap::GetInterpolatedHeightError()  ) with a 4mm (and 2mm) resolution and visualised the result with excel.

IYBRvqp.png

The first one is rather off, the area clearly wrong. Debugging it showed that GridDefinition::recipSpacing is still at its default value (for a 20mm grid) after loading the .csv.

BlK0Tpg.png

After fixing that it is much better, but still some hard jumps at the borders, so I'll debug the border-interpolation next.

My fixes as well as the (very shoddy) simulator I use can be found here: https://github.com/ChristophPech/RepRapFirmware

Last edited by CHP (6 March 2017 13:46)

Avatar

By 3dprinting meathead 6 March 2017 13:54

Member · 68 comments

I just made a short video of the smooth motion without g29, and the choppier motion with.
I'm not sure if it's a bug, maybe all the variables eat up the processing power?
But I don't remember my 8 bit board doing this.
Here's the video:
https://youtu.be/igNx0sjtSqE


If I can learn it, than anyone can learn it.

Avatar

By CHP 6 March 2017 14:13

Member · 14 comments

I found an error in one of the interpolation functions and fixed it (pull request pending)

The result looks much better:
wAqTgeM.png

Avatar

By CHP 6 March 2017 14:46

Member · 14 comments

But there is still more. Zeroing out the last two columns gives me this: wFkfYFN.png

The interpolation overflows into the first column of the next line. Fixing it: kqJIuTL.png

The final result of the whole mesh: rLZxBbU.png looks quite good.

Avatar

By CHP 6 March 2017 16:49

Member · 14 comments

And we can even do better by using bicubic interpolation:
4DmGhx3.png
Since Z is often the slowest axis, smoothing it out will mean smoother movement for the other axes.

But there still remain two last issues: unprobed points with a 0 csv are being clamped to zero, this can easily be fixed

Second: points outside the probing area remain constant. These should be extrapolated, maybe something like linear regression.

Thoughts?

Last edited by CHP (6 March 2017 16:52)

Avatar

By dc42 6 March 2017 18:54

Administrator · 2,256 comments

@CHP, many thanks for diagnosing and fixing these issues. I have accepted your pull request, and I will release a new 1.18 beta soon incorporating these changes.


Duet WiFi hardware designer and firmware engineer
http://www.escher3d.com
https://miscsolutions.wordpress.com

Avatar

By pcsentinel 6 March 2017 19:39

Member · 42 comments

Hi CHP, can I just say thank you for identifying this and fixing, very very much appreciated.

DC42, have you any idea what going on re my comment about 4 pont adjustment above?

thanks

Avatar

By 3dprinting meathead 6 March 2017 20:20

Member · 68 comments

@CHP although I only understand have of what you said(the hampster wheel in my head is seizing up), the pictures you put up show that you've found a way to wrangle the angry pixies flowing to my motors, and I thank you for it.


If I can learn it, than anyone can learn it.

Avatar

By dc42 6 March 2017 21:22

Administrator · 2,256 comments
pcsentinel wrote

Hi CHP, can I just say thank you for identifying this and fixing, very very much appreciated.

DC42, have you any idea what going on re my comment about 4 pont adjustment above?

thanks

You need to probe clockwise round the bed, not anticlockwise. One of these days I'll get round to either re-ordering the points or generating an error message if they are in the wrong order.


Duet WiFi hardware designer and firmware engineer
http://www.escher3d.com
https://miscsolutions.wordpress.com

Avatar

By pcsentinel 7 March 2017 06:36

Member · 42 comments

Hi, tried this which is clockwise

G30 P0 X151 Y151 H0 Z-99999
G30 P1 X151 Y49 H0 Z-99999
G30 P2 X49 Y49 H0 Z-99999
G30 P3 X49 Y151 H0 Z-99999 S4

but same result, just gives a small judder on first move after running the bed level and then wont move anymore. (Sorry)

Last edited by pcsentinel (7 March 2017 06:47)

Avatar

By pcsentinel 7 March 2017 07:10

Member · 42 comments

Update, maybe its just my misunderstanding of how this works, but commented out last line and moved S to third line as


G30 P0 X100 Y151 H0 Z-99999
G30 P1 X151 Y151 H0 Z-99999
G30 P2 X151 Y49 H0 Z-99999 S

works and I can then see compensation movement through moves, yet to try with a print though

Avatar

By dc42 7 March 2017 07:20

Administrator · 2,256 comments
pcsentinel wrote

Hi, tried this which is clockwise

G30 P0 X151 Y151 H0 Z-99999
G30 P1 X151 Y49 H0 Z-99999
G30 P2 X49 Y49 H0 Z-99999
G30 P3 X49 Y151 H0 Z-99999 S4

but same result, just gives a small judder on first move after running the bed level and then wont move anymore. (Sorry)

Start with your X49 Y49 point as P0 and go clockwise from there.


Duet WiFi hardware designer and firmware engineer
http://www.escher3d.com
https://miscsolutions.wordpress.com

Avatar

By pcsentinel 7 March 2017 07:24

Member · 42 comments

Further Update, changed the coords so that there were four but not in a perfect square. And now it works with 4, but following running the bed compensation, Z is set to an insane neagtive number of -199.91


G30 P0 X49 Y151 H0 Z-99999
G30 P1 X150 Y150 H0 Z-99999
G30 P2 X149 Y50 H0 Z-99999
G30 P3 X51 Y50 H0 Z-99999 S

Go back to 3points as

G30 P0 X100 Y151 H0 Z-99999
G30 P1 X149 Y50 H0 Z-99999
G30 P2 X51 Y50 H0 Z-99999 S

and Z after shows 5.73 and z compensation across the bed seems to work, again need to wait till tonight to try a print

Last edited by pcsentinel (7 March 2017 07:33)

Avatar

By GrodanB 7 March 2017 17:38

Member · 19 comments

Great work, thanks.

Just tell me when a beta is available and I test with that.

It would be interesting to see the result. I'll switch back to 16 mm square instead of the 32 mm I used for this test.

I'll still wonder if there is something hidden in the fact that the measurement clearly shows that the bed is high at the back right off the plate but the print is pressed hard against the plate on precisely that spot... Strange if you ask me...

Then I kind of wonder how the compensation is done when printing with dual head. I set the distance between the first tool and the Z-probe. But I do not enter the distant from the second... So is automatically compensated or should I refer to a point in the middle?

G31 X-25.19 Y7 Z2.67 P500                  ; Set the probe height and threshold; increase Z to decrease bed probe distance X11.0 Y0.5

This is relative the tool 1 nozzle... the nozzles are approx. 38 mm apart. So to place the compensation in the middle should I use:

G31 X-44.19 Y7 Z2.67 P500

Or is the 38mm added due to
G10 P1 X38.3 Y0.0 Z0.0 S0 R0

So that exact bed leveling is done for the extruding nozzle?

Last edited by GrodanB (7 March 2017 18:31)