Skip to content

Calibration

firepick1 (localhost) edited this page Mar 5, 2017 · 7 revisions

Using Kinann networks for calibration

Kinann provides a general solution for the challenge of kinematic calibration. You can create and train a Kinann neural network (KNN) that will correct measured errors with these simple steps:

  1. Identify the input variables that affect positioning
  2. Create a neural network that models the measured error (measuredNet)
  3. Compute the inverse neural network that corrects the measured error (calibratedNet)

Identify input variables

Define an input variable for each independent axis of motion. E.g., a 4-axis XYZ Cartesian robot with a rotational A-axis, will need at least four input variables. These four input variables are enough to handle Y-axis skew as well as bed leveling. For simplicity, we'll omit additional input variables you might add later to account for things like backlash:

    var xyza = [
        {minPos: 0, maxPos: 300}, // x-axis
        {minPos: 0, maxPos: 200}, // y-axis
        {minPos: 0, maxPos: 10}, // z-axis
        {minPos: 0, maxPos: 360}, // a-axis
    ];
    var factory = new Kinann.Factory(xyza);

Train measurement KNN to model your robot

Use the Kinann.Factory from the previous step to inititialize the measuredNet with an identity transform KNN. You will train the identity KNN to model your robot by measuring the error for each of a set of provided training examples:

    var examples = null; // provided training examples
    var measuredNet = factory.createNetwork({
        onExamples: (trainingExamples) => (examples = trainingExamples) 
    });

The provided examples are for the identity transforms. You will need to change the provided target values for each example:

measuredNet = [...{
    input:[300, 200, 10, 360],    
    target:[300, 200, 10, 360]
}...]

Replace each provided target with measured output. If no information is available, simply leave the entry unchanged (e.g., target[3] for the A-axis).

measuredNet = [...{
    input:[300, 200, 10, 360], // measure error at this position   
    target:[measured0, measured1, measured2, 360] // provide measured data
}...]

Train the measurement KNN to model your robot:

    measuredNet.train(trainingExamples);

Create and use correction KNN to move your robot

The correction KNN is simply the inverse of the measured KNN:

    var calibratedNet = factory.inverseNetwork(measuredNet);

Use activate() to determine how to move your robot so that it goes to desired position:

    var myRobotPos = calibratedNet.activate(desiredPos);

Examples

  • Factory unit tests provides an example ("Train Kinann network to correct Y-axis skew") of training a correction KNN to correct Y-axis skew

Clone this wiki locally