GRBL Error 33: Arc Coordinates vs. Decimal Places

The LinuxCNC G2/G3 arc command doc has this to say about numerical precision:

When programming arcs an error due to rounding can result from using a precision of less than 4 decimal places (0.0000) for inch and less than 3 decimal places (0.000) for millimeters.

So I normally set GCMC to produce three decimal digits, because its default of eight digits seems excessive for my usual millimeter measurements, and assume whatever G-Code sender I use won’t chop digits off the end in passing. Mistakenly setting bCNC to round at two decimal places showed what happens with fewer digits, as bCNC’s default is four decimal digits.

A closer look at the coordinates in the lower right part of the spreadsheets (from yesterday) shows the limited accuracy with two decimal digits:

Spreadsheet - GCMC 2 digit - full path - detail
Spreadsheet – GCMC 2 digit – full path – detail

The red blocks mark the first failing arc, where the relative error falls out of tolerance. If GRBL were less fussy (which it should not be), then the next arcs would proceed as shown.

Rounding to three decimal digits pushes the errors into to the third place, with the yellow highlight marking the worst errors:

Spreadsheet - GCMC 3 digit - detail
Spreadsheet – GCMC 3 digit – detail

As you should expect, the smallest arcs have the largest relative errors, although they’re now well within GRBL’s (and LinuxCNC’s, for that matter) limits.

Rounding to four decimal digits makes the errors vanishingly small:

Spreadsheet - GCMC 4 digit - detail
Spreadsheet – GCMC 4 digit – detail

So, by and large, don’t scrimp on the decimal digits … but we knew that already.

I’d been setting GRBL to produce three decimal places, but now I’m using four. Adding a few characters to each G-Code command reduces the number of commands fitting into GRBL’s buffer space, but bCNC normally keeps it around 90% full, so the path planner should remain perfectly happy.

, , ,

Leave a comment

GRBL Error 33: G-Code Arc Tolerances

After figuring out how two-place decimal fractions caused this blooper, I had to poke into the debris field surrounding the crash:

Tek CC - top deck - failed arcs
Tek CC – top deck – failed arcs

The bCNC Terminal trace stops at the first failure, so I set GCMC to produce two-place fractions (“Number of decimals less than 3 severely limits accuracy”), then rammed the NGC file’s G-Code into a spreadsheet:

Spreadsheet - GCMC 2 digit - full path
Spreadsheet – GCMC 2 digit – full path

The last two columns (perhaps you must open the image in a new tab to see the whole thing) compute the GRBL error values: the absolute difference between the two radii and that difference as a fraction of the radius. The R Error header under Start should be X, of course; I’ll regenerate the images for the DM column.

The reduced accuracy of the two-digit fractions triggers the error marked by the red cells, where the radii differ by 0.0082 mm (>0.005) and the relative error is 0.17% (>0.1%).

Suppressing the first failed arc by passing the same starting point to the next arc simulates the second failure:

Spreadsheet - GCMC 2 digit - suppress first failed arc
Spreadsheet – GCMC 2 digit – suppress first failed arc

Similarly, the third arc from the same point fails:

Spreadsheet - GCMC 2 digit - suppress second failed arc
Spreadsheet – GCMC 2 digit – suppress second failed arc

The fourth arc becomes a full circle and produces the circular gash across the deck:

Spreadsheet - GCMC 2 digit - suppress third failed arc
Spreadsheet – GCMC 2 digit – suppress third failed arc

Two digits definitely aren’t enough!


1 Comment

bCNC Rounding vs. G-Code Arcs: GRBL Error 33

While cutting the top deck of the Pickett-flavored Tek Circuit Computer on the MPCNC, this happened:

Tek CC - top deck - failed arcs
Tek CC – top deck – failed arcs

I traced the off-center circle with a marker to make it more visible, as it’s the drag knife cut that should have been the exit move after completing the window.

Huh. It never did that before …

The bCNC plot looked fine, but the Terminal log showed three Error 33 reports:

Failed arc command - bCNC screen - terminal and plot
Failed arc command – bCNC screen – terminal and plot

The GRBL doc has this to say about Error 33:

The motion command has an invalid target. G2, G3, and G38.2 generates this error, if the arc is impossible to generate or if the probe target is the current position.

The error messages don’t occur immediately after the failing G2/G3 command, because bCNC sends enough commands to keep the GRBL serial input buffer topped off. After GRBL sends the error message, it continues chewing its way through the buffer and, when bCNC notices the first error, it stops sending more G-Code commands and shudders to a stop.

The great thing about Free Software is that when it breaks, you have all the pieces. Looking into the GRBL source code provides a definition of Error 33:

// [G2/3 Offset-Mode Errors]: No axis words and/or offsets in selected plane. The radius to the current
//   point and the radius to the target point differs more than 0.002mm (EMC def. 0.5mm OR 0.005mm and 0.1% radius).

Which doesn’t quite match the code, but it’s close enough:

// Compute difference between current location and target radii for final error-checks.
            float delta_r = fabs(target_r-gc_block.values.r);
            if (delta_r > 0.005) {
              if (delta_r > 0.5) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.5mm
              if (delta_r > (0.001*gc_block.values.r)) { FAIL(STATUS_GCODE_INVALID_TARGET); } // [Arc definition error] > 0.005mm AND 0.1% radius

I’ve drag-knifed maybe a dozen top decks with no problem, so figuring out what broke took a while.

The key turned out to be in the Terminal log, where all coordinates in the G-Code commands had, at most, two decimal places. The GCMC program producing the G-Code emits three decimal places, so bCNC rounded off a digit before squirting commands to GRBL.

After more searching, it seems I’d told bCNC to do exactly that:

bCNC Config - Round 2 digits - highlighted
bCNC Config – Round 2 digits – highlighted

Perhaps I’d mistakenly set “Decimal digits” instead of “DRO Zero padding” when I reduced the DRO resolution from three decimals to two? It’s set to “2” in the CNC 3018XL configuration, so this seems like a typical one-off brain fade.

GRBL doesn’t execute invalid commands, so the tool position remains at the end of the window’s outer perimeter while the next two arc commands fail, because their center offsets produced completely invalid radii.

The three failed arc commands should have cut the right end of the window, the inner side, and the left end, but left the tool position unchanged. The final arc command should have withdrawn the blade along the outer side of the window, but became a complete circle, with the commanded end point equal to the leftover starting point at the same radius from the deck center.

The same G-Code file fails consistently with Decimal digits = 2 and runs perfectly with Decimal digits = 3, so at least I know a good fix.

Protip: Keep your hands away from moving machinery, because you never know what might happen!

This seems sufficiently obscure to merit becoming a Digital Machinist column. More analysis is in order …

, ,


Monthly Image: Albino Squirrel

We’re riding home with groceries when a small white shape scampered across a yard and jumped onto a stump:

Albino Squirrel 2020-03-03 - 680 crop
Albino Squirrel 2020-03-03 – 680 crop

If you’ve ever seen a gray squirrel, you’ll recognize the shape, even in this gritty enlargement:

Albino Squirrel 2020-03-03 - 680 - detail crop
Albino Squirrel 2020-03-03 – 680 – detail crop

Wikipedia says this one is likely a leucistic white squirrel, rather than a true albino squirrel. There is, of course, a website. tracking “white squirrel” sightings.

The relevant coordinates, for science:

41°41'39.9"N 73°52'56.6"W
41.694410, -73.882374

Can’t say if this one had black or pink eyes, but it was pure white!

Leave a comment

Garden Mole: End of Life

One of the moles aerating the ground around here ran out of steam beside the garden:

Mole - dorsal
Mole – dorsal

It has wonderfully soft velvety fur!

Flipping it over:

Mole - ventral
Mole – ventral

A closeup of its digging paws and gnawing teeth:

Mole - ventral paws - teeth
Mole – ventral paws – teeth

Those choppers seem overqualified for a diet of earthworms, but I suppose they know what they’re doing.

We left it in as-found condition, ready for recycling …

[Update: The consensus seems to be it’s a vole or shrew, not a mole. It’d be the biggest vole I’ve ever seen and “large shrew” seems oxymoronic, but the teeth are diagnostic. ]



Craftsman Hedge Trimmer: Laying on of Hands Repair

It being the season for hacking down decorative grasses, our ancient Craftsman Hedge Trimmer woke up dead, a decade after I fixed its switch and predicted it’d be good for another decade.

After verifying the failure isn’t in the wall outlet or the extension cord, haul it to the Basement Laboratory Repair Wing, clamp the blade in the bench vise, remove a myriad screws, and pop the top:

Craftsman Hedge Trimmer - innards exposed
Craftsman Hedge Trimmer – innards exposed

I should have removed the screw in the extreme lower right corner and loosened the similar screw at the rear of the bottom plate; they’re two of the three machine screws engaging nuts embedded in the shell. Everything is greasy enough to let the nuts slide right out of the plastic and no harm was done, but that need not be so.

After poking around a bit and finding nothing obvious, I checked the resistance across the plug: open-circuit with the switch OFF and nearly shorted with the switch ON.


Put the case back together with just enough screws to prevent heartache & confusion, unclamp the blade, plug into the bench outlet, discover it works fine again, reinstall the rest of the screws, and continue the mission:

Decorative grass bunches - early spring clearcut
Decorative grass bunches – early spring clearcut

We moved the Praying Mantis oothecae to nearby bushes for science!



Homage Tek Circuit Computer: Yellow Variation

An on-sale pack of yellow Astrobrights card stock tempted me:

Homage Tek CC - Yellow Astrobrights paper
Homage Tek CC – Yellow Astrobrights paper

The somewhat wrecked cursor comes from my collection of discards, because I haven’t yet figured out how to mill the outline and engrave the hairline on raw stock.

The paper isn’t quite the same color as my Genuine Pickett Model 110-ES circular slide rule:

Homage Tek CC vs Pickett 110ES colors
Homage Tek CC vs Pickett 110ES colors

Nor, of course, are the ticks and legends nearly as fine as you get with real engraving, but it’s probably Close Enough™ for anybody other than a Real Collector™.

The Pilot V5RT ink bleeds less on Astrobrights card stock than on the previous, somewhat coarser, card stock:

Tek CC - Yellow Astrobrights paper - bare
Tek CC – Yellow Astrobrights paper – bare

An automagic color adjustment bleaches the yellow and makes the black ink much more visible.

Laminating the paper crisps the contrast a bit, although it’s more obvious in person:

Tek CC - Yellow Astrobrights paper - laminated
Tek CC – Yellow Astrobrights paper – laminated

You can see tiny air bubbles over the darkest part of the ticks and letters.

, ,