On Sun, Jan 3, 2016, at 01:02 AM, Cecil Thomas wrote:
> My question is about what happens to the "leftovers" when the 
> precision of the g code commanded position cannot be met by the 
> hardware executing it.

LinuxCNC does not work in steps.  It uses floating point values
for all internal calculations.  It also uses absolute coordinates, not 
relative ones.

Here is an example - I'm going to exaggerate things to make it
simple to follow, nobody would actually have a step resolution
this low:

Assume you have a 360 step per revolution motor with no gear
reduction.  So the machine can only go to integer degrees.

You want to cut an 11 tooth gear.  The tooth spacing is 32.7272727
degrees.

You cut the first tooth at 0.00000 degrees.  Then you tell LinucCNC
to index by 32.727272727 degrees.  Internally, it calculates that it
wants to be at 0.00000 + 32.727272727 degrees = 32.7272727.
As far as the motion controller is concerned, that is where the 
machine is going.  Step generation happens at a lower level in the
code.  At the step generator level, the closest possible location to
32.7272727 is 33.000, so it sends 33 steps, and the physical
machine goes to 33.000 to cut the second tooth.

Now you tell LinuxCNC to index by another 32.7272727 degrees
for the third tooth.  The motion controller believes that you are
already at 32.7272727, so it calculates the new position as 
32.7272727 + 32.7272727 = 65.4545454 degrees, and sends
that to the step generator.  The step generator knows that you
are really at 33, and the closest thing to 65.4545454 is 65, so 
it sends 65 - 33 = 32 steps.

Fourth tooth - LinuxCNC believes you are at 65.4545454 degrees
and adds 32.7272727 to get 98.1818181.  That goes to the step
generator.  Nearest possible step is 98, you are currently at 65,
so it sends 98-65 = 33 steps.

And so it goes all the way around.  No two teeth are 32.72727 
degrees apart, because the physical hardware can't do that.
But EVERY tooth is within 0.5 degrees of the proper position,
because LinuxCNC calculates the proper position BEFORE
rounding it to the nearest step.

All of the internal calculations are done in double precision math,
with about 17 digits of accuracy.  Even if you make thousands
of revolutions, the internal accuracy far exceeds the limits of any 
mechanical system.

Hope this helps clear it up,

John Kasunich

  John Kasunich
  jmkasun...@fastmail.fm

------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to