Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    bed.h how to update heightmap.csv ?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    4
    12
    371
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • arhiundefined
      arhi
      last edited by arhi

      I do something like the example on https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands ... I perform 25 G30's on each of 25 calibration points and now what? It does not update height map. How to enter now the current data in to the heihtmap.csv ?

      Can someone also explain the deviation? @dc42 ? 'cause I do 25 times G30 and I shoot M409 and ...

      M409 K"move.calibration" F"v,n,d9"
      {"key":"move.calibration","flags":"v,n,d9","result":{"final":{"deviation":0,"mean":0},"initial":{"deviation":0,"mean":0},"numFactors":0}}
      

      I can quarantee that my bed is not that flat 🙂

      my bed.g

      ; bed.g
      ; called to perform automatic bed compensation via G32
      
      M400
      M913 X30 Y30 Z30
      M566 Z0
      M201 Z20.00
      
      G29 S2 ; delete compensations
      M561   ; clear any bed transform
      
      ; G31 P{sensors.probes[0].value[0] + 8}
      ; G29 S0 
      
      echo "Starting calibration. Initial deviation: (" ^ move.calibration.initial.deviation ^ "mm)"
      
      ; X points: -110, -55, 0, 55, 110
      ; Y points: -100, -50, 0, 50, 100
      
      while true
        if iterations = 5
          abort "Too many auto calibration attempts"
        G28
      
        G1 X-110 Y-100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P0 X-110 Y-100 Z-9999
        if result != 0
          echo "ERROR P0"
          continue
        echo "DONE P0"
        
        G1 X-55 Y-100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P1 X-55 Y-100 Z-9999
        if result != 0
          echo "ERROR P1"
          continue
        echo "DONE P1"
        
        G1 X0 Y-100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P2 X0 Y-100 Z-9999
        if result != 0
          echo "ERROR P2"
          continue
        echo "DONE P2"
      
        G1 X55 Y-100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P3 X55 Y-100 Z-9999
        if result != 0
          echo "ERROR P3"
          continue
        echo "DONE P3"
      
        G1 X110 Y-100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 10}
        G30 P4 X110 Y-100 Z-9999
        if result != 0
          echo "ERROR P4"
          continue
        echo "DONE P4"
      
        G1 X110 Y-50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P5 X110 Y-50 Z-9999
        if result != 0
          echo "ERROR P5"
          continue
        echo "DONE P5"
      
        G1 X55 Y-50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P6 X55 Y-50 Z-9999
        if result != 0
          echo "ERROR P6"
          continue
        echo "DONE P6"
      
        G1 X0 Y-50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P7 X0 Y-50 Z-9999
        if result != 0
          echo "ERROR P7"
          continue
        echo "DONE P7"
      
        G1 X-55 Y-50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P8 X-55 Y-50 Z-9999
        if result != 0
          echo "ERROR P8"
          continue
        echo "DONE P8"
      
        G1 X-110 Y-50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P9 X-110 Y-50 Z-9999
        if result != 0
          echo "ERROR P9"
          continue
        echo "DONE P9"
      
        G1 X-110 Y0 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P10 X-110 Y0 Z-9999
        if result != 0
          echo "ERROR P10"
          continue
        echo "DONE P10"
      
        G1 X-55 Y0 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P11 X-55 Y0 Z-9999
        if result != 0
          echo "ERROR P11"
          continue
        echo "DONE P11"
      
        G1 X0 Y-0 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P12 X0 Y0 Z-9999
        if result != 0
          echo "ERROR P12"
          continue
        echo "DONE P12"
      
        G1 X55 Y0 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P13 X55 Y0 Z-9999
        if result != 0
          echo "ERROR P13"
          continue
        echo "DONE P13"
      
        G1 X110 Y0 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P14 X110 Y0 Z-9999
        if result != 0
          echo "ERROR P14"
          continue
        echo "DONE P14"
        
        G1 X110 Y50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P15 X110 Y50 Z-9999
        if result != 0
          echo "ERROR P15"
          continue
        echo "DONE P15"
      
        G1 X55 Y50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P16 X55 Y50 Z-9999
        if result != 0
          echo "ERROR P16"
          continue
        echo "DONE P16"
      
        G1 X0 Y50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P17 X0 Y50 Z-9999
        if result != 0
          echo "ERROR P17"
          continue
        echo "DONE P17"
      
        G1 X-55 Y50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P18 X-55 Y50 Z-9999
        if result != 0
          echo "ERROR P18"
          continue
        echo "DONE P18"
      
        G1 X-110 Y50 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P19 X-110 Y50 Z-9999
        if result != 0
          echo "ERROR P19"
          continue
        echo "DONE P19"
      
        G1 X-110 Y100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P20 X-110 Y100 Z-9999
        if result != 0
          echo "ERROR P20"
          continue
        echo "DONE P20"
      
        G1 X-55 Y100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P21 X-55 Y100 Z-9999
        if result != 0
          echo "ERROR P21"
          continue
        echo "DONE P21"
      
        G1 X0 Y100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P22 X0 Y100 Z-9999
        if result != 0
          echo "ERROR P22"
          continue
        echo "DONE P22"
      
        G1 X55 Y100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P23 X55 Y100 Z-9999
        if result != 0
          echo "ERROR P23"
          continue
        echo "DONE P23"
      
        G1 X110 Y100 Z5 F9000
        M400
        G4S1
        M400
        G31 P{sensors.probes[0].value[0] + 8}
        G30 P24 X110 Y100 Z-9999
        if result != 0
          echo "ERROR P24"
          continue
        echo "DONE P24"
      
        if move.calibration.final.deviation <= 0.03
          break
        echo "Repeating calibration because deviation is too high (" ^ move.calibration.final.deviation ^ "mm)"
      
      M409 K"move.calibration" F"v,n,d9"
      echo "Auto calibration successful, deviation", move.calibration.final.deviation ^ "mm"
      echo "mean", move.calibration.final.mean ^ "mm"
      G1 X0 Y0 Z5 F9000
      
      M913 X100 Y100 Z100
      M566 Z100.00
      M201 Z50.00
      

      probe config

      M558 P1 C"zprobe.in" R2 H5 F1200 T3000 A3 S0.03 K0 
      G31 X0 Y0 Z0 P780 
      M376 H10                                         ; taper compensation during 10mm
      M557 X-110:110 Y-100:100 P5:5                    ; define mesh grid
      
      1 Reply Last reply Reply Quote 0
      • arhiundefined
        arhi
        last edited by

        problems

        • result from G30 is unclear
          G30 P24 X110 Y100 Z-9999
          if result != 0
            echo "ERROR P24"
            continue
          echo "DONE P24"
        

        no matter if G30 succeeds or not this will always be "DONE", never "ERROR" - why?

        • after all points are probed heatmap.csv is not updated, how to do that?
        • move.calibration.* is all always 0
        dc42undefined 1 Reply Last reply Reply Quote 0
        • gtj0undefined
          gtj0
          last edited by

          Unless I missed soemthing recently, only G29 updates heightmap.csv
          https://duet3d.dozuki.com/Wiki/Gcode#Section_G29_Mesh_bed_probe

          arhiundefined 2 Replies Last reply Reply Quote 0
          • dc42undefined
            dc42 administrators @arhi
            last edited by dc42

            @arhi said in bed.h how to update heightmap.csv ?:

            no matter if G30 succeeds or not

            What do you mean by "succeeds" in this context? A G30 command will fail if either the Z probe is already triggered at the start of the probing move, or if the probing move ends without it being triggered.

            Duet WiFi hardware designer and firmware engineer
            Please do not ask me for Duet support via PM or email, use the forum
            http://www.escher3d.com, https://miscsolutions.wordpress.com

            arhiundefined 1 Reply Last reply Reply Quote 0
            • arhiundefined
              arhi @dc42
              last edited by

              @dc42 the G30 part I mentioned in details in https://forum.duet3d.com/topic/15491/help-with-conditions-in-variable-g-code

              I get the Error: Z probe already triggered at start of probing move and then result is again 0 😞

              1 Reply Last reply Reply Quote 0
              • arhiundefined
                arhi @gtj0
                last edited by

                @gtj0 said in bed.h how to update heightmap.csv ?:

                Unless I missed soemthing recently, only G29 updates heightmap.csv

                yes, but with what? the calibration object show 0 deviation.
                When I hit G29S0 it will probe and update the map with that data..
                I'll try S3 and see what it will be in the file 🙂

                1 Reply Last reply Reply Quote 0
                • arhiundefined
                  arhi @gtj0
                  last edited by

                  @gtj0 said in bed.h how to update heightmap.csv ?:

                  Unless I missed soemthing recently, only G29 updates heightmap.c

                  This is what G29 saves after 25 G30's:

                  RepRapFirmware height map file v2 generated at 2020-04-10 15:47, min error 9999.000, max error -9999.000, mean 0.000, deviation 0.000
                  xmin,xmax,ymin,ymax,radius,xspacing,yspacing,xnum,ynum
                  0.00,-1.00,0.00,-1.00,-1.00,0.00,0.00,0,0
                  
                  1 Reply Last reply Reply Quote 0
                  • arhiundefined
                    arhi
                    last edited by

                    Seems to me I'm missing something. The min/max is wrong here, so there's maybe some config required addional to what I have? I copied @dc42 example but obviously missed something.

                    I have
                    M557 X-110:110 Y-100:100 P5:5
                    then I do bunch of G30's
                    and G29 stores #^%$^@#$%^ in the file 😞

                    1 Reply Last reply Reply Quote 0
                    • arhiundefined
                      arhi
                      last edited by

                      Missing S 😞

                      On the last G30 command in the sequence, the S parameter indicates that a complete set of points has been probed and instructs the firmware what sort of calibration to perform. If the value is -1 then the Z offsets of all the points probed are printed, but no calibration is done. If the value is zero or not present, then this specifies that the number of factors to be calibrated is the same as the number of points probed. Otherwise, the value indicates the number of factors to be calibrated, which must be no greater than the number of points probed. From version 1.09, the number of factors may be 3, 4 or 5 when doing old-style auto bed compensation on a Cartesian or CoreXY printer, and 3, 4, 6, 7, 8 or 9 when doing auto calibration of a Delta printer.

                      hm, 0 is "all probed points" or for cartesian 3,4,5 ... but I have 25 points ?! .. so doing S0

                      Error: Probe points P0 to P3 must be in clockwise order starting near minimum X and Y, and P4 must be near the centre
                      ERROR P24
                      

                      I listed the points in the same way G29S0 probes minx,miny going towards maxx, than one y up down to maxx one y up up to max ... so zigzag optimal path trough bed for all 25 points....

                      @dc42 you did 15 points and finished with S8 but that's delta... how to do it for cartesian?

                      1 Reply Last reply Reply Quote 0
                      • arhiundefined
                        arhi
                        last edited by arhi

                        Can't make this with any S value 😞 .. no clue what's up.

                        With S-1 I get the probed points, calculated mean.. but why does S0 or S25 or S4 complain with clockwise , centre etc etc..

                        G32 bed probe heights: 0.025 0.008 0.011 -0.017 -0.014 -0.004 0.030 0.003 0.013 0.029 0.042 0.011 0.000 0.007 -0.014 -0.003 0.011 0.003 0.012 0.043 0.018 -0.012 -0.011 -0.008 -0.010, mean 0.007, deviation from mean 0.017

                        Phaedruxundefined 1 Reply Last reply Reply Quote 0
                        • Phaedruxundefined
                          Phaedrux Moderator @arhi
                          last edited by

                          I'm really not clear on what you're trying to do. It seems like you're trying to duplicate the functionality of G29 using defined points in bed.g? But why?

                          @arhi said in bed.h how to update heightmap.csv ?:

                          S25 or S4

                          G29 S25 is definitely not a valid command.

                          https://duet3d.dozuki.com/Wiki/Gcode#Section_G29_Mesh_bed_probe

                          G29 uses the grid established by M557
                          https://duet3d.dozuki.com/Wiki/Gcode#Section_M557_Set_Z_probe_point_or_define_probing_grid

                          Z-Bot CoreXY Build | Thingiverse Profile

                          arhiundefined 1 Reply Last reply Reply Quote 0
                          • arhiundefined
                            arhi @Phaedrux
                            last edited by

                            @Phaedrux said in bed.h how to update heightmap.csv ?:

                            G29 S25 is definitely not a valid command.

                            I'm not doing G29S25, I'm doing G30, if you look at the G30 it states that after you finish probing all points the last point you probe should have S parameter. If you look at the sample g-code @dc42 made in the documentation he's probing 15 points with G30 for the delta and then on the last 15th point on G30 he adds S8. T S is not really explained in the G30 documentation, the "From version 1.09, the number of factors may be 3, 4 or 5 when doing old-style auto bed compensation on a Cartesian or CoreXY printer, and 3, 4, 6, 7, 8 or 9 when doing auto calibration of a Delta printer." is not too clear for me :(. @dc42 is using S8 (no clue why 8 and not 3 or 9?!?!). I'm totally confused.

                            I'm really not clear on what you're trying to do. It seems like you're trying to duplicate the functionality of G29 using defined points in bed.g? But why?

                            For start to figure out better how variable g-code works.

                            The other thing is, this Orion probe is not very stable and changing the trashold before every probe move makes it a lot more repeatable. It still can happen that a point is not probed properly. In case G29S0 (what I do use now) it will fail and will not retry. In case of my script, it will retry 5 times to probe a mesh + it sets the trigger trashold before every move making the probe much more reliable and precise.

                            Anyhow, my bed is pretty "tight" so I do mesh leveling once every few months only so I don't have a problem using G29S0 and retrying few times if there's a problem, the "figuring how variable g-code works" is really the main reason.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Unless otherwise noted, all forum content is licensed under CC-BY-SA