Screw mapping is usually reserved for OEMs that sell turn key machines. I say "usually" because most people don't have the measuring capabilities/tools required to come to a good outcome. And they even make more of a mess than if they left screw mapping along. Then throw a bit of backlash at the situation and it gets worse. So there is the caveat. But if you like a good challenge, here is what I wrote to an OEM about the subject:
The map is by motor in the Profile's directory
Motor_0_Map.dat
Motor_1_Map.dat
Motor_2_Map.dat, etc...
It is a comma separated file: Start, Length of screw, Number of points, point 1 error, point 2 error, point 3 error, etc...
The file format, again to be clear, is this:
[start pos], [length of screw], [number of points mapped], [point 1 error], [point 2 error], [point 3 error], etc...
All positions are in counts. The error is the actual error, in counts. A negative or positive number.
For example, say you have a screw that is 10000 counts per inch and you measure the table every inch and the axis is 20 inches. Start would be 0, length would be 200000 (10000 * 20), number of points would be 20 (200000 / 10000). You would start at zero and move the X axis precisely 1 inch (this is where the precise measurement comes in). Then you look at your screws encoder counts. Say it reads 10001. That means the error is 1 count positive. If the encoder read 9999, then the error would be 1 count negative (-1).
In the core, we always "add to take the error out". So when we move to a virtual position, we look up the error for that position in the map and
ADD the error value. A planner position of 10000 would output 100001 as the destination point.
If the point is between two mapped points, we interpolate between the two points. This is why the granularity you choose is important. It determines the "acceptable" amount of error.
In order to effectively use screw mapping, the machine needs to be able to home precisely and be repeatable. The machine's home position is the reference point for all of the mapping.
It is a painstaking process to do it right.
Steve