I am working on my second build of Maslow and trying to introduce best practices from our forum. My focus is on sources of errors and how to make Maslow as accurate as it is precise as my projects are always rescaled: sometimes 2 to 5mm for parts 500mm long. Thank you @dlang, @madgrizzle, @c0depr1sm and others for fantastic discussion in “List of sources of error”.
One thing strikes me: as @c0depr1sm illustrates our model upon which calculations are based is strongly non linear - introducing corrections do not removes nonlinearities - it makes math more complicated. Every machine have its own set of corrections.
When g-code sends coordinates for the next point where router bit should be, we are calculating what the length of left chain L should be and length of the right chain R should be and translating it into sprocket rotation. Calculations formula uses nonlinear model - model in not perfect - router bit is not in the position where it should be.
Here is my line of thinking:
Length L and length R is smooth and monotonic function of [x, y] position. If I can find precise length of chain for several [x, y] points I can fit a surface to this points. That surface will later on give me length in any other point.
Step 1. Draw X axis and Y axis on the surface of Maslow, mark non uniform grid - at points with coordinates like this in mm:
[0,1200] [400,1200] [800, 1200] [1200,1200] [1600,1200] [2000,1200] [2400,1200]
[0, 800] [400, 800] [800, 800] [1200, 800] [1600, 800] [2000, 800] [2400, 800]
[0, 400] [400, 400] [800, 400] [1200, 400] [1600, 400] [2000, 400] [2400, 400]
[0, 0] [400, 0] [800, 0] [1200, 0] [1600, 0] [2000, 0] [2400, 0]
Step 2. Move bit near [0,0], measure x, measure y and count number of chain links to the left sprocket and to the right sprocket - correct by fraction of link if necessary(famous 12:00) - get length in mm. (At this point I am assuming that chain is attached to sled at fixed points A and B).
Repeat for all points on the grid.
As result, three matrices [xi, yi], [Li] and [Ri] are created - in other word we sampled two surfaces L=f(x, y) and R=f(x, y) (it should be mirror image of each other)
Step 3. Record measurement in Ground Control which creates interpolated functions interpL and interpR. Routine can be written in scipy:
from scipy import interpolate
x, y=grid[xij, yij]
***generate spline fitted surface
tckL= interpolate.bisplrep(x, y, Lij, s=0) tskR= interpolate.bisplrep(x, y, Rij, s=0)
***read line of g code - eg. G1 X200 Y100
***calculate length of chain
L = interpolate.bisplev( 200, 100, tckL) R = interpolate.bisplev( 200, 100, tckR)
Step 4. Pass L and R to execute
As long as mass of sled is constant and line AB is horizontal, interpolated surface L and R will contain all nonlinearities of our machine. Moreover, it maybe universal for all machines as long as weight of sled will be the same, points where chain is attached and spread of sprockets will be the same. Accuracy will only depend on precision of x, y and chain length measurements. Accuracy will deteriorate as chain will creep over time.
Python gives other options to interpolate our surfaces. I am not a Python coder but quick look to documentation shows that we can use ‘grid’ and ‘griddata’ or ‘LSQBivariateSpline’
I simulated surface and interpolation in Matlab to find possible accuracy.
Surface is arbitrary cos - sin function calibrated to get length in mm similar to Maslow
z=(2 * cos((xx/4800)*pi) - sin((yy/4800)*pi)+0.8)*1000;
and z is defined on the grid:
x = [0 400 800 1200 1600 2000 2400];
y=[0; 300; 600; 900; 1200];
Surface representing right chain length R is illustrated above and have 7 x 5 points.
Spline interpolation finds R length in let say 100 200 point:
zi=interp2(x, y, z, 100, 200, ‘spline’)
Difference between function value and interpolated value at 100, 200 is
-0.23mm for R=2665.4mm
which is -0.009% - very promising! Router bit position error will be different as we have to take into account dL, dR and cos of the angle between L and R: something like
delta = (dL+dR)*cos(LR-angle) - it will be in range 0.2mm - I think
Proposed method simplify math and should be easy to implement into Ground Control. It also opens opportunity to simplify mechanic - we do not need ring and bearings anymore, no worries about coaxial bit. We may have one calibration for all machines with the same sprocket spread, sled weight, and chain attachment.
What do you think?