Saturday, August 26, 2006
Cascading Spline Curve Accuracy
I decided to see how accurate I could get a cascading spline algorithm using 16.16 fixed point addition to run the spline cascade.
You can see the result of the spline here. You may need to look at the full size image to see the smaller details. The gray line shows the linear segments from spline endpoint to spline endpoint. The red line is the double floating point precision calculated spline, and the cyan colored curve is the cascading spline curve, calculated with 32 bit integer addition, with 128 samples per segment, where each coordinate sample is rounded to the most significant 16 bits, then plotted as a line to the next sample coordinate.
You can see the effect on precision at the end points at some of the curves -- They don't always connect 100%. However, assuming that 1 pixil = .02mm (Giving the motor position a range of 1 meter), the largest error for this specific curve is about 0.5mm. I did not implement full pre-processing of the spline curves, and the actual accuracy will be about double that (by distributing the error throughout the curve, rather than just at one endpoint.) The cascaded curve ends would also be joined together. Accuracy can also be improved by slowing down the motor and/or decreasing the number of steps/spline.
For this simulation, the motor was pretty much moving constantly at about 2mm - 4mm per second (each pixil is about .02mm - the entire shape is about 1cm across), except for one point at the bottom left where the motor is assumed to have started and stopped. I'm not sure the motors chosen would be able to accellerate to meet the demands of this particular spline path, but that will come later when I start experimenting with the hardware.
The motor would need to be able to position itself to each of the 128 sample point coordinates with good accuracy. I did not simulate velocity tracking yet, but each of the 128 points could also yield the desired motor velocity for that moment in time, which would minimize actual physical error as the motor tracks the spline curve with near lock step accuracy.