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

    Calibrating a delta printer using conditional GCode

    Scheduled Pinned Locked Moved
    Beta Firmware
    7
    11
    513
    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.
    • dc42undefined
      dc42 administrators
      last edited by

      I'm almost ready to release RRF 3.1beta with conditional GCode support. I've tested it using a G32 script to calibrate my delta printer. At the start, it homes the printer only if it hasn't already been homed. Then it calibrates the printer by probing a number of points, starting again if probing fails. If calibration yields a standard deviation that is above a limit, it repeats the calibration process. If calibration fails 5 times for any reason, it quits. Here is the script:

      ; Auto calibration routine for large delta printer
      M561                         ; clear any bed transform
      
      ; If the printer hasn't been homed, home it
      if !Move.Axes[0].Homed || !Move.Axes[1].Homed || !Move.Axes[2].Homed
        G28
      
      ; Probe the bed and do auto calibration
      G1 X0 Y140 Z10 F10000        ; go to just above the first probe point
      while true
        if iterations = 5
          abort "Too many auto calibration attempts"
        G30 P0 X0.00 Y140.00 Z-99999
        if result != 0
          continue
        G30 P1 X70.00 Y121.24 Z-99999
        if result != 0
          continue
        G30 P2 X121.24 Y70.00 Z-99999
        if result != 0
          continue
        G30 P3 X140.00 Y0.00 Z-99999
        if result != 0
          continue
        G30 P4 X121.24 Y-70.00 Z-99999
        if result != 0
          continue
        G30 P5 X70.00 Y-121.24 Z-99999
        if result != 0
          continue
        G30 P6 X0.00 Y-134.85 Z-99999
        if result != 0
          continue
        G30 P7 X-65.57 Y-113.57 Z-99999
        if result != 0
          continue
        G30 P8 X-112.29 Y-64.83 Z-99999
        if result != 0
          continue
        G30 P9 X-130.59 Y-0.00 Z-99999
        if result != 0
          continue
        G30 P10 X-115.90 Y66.91 Z-99999
        if result != 0
          continue
        G30 P11 X-69.45 Y120.29 Z-99999
        if result != 0
          continue
        G30 P12 X0.00 Y70.00 Z-99999
        if result != 0
          continue
        G30 P13 X60.62 Y-35.00 Z-99999
        if result != 0
          continue
        G30 P14 X-52.28 Y-30.19 Z-99999
        if result != 0
          continue
        G30 P15 X0 Y0 Z-99999 S8
        if result != 0
          continue
        if Move.CalibrationDeviation <= 0.03
          break
        echo "Repeating calibration because deviation is too high (" ^ Move.CalibrationDeviation ^ "mm)"
      ; end loop
      echo "Auto calibration successful, deviation", Move.CalibrationDeviation ^ "mm"
      G1 X0 Y0 Z150 F10000                ; get the head out of the way
      

      You can read what the commands mean at https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands.

      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

      infiniteloopundefined 1 Reply Last reply Reply Quote 2
      • A Former User?
        A Former User
        last edited by

        This is better than sliced bread!

        1 Reply Last reply Reply Quote 0
        • garyd9undefined
          garyd9
          last edited by

          I'm curious to know what might be used with the "Move" construct. The example shows "Move.Axes[]" and "Move.CalibrationDeviation", but I don't see anything showing what else is available.

          For example, the homing script might be modified to continue attempting to re-calibrate until either 5 iterations are reached, OR the difference between the "deviation before" and "deviation after" is less than 0.02.

          "I'm not saying that you are wrong - I'm just trying to fit it into my real world simulated experience."

          dc42undefined 1 Reply Last reply Reply Quote 0
          • infiniteloopundefined
            infiniteloop @dc42
            last edited by

            @dc42 When dreams come true…

            Just one question: it looks like „iterations“ is an implicit property of the while loop. If so, can I change that property from within the loop? Or can I evaluate it in a conditional statement?

            dc42undefined 1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @infiniteloop
              last edited by

              @infiniteloop said in Calibrating a delta printer using conditional GCode:

              @dc42 When dreams come true…

              Just one question: it looks like „iterations“ is an implicit property of the while loop. If so, can I change that property from within the loop? Or can I evaluate it in a conditional statement?

              You can use it in any expression, including a condition ('if', 'while' etc.) but you can't change it. Currently you can't define your own variables, so I included 'iterations' to make counted loops possible.

              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

              1 Reply Last reply Reply Quote 0
              • dc42undefined
                dc42 administrators @garyd9
                last edited by

                @garyd9 said in Calibrating a delta printer using conditional GCode:

                I'm curious to know what might be used with the "Move" construct. The example shows "Move.Axes[]" and "Move.CalibrationDeviation", but I don't see anything showing what else is available.

                See https://forum.duet3d.com/topic/13797/where-can-i-find-rrf3-0-object-model-reference-material.

                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

                1 Reply Last reply Reply Quote 0
                • DaBitundefined
                  DaBit
                  last edited by

                  Ooooohhhhhh yeah! More intelligent nozzle wipe process on toolchange possible soon!

                  Anxiously awaiting the beta..

                  1 Reply Last reply Reply Quote 0
                  • Danalundefined
                    Danal
                    last edited by

                    Wowzers!!! That is FANTASTIC and what a great starting 'proof'.

                    Now I have a reason to go RRF3 on my Duet2 hardware!

                    Delta / Kossel printer fanatic

                    1 Reply Last reply Reply Quote 0
                    • fmaundefined
                      fma
                      last edited by

                      wouldn't it be better to use '==' for comparison, rather than '='?

                      Frédéric

                      dc42undefined 1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @fma
                        last edited by

                        @fma said in Calibrating a delta printer using conditional GCode:

                        wouldn't it be better to use '==' for comparison, rather than '='?

                        Why? But the syntax allows both anyway.

                        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

                        1 Reply Last reply Reply Quote 0
                        • fmaundefined
                          fma
                          last edited by

                          To avoid confusion with variable assignement, but I just saw in the documentation than you will use 'set' for that purpose. Good to have both notations.

                          Frédéric

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