Linear Table Correction

From Dynomotion

Jump to: navigation, search

Linear Table Correction

Besides the 2.5D Geometric Correction capability 1D Linear Table corrections can be applied to each axis independently.  Lead Screw mapping fits into this category where there a nonlinear distortion of the commanded axis position to the true position of the axis.


Each or both 2.5D Geo Correction and 1D Linear correction can be applied.  If both are applied then the 2.5D Geo Correction is applied first and then the Actuator positions have 1D Linear corrections applied.  Between Points a linear interpolation is used.


Below is shown an example plot of a correction table for an angular A axis.  The table values contain the commanded positions required to position at the theoretical positions.  For example in the plot below to move to angle 0 the axis actually needs to be commanded to 10 degrees.  To move to 90 degrees the axis would need to be commanded to 95 degrees.  Note these values are exaggerated over what they would typically be for a real system for demonstration purposes.  The example is created using a cosine function where the correction is 0 at -80 and +180 degrees and 10 degrees at 0 degrees.  


The actual table contains a list of necessary commanded position but the plot below shows the difference between the commanded positions and the theoretical positions to plot errors and to make the errors more visible.

CosineCorrection Excel Plot.png

Below is a fragment of the text file for a Linear Correction Table.  The first 3 lines define the table range.

Line 1 contains the number of commanded positions.  Note that for N ranges N+1 points must be specified.  The example defined 180 2 degree ranges so 181 points are required.

Line 2 defines the size of each range.  In this case 2 degrees.

Line 3 defines the offset or starting point for the table.  In this example it is assumed the useful machine range is from -180 to +180 degrees.  So the Table offset is -180.  The A axis theoretically goes from -infinity to +infinity so it must be specified what range the table should be applied.  If the machine coordinates operated from 0 to 360 degrees then the offset would be 0. 

Line 4 through N+3 defines the actual axis commanded values preceded by the point number.  The points may be specified in any order as long as all point numbers are specified.

MapFile.png

The Tool Setup | Tool/Setup Files | Geo File specifies the root of which files are to be used.   The file name itself specified the name of the 2.5D Geo Correction file.  The Linear Table corrections files are derived from this name by appending: '_X', '_Y', '_Z ', '_A', '_B' or '_C' before any suffix.  So assuming a Geo Correction name of C:\Temp\MapFile.txt the Linear Table Names would be


C:\Temp\MapFile_X.txt

C:\Temp\MapFile_Y.txt

C:\Temp\MapFile_Z.txt

C:\Temp\MapFile_A.txt

C:\Temp\MapFile_B.txt

C:\Temp\MapFile_C.txt


The Software will automatically search for these files and apply corrections for the found files.  The 2.5D Geo Correction file may or may not be present.  But at least one file must be present and valid. 
GeoFile.png


With the above Linear Correction in effect and the GCode A Axis commanded to 0 degrees note that the actual commanded axis position is 1000 counts.  This corresponds to a 10 degree offset because the trajectory Planner settings are specified to be 100 count/degree

A0 Correction10.png


Here the GCode A Axis commanded to -90 degrees note that the actual commanded axis position is -8500 counts (-85 degrees).  This corresponds to a +5 degree offset

A-90 Correction5.png


Here the GCode A Axis commanded to -180 degrees note that the actual commanded axis position is -18000 counts (-90 degrees).  This corresponds to no offset

A-180 Correction0.png


Below is an example KFLOP/Kogna C Program that was used to create the MapFile_A.txt file 


#include "KMotionDef.h"
 
// Create Simple Linear Correction file for A axis
 
int main(void)
{
	int i;
	double angle, error;
	
	// Calibrate Table for A -180 to +180 degrees at 2 degree increments
    FILE *f=fopen("C:\\Temp\\MapFile_A.txt","wt");
    fprintf(f,"181\n");   // 181 points specify 180 regions
    fprintf(f,"2.0\n");   // 2 degree Spacing
    fprintf(f,"-180\n");  // Offset - Table begins at -180

	// use dummy correction of cosine function with no error
	// at -180 and +180 but 10 degrees at center (0 degrees)
	
	for (i=0; i<181; i++)
	{
		angle = -180.0 + i * 2.0;
		error = (cos(angle * PI/180.0)+1)/2.0 * 10.0;
		fprintf(f,"%d,%.11f\n", i, angle+error);
	}
	
    fclose(f);
}

This is the Excel Spreadsheet used to create the Error Plot from the Linear Table file.

PlotLinearCorrectionTable.xlsx