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

    G3 puzzle or bug

    Scheduled Pinned Locked Moved
    General Discussion
    2
    6
    280
    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.
    • MJLewundefined
      MJLew
      last edited by

      I have an interesting puzzle whereby I can print circles with G3 as long as the circles are not exactly 8.8mm diameter. The 8.8mm circles fail with the message "Error: G2/G3: bad combination of parameter values", but if I make the circles 8.8001mm or 8.799mm they work properly.

      I have not found another 'magical' diameter that fails, but I'm a bit concerned that there might still be a bug in the G3 arc firmware code.

      Here is a two layer circle file that fails: test13 8.8.gcode
      And here is one that works: test13 8.8001.gcode

      MJLewundefined 1 Reply Last reply Reply Quote 0
      • MJLewundefined
        MJLew @MJLew
        last edited by

        @MJLew Sorry, I uploaded two files that fail (the second is a misnamed copy of the first, I think). Here is a two layer circle that works: test12 8.8001.gcode

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

          Thanks for your interesting example! It appears to be caused by the combination of the arc being exactly 180 degrees and floating point rounding error. The firmware is calculating this quantity, which is required to be non-negative:

          R^2 - (dX^2 + dY^2)/4

          In your example this is:

          (4.4)^2 - ((55.6-64.4)^2 + (50.0-50.0)^2)/4

          which of course should be exactly zero. However, the values 55.6, 64.4 and 4.4 can't be represented exactly in IEEE floating int format, so when 64.4 is subtracted from 55.6 the result is slightly larger than minus twice the radius.

          I think the way I can fix this is to detect when the two terms being subtracted in the overall computation are very close leading to a slightly negative amount, and in such cases increase the radius just enough (one LSB is probably enough) to make the overall difference zero.

          I propose to include this fix in RRF 3.3.

          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
            last edited by

            I have now included this fix in the RRF 3.3 source code. I also changed the error message to "G2/G3: radius is too small to reach endpoint". If you would like an unofficial build to try, let me know which Duet you are using.

            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
            • MJLewundefined
              MJLew
              last edited by

              Ah, I would never hav worked that out. It seems like I should simply make three segments in the circles. I'll give that a go tomorrow.

              Thanks for fixing it.

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

                @MJLew said in G3 puzzle or bug:

                Ah, I would never hav worked that out. It seems like I should simply make three segments in the circles. I'll give that a go tomorrow.

                Either that, or increase the radius by a tiny amount.

                BTW there is a standard CNC way of doing an entire circle using one G2/G3 command, which recent versions of RRF support.

                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
                • First post
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA