Replies: 1 comment
-
|
To fix it get stepper/ballscrew setup with exactly one micrometer resolution (1000 steps/mm)? Or 0.1 micrometer resulution.
In reality it is determined by the steps/mm setting. FYI I have a longer term plan to update the codebase to allow double as an option for the higher end MCUs that has a FPU that supports double precision. This should get rid of some issues such as when running long programs in relative mode, e.g. laser engraving, where small errors eventually adds up. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I start replacing imperial ball screws on my milling machine to a metric ones and hoped that it would solve an issue with "jumping" numbers. But it doesn't. For example if I jog machine with pendant by 0.010 mm. I expect that each click it will be changed to 0.020, 0.030, 0.040, etc. but at some point it may jump to 0.051 for example. And it annoying. To jog machine, pendant sends G91 - relative movement command. And the problem is: there is no 0.01 in float representation. Nor 0.1, not 0.001 - it is impossible to represent all those number with sum of 1/2, 1/4, 1/8, etc. So, would will happen if we try to add 0.001? Lets check it out:
And result is:
Even if we relace float with double, we still may face this issue:
To represent numbers accurately we need base-10 float point numbers, not base-2. And there is no base-10 float point numbers in C/C++, nor hardware support for it on MCU side. I could modify pendant to use absolute position instead relative and it should "fix" my issue, but we still can run program with relative movements and it will cause accumulating position error. It probably will be small and will be fixed after first movement command in absolute coordinates, but still...
@terjeio, any ideas how to fix that?
In pendant I just don't use float point numbers and use fixed-point numbers. Smallest possible movement is 0.001 mm(1 um) and I store everything in um which will be 1. And for displaying it I do this:
printf("%d.%03u", x / 1000, abs(x % 1000));Beta Was this translation helpful? Give feedback.
All reactions