G28 G32 homeall and probe offset confusion



  • Hi I am sure this will be simple to you folk but its driving me around the twist😢

    I am using a Duet WiFi on a CR-10 cartesian machine with a Precision piezo sensor.

    Firmware Name: RepRapFirmware for Duet 2 WiFi/Ethernet
    Firmware Electronics: Duet WiFi 1.02 or later
    Firmware Version: 2.0(RTOS) (2018-06-05b3)
    WiFi Server Version: 1.21
    Web Interface Version: 1.21.1

    homeall.g
    config.g
    working-ish-config.g
    bed.g

    what I cant get my head around is whats going on with the offset for the probe.

    the probe triggers at around Z-0.1 as expected and I think I should be able to compensate for this in my config.g with:

    G31 X0 Y0 Z-0.1 P600 under the "z probe" heading

    however if I do this while the homeall command works as expected and zero's the Z axis if I use G28 then the Z readout under "machine status" in DWC will increment by 0.1 with each repetition and the same with G32 so I end up being able to command the nozzle below the bed surface (not good)

    if on the other hand I remove the offset as in the working-ish-config.g then while I do not get the change in Z in machine status the result from G32 is always 0.1mm below the home point.

    my presumption was that the setting of the offset in config.g would mean it would be used any time the probe is used but this does not seem to be the case.

    I am sure I am doing something daft but I have been at this for hours and cant see my error. hopefully someone can steer me in the right direction.



  • @opentoideas

    I don't see a Z endstop setting in your config file - it that correct?

    Frederick



  • @fcwilt said in G28 G32 homeall and probe offset confusion:

    @opentoideas

    I don't see a Z endstop setting in your config file - it that correct?

    Frederick

    good question, I don't know if its correct but I did take it out.

    I started with the probe wired into the Z endstop connector but then when I went to try the leveling routines realised it needed to be in the probe port so moved it. as it was not in the endstop port I took this out of the config.g under endstops

    ; Endstops
    M574 S0 ; Set active low endstops
    M574 X1 Y2 S1 ; Set active high endstops

    ; Z-Probe
    M558 P1 I1 R0.8 F300 X0 Y0 Z0 ; (analogue mode, NO, delay, speed, not used as axis endstop
    G31 X0 Y0 Z-0.1 P600 ; X, Y, Z offsets, sensitivity/threshold
    ;M558 P5 I1 R0.5 F300 X0 Y0 Z1 ; (digital mode, NO/NC, delay, speed, not used as axis endstop)
    ;G31 X0 Y0 Z0 P100 ;(X, Y, Z offsets, debounce interval)

    although the comment is wrong in the M558 lines the probe setup is for either analog or digital response and the final Z0 or Z1 references use or not as an endstop and I have tried both ways with no change

    that is both analog and digital and use or not as an endstop. will correct the comments to reflect the current way around.



  • right tested again as I have ran so many tests keeping the results straight is confusing.

    with the Z flag set to 1 in M558 and G31 Z-0.1 the result is:

    Z0 = 0

    run G28

    Z0.1 = 0

    run G28

    Z0.2 =0

    so with each repetition the machine status reports Z0 as 0.1mm higher than it actually is but in fairness I cant take the Z below wherever 0 actually is.

    running m32 :

    16:46:37G32
    Bed equation fits points [30.0, 25.0, -0.075] [30.0, 265.0, -0.065] [270.0, 265.0, -0.050] [270.0, 25.0, -0.040]
    16:45:56M561
    16:45:05G32
    Bed equation fits points [30.0, 25.0, -0.077] [30.0, 265.0, -0.075] [270.0, 265.0, -0.047] [270.0, 25.0, -0.040]
    16:44:24M561

    so it seems consistent but alway low by a tiny fraction which is fine but the machine status is incrementing Z by the offset each time



  • only change from above is to remove the Z offset in G31
    and Z remains at 0 with each home command

    16:55:07G32
    Bed equation fits points [30.0, 25.0, -0.165] [30.0, 265.0, -0.150] [270.0, 265.0, -0.142] [270.0, 25.0, -0.140]
    16:54:25M561
    16:54:14G32
    Bed equation fits points [30.0, 25.0, -0.160] [30.0, 265.0, -0.153] [270.0, 265.0, -0.150] [270.0, 25.0, -0.138]
    16:53:32M561

    but probe readings are consistently low by the missing offset.

    any idea what I am doing wrong?



  • @opentoideas

    According to what I think are the current g-code docs the Z parameter for M558 is obsolete and you should be using the S2 parameter in M574 to define the Z end stop.

    Frederick



  • @fcwilt thank you.

    well that has helped and having changed the config.g to :
    config.g

    it still does sort of the same. one thing I have noticed is that with the Z offset positive it zero's after each G28 fine but I get this odd incrementation with the negative offset that I need

    is https://duet3d.dozuki.com/Wiki/Gcode still up to date?

    according to it the G31 should work with negative offset for a contact probe but I get incrementation with negatives and no effect with positives (even tried 150 to see if it gave an effect!). it seems like for whatever reason the G31 offset is ignored but then that could be some logic as a positive offset with a contact probe is not valid?



  • ok this is strange LOL

    if correct then M561 clears any bed compensation data so:

    18:12:34 G29 100 points probed, mean error 0.001, deviation 0.045
    Height map saved to file heightmap.csv
    18:06:59 M561
    18:05:16 G32 Bed equation fits points [30.0, 25.0, -0.093] [30.0, 265.0, -0.108] [270.0, 265.0, -0.125] [270.0, 25.0, -0.070] [150.0, 145.0, -0.007]
    18:04:26 G28
    18:04:04 M561

    so ran M561 to clear any data then G28 to home and G32 to bed level (I added the home point to the probe list and got :

    0_1535908788491_bed leveling compensation.PNG
    which says my home point in the center is correct and the rest is low!

    then ran M561 to clear data and G29 and got:

    0_1535908936387_mesh leveling.PNG

    so do I just ignore the Z offset as if I am interpreting these correctly it seems to be correct and the deviation was the bed not an offset.

    really confused now 🙃 🙃


  • administrators

    I suggest you upgrade to firmware 2.01. There was an issue in older firmware versions if you homed Z using a Z probe and you already had a height map loaded.



  • @dc42

    thank you I was starting to think i was going potty LOL

    as I am not critical production any mileage in going with your 2.02 RC? I can live with testing and as its a simple machine I am happy to do so but at the same time as a newbie I dont know how polished your RC's are so it may not be a good plan.



  • Your homeall.g looks a little strange to me. It may be perfectly valid, but it doesn't match what I would consider normal usage.

    ; homeall.g
    ; called to home all axes
    ;
    ; generated by RepRapFirmware Configuration Tool on Thu Aug 30 2018 16:44:49 GMT+0100 (British Summer Time)
    G91                	 ; relative positioning
    G1 Z5 F200 S2      	 ; lift Z relative to current position
    G1 S1 X-315 Y315 F6000	 ; move quickly to X and Y axis endstops and stop there (first pass)
    G1 X5 Y-5 F6000    	 ; go back a few mm
    G1 S1 X-315 Y315 F360	 ; move slowly to X and Y axis endstops once more (second pass)
    G1 X150 Y-145 F6000  	 ;MOVE QUICKLY TO MIDDLE OF BED
    G1 Z5 F200 S2  		 ; lift Z relative to current position
    G30 s-2			; Home Z axis
    ;G1 S1 Z-405 F200     	 ; move Z down stopping at the endstop
    G90                  	 ; absolute positioning
    G92 Z0
    
    ; Uncomment the following lines to lift Z after probing
    G91                  ; relative positioning
    G1 S2 Z5 F200        ; lift Z relative to current position
    G90                  ; absolute positioning
    

    First, you're lifting the head twice. Once for clearance to move X and Y, and again before the Z probe. The G30 probe command is use the configured dive height from M558 in config.g so it's not necessary to raise the head the second time.

    Then to probe the bed you're using G30 S-2 instead of just a G30. And then you're using G92 Z0 to set the Z height. This seems odd to me. I don't think you're intending to change your Z offset every time you home, are you?

    https://duet3d.dozuki.com/Wiki/GCode#Section_G30_Single_Z_Probe

    G30 ; Probe the bed at the current XY position. When the probe is triggered, set the Z coordinate to the probe trigger height.
    G30 S-1 ; Probe the bed at the current XY position. When the probe is triggered, do not adjust the Z coordinate.
    G30 S-2 ; Probe the bed at the current XY position. When the probe is triggered, adjust the Z offset of the current tool to make the current position Z=0.

    I would use G30 instead of G30 S-2 and remove the G92 Z0. You can then move Z to whatever height you want and move the head back to 0,0 if you like.

    For your config.g you should

    • Add M574 Z1 S2 ; Set endstops controlled by probe
    • Remove the X0 Y0 Z0 from M558
    • Measure your X Y Z offsets for your G31 command (X and Y would be zero if you are using a nozzle touch probe like a piezo, which I think maybe you are?)


  • @opentoideas said in G28 G32 homeall and probe offset confusion:

    as I am not critical production any mileage in going with your 2.02 RC? I can live with testing and as its a simple machine I am happy to do so but at the same time as a newbie I dont know how polished your RC's are so it may not be a good plan.

    I think you'll be fine running the betas and release candidates. However, I think the issue DC42 mentioned was already fixed in 2.0.

    If G30 was used to set an accurate Z height after mesh bed probing or loading a height map, if bed compensation was then cancelled then any Z offset from the height map remained. One consequence of this was that if bed probing was run again, the original height map Z offset was carried through to the new one, but the sign of the offset was reversed.



  • @phaedrux thank you.

    Yes its a piezzo got the kit from DjDemon. All of that makes perfect sense will make the changes in the morning as I have a new PSU to wire in and hopefully the hotend so will be able to test fully.

    Thanks for the explanation. While I am trying to piece bits together I dont fully understand the G code yet so Not surprised I am making daft errors so the explanation is a huge help.



  • @Phaedrux

    thank you again. I have tidied up the home and config files as you suggested and oddly dont seem to need an offset when probing in the center of the bed. with repeated G30 S1 I get the probe triggering at 0 and with a manual check it seems correct.

    what I have found however is that the bed mount on the CR-10 is rubbish. despite the best attempts to make it as solid as possible it flexes the carriage when probing.

    I think manual leveling will be best for the moment and perhaps in future a redesign of the bed mount.

    thank you again for your help with sorting the code out.



  • That would make sense as the center of the bed would be the best supported and therefore stiffest and trigger best with the piezo.

    You can test g30 s-1 at multiple locations on the bed to see how consistent it is.



  • @phaedrux

    yes that's what I was doing and in the end I gave up as i could not get any consistency at all from the probe - error all the way from 0 to 1.3mm to no response and a crush of the nozzle.

    this was no fault of the piezo as between the flex in the bed and the flex of the head mount nothing was consistent.

    one of the issues is the cheap bearings used as they have a degree of end float that cant be dealt with so I am going for an over the top solution and will order a set of cheap MGN12 rails.

    while I dont expect the quality to be great it will be better than replacing the flawed system of rollers already there and is an easy win to stabilise the bed. Though I expect a fair bit of work to get them running well and fitted true.

    is it a worthwhile upgrade? probably not, but I like fettling and it will be a fun project and not any more expensive than replacing the bearings used in it.

    that's today's plan anyway - tomorrows may be different!


 

Looks like your connection to Duet3D was lost, please wait while we try to reconnect.