Feb 04 2022
09:30 AM andypugh: Lcvette[m]: https://github.com/LinuxCNC/linuxcnc/issues/1528
03:01 PM andypugh: cradek: jepler[m] seb_kuzminsky rene-dev5 Currently both the preview interpreter and motion use the angle between the start and end points of an arc to decide if the start and end coordinates are “identical” and if so it is assumed that a full turn was wanted.
03:02 PM andypugh: https://github.com/LinuxCNC/linuxcnc/blob/master/src/libnml/posemath/_posemath.c#L1824
03:03 PM andypugh: https://github.com/LinuxCNC/linuxcnc/blob/master/src/emc/rs274ngc/gcodemodule.cc#L1002
03:03 PM andypugh: They calculate the angle in different ways and get slightly different results.
03:04 PM andypugh: A problem arises if a _very_ large radius is computed to generate a nearly-straight line.
03:05 PM andypugh: (In the example in issue 1528 one of the problem arcs is 5mm long, but has a 7km radius…)
03:06 PM andypugh: Given that arcs are programmed in terms of XY coordinates, I think it makes no sense to judge the smallness of an arc by internal angle. I propose doing it purely on the basis of hypotenuse distance in the plane.
03:27 PM roycroft: while this has nothing to do with cnc machining (at the moment), i'll mention that i cut short arcs with large radii on a regular basis
03:27 PM roycroft: although nothing near the extreme example you gave above
03:27 PM roycroft: when my new router is completed and working, however, those arcs that i cut will be cnc related
03:41 PM andypugh: How short?
03:43 PM roycroft: my stuff?
03:43 PM andypugh: Yes.
03:44 PM andypugh: Currently any arc shorter than 10nm will be interpreted as a full circle.
03:45 PM andypugh: And I can see an argument that that is actually a bit too long..
03:48 PM roycroft: i'd say the arcs i cut, and this is in wood, mind you, are usually 100-300mm long, but with a radius that may be several meters
03:48 PM roycroft: so that may not be relevant to what you're talking about at all
03:49 PM roycroft: i do that with routers on long sticks that have a pivot pin in the far end of the stick currently
03:49 PM andypugh: I am taking tadius ouf ot the reckoning. But I have found stages with 2nm resolution. Whether you would expect to do circular interpoaltion with one is debatable: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=11246
03:49 PM roycroft: when my router is built i'll be doing it with the cnc router
03:50 PM roycroft: cutting shallow arcs is a big reason i'm building this machine
03:51 PM andypugh: Yes. And I see nothing wrong with cuttting a 5mm long 7km radius arc (which prompted all this)
03:52 PM roycroft: no, there should be nothing at all wrong with that
04:12 PM Tom_L: andypugh, what cad supports a 7km radius?
04:12 PM Tom_L: i suppose most of the 'better' ones would
04:13 PM andypugh: The initial problem was that FreeCAD generated G-code with it.
04:13 PM Tom_L: hmm
04:16 PM andypugh: See the issuelink up the page
04:21 PM rene-dev5: andypugh oh boy
04:21 PM rene-dev5: is that true that the preview is imperial?
04:21 PM rene-dev5: Tom_L autocad, it it one of the few cad systems suitable for designing railway lines. dont ask how I know.
04:21 PM andypugh: Seems to be, for the same metric G-code I see:
04:22 PM rene-dev5: many other cad systems have similar problems with huge radii
04:23 PM andypugh: len = 3.937008e-10 FUZZ = 1.000000e-08
04:23 PM andypugh: d = 1.000000e-08 FUZZ = 1.000000e-08
04:24 PM andypugh: len is calculated in gcodemodule, d in _posemath.c
04:24 PM andypugh: And it’s a 1mm move.
04:24 PM andypugh: Sorry, it’s a 0.00000001mm move.
04:25 PM Tom_L: linuxcnc would likely error out on it due to the limits of the work envelope
04:25 PM rene-dev5: I once grepped for inch, metric, and stuff a while ago, and it seemd like that it was converted in more places than necessary
04:25 PM roycroft: solidworks certainly would not let me draw that arc
04:25 PM Tom_L: i dunno what catia would do
04:26 PM roycroft: openscad might
04:26 PM andypugh: Tom_L: Well, that was the problem, despite the fact that it was a 5mm move, LinuxCNC wouldn’t let it cut as it exceeded the work envelope after being converted from a 5mm arc to a 7km circle.
04:27 PM andypugh: Fusion360 just let me draw a 100km radius arc 11 inches long :-)
04:27 PM Tom_L: catia also converts on the fly
04:28 PM Tom_L: to whatever the primary system is selected
04:28 PM rene-dev5: andypugh isnt the real problem that there is no gcode for a full circle?
04:29 PM rene-dev5: a full circle without ambiguity would require 2 gcodes?
04:29 PM roycroft: solidworks does that too, tom_l, as i recently discovered
04:29 PM roycroft: it even takes mixed-unit input, which is nice
04:30 PM roycroft: i needed to locate some metric blocks that had mounting holes 6mm in from the side 1-1/8" in from the edge of a part
04:31 PM roycroft: in the dimension i specified the hole distance as 1.125in+6mm and it worked just fine
04:31 PM andypugh: rene-dev5: Yes. Though you could be unambiguous by requiring that a full circle should have _no_ axis words.
04:31 PM roycroft: that's a real advantage over autocad, which is unitless, and as such has no concept of mixed units
04:32 PM Lcvette[m]: andypugh: you use fusion360?
04:32 PM andypugh: Yes.
04:32 PM rene-dev5: I wonder how other controllers deal with this
04:36 PM rene-dev5: heidenhain requires 2 arcs for a full circle
04:38 PM rene-dev5: https://content.heidenhain.de/doku/tnc_guide/pdf_files/TNC640/34059x-07/diniso/892909-25.pdf
04:38 PM rene-dev5: page 262
04:41 PM * Lcvette[m] uploaded an image: (66KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/HsyMVNwKJKkxVgFnmCcJADgc/image.png >
04:42 PM Lcvette[m]: andypugh: this code that fusion spits out with all the line segments
04:43 PM Lcvette[m]: this was what made my machine shake so violently
04:44 PM andypugh: Did you have G64 turned on https://linuxcnc.org/docs/2.8/html/user/user-concepts.html#_trajectory_control
04:45 PM Lcvette[m]: but i was curious how linuxcnc was interpereting these that it made the machine shake, almost seemed as if it was trying to stop at each point
04:45 PM Lcvette[m]: i ultimately resolved by just using stay down least and let the head lift to clearnce plane and straight line reposition to the next lead in start location
04:45 PM Lcvette[m]: for clarification it was the yellow line repositioning moves that were scary
05:12 PM andypugh: This sounds a lot like G61
05:12 PM Lcvette[m]: was in G64 and i tried P values as loose as 0.010" to no avail
05:35 PM andypugh: I guess if you set a very high acceleration limit G64 won’t bother blending much.
05:35 PM Lcvette[m]: i backed accel down to 30
05:35 PM Lcvette[m]: in the ini
05:36 PM Lcvette[m]: didn't help too much
05:48 PM andypugh: rene-dev5: Ah heck! With G21 in an imperial config, I get a circle in motion, but not the preview.
05:54 PM andypugh: It looks like motion is in the machine base units. And (probably) the preview converts to inch.
06:20 PM rene-dev5: oh boy
06:22 PM rene-dev5: the preview and backlog seems so be a bigger mess than anticipated
06:22 PM rene-dev5: have you looked at preview and backlog code? its hard to even find it.
06:27 PM andypugh: I don’t dare. I have already found 5 places that happliy divife by zero if circle->angle == 0
06:27 PM Tom_L: hindsight