Motor linearity compensation is a software technique that corrects for repeatable, static errors in the position of a motor. For example, some linear encoders utilize a plastic optical pattern strip in combination with an optical read head. If the plastic strip is glued to an axis, the gluing process can result in the strip being stretched in some regions and compressed in others. If a constant scale factor is applied to convert from millimeters to encoder counts, when the motor is commanded to move, it will move too far in the stretched region and too little in the compressed area.
This compensation technique defines a table of encoder count correction values that are automatically applied to both motor position commands in encoder counts and encoder readings. By specifying encoder correction values at regular intervals throughout a range of travel, the linear positioning capability of a motor can be improved. In between the correction values, the system linearly interpolates the correction values.
Only selected kinematic modules support linearity compensation. Please see the Kinematic Library documentation to determine if your robot module includes this capability. If a kinematic module supports this technique, a unique linearity correction table can be defined for each motor.
The following example illustrates how to experimentally determine the encoder correction data. In this example, we assume one encoder count corresponds to 1 micron (.001 mm), that we wish to provide a correction value each 1000 encoder counts (1 mm) and that the compensation starts at encoder count 5000.
To enable motor linearity compensation, the following parameter must be set.
Parameter Database ID | Parameter Name | Description |
---|---|---|
2005 |
Motor linearity compensation |
Set to TRUE to permit defining the linearity compensation correction tables and to automatically apply the data to all commands and position reading operations. Only motors that have correction tables define are affected. |
Once linearity compensation has been enabled, the internal correction table is created by executing the Robot.DefLinComp method. This method takes as arguments: the robot number, the motor number, the first encoder value to be corrected, the step size between correction values, the number of correction values and an array of encoder correction values. This method must be executed once for each motor to be compensated each time that the controller is restarted.
For the example above, the following software would define the correction:
Dim cor(2) As Double
cor(0) = 0
cor(1) = -18 ' Assume first reading of 0.982 mm
cor(2) = 5.3 ' Assume second reading of 1.0053 mm
Robot.DefLinComp(robot, motor, 5000, 1000, 3, cor)
For large data sets, it is typically more convenient to store the correction data in a flash disk file and write a GPL program that reads the data back into an array using the standard file input and output methods.
As soon as the Robot.DefLinComp method is executed, the compensation is put into effect to correct motor commands and encoder readings. As a convenience, this method can be executed when motor power is enabled. However, if the correction for the current robot position is significant, this could cause the motors to jump. So, it is normally safest to load the correction data when power is disabled.
The correction will stay in effect until another Robot.DefLinComp method is executed that over-writes the data for the motor or the controller is restarted.