Electromagnetic trackers calibration
using polynomial fit

Volodymyr Kindratenko
Visualization and Virtual Environments group
National Center for Supercomputing Applications
University of Illinois at Urbana-Champaign

The idea behind this method is to build position and orientation correction equationsby solving a high order polynomial fit problem. A calibration table is created by placingthe receiver at points of known locations with know orientation and recording the valuesreported by the receiver. Fitting polynomials are built for x, y, z, azimuth, elevation,and roll and are used to compute the fitted position/orientation values from measuredones. Additional rotation correction is performed. See TechnicalReport for more details.

[libTrCalibr library] [dV/MockUp with dV/Immersion option sensor calibration filter]
[back to Electromagnetic Tracker Calibration Page] [Acknowledgements]

libTrCalibr library 1.00

[Read Software Copyright] [Download the Source Code] [ReadManuals]

The technique was implemented in C as a library. Thefollowing files are needed in order to use the library: calibfile.h(calibration file definitions), polyfit.h (calibration functionsdefinitions), libTrCalibr.a (the library). Note that thelibrary binary file is compiled for SGI workstations only. Feel free to download the source code and compile it for any other platformsin accordance with the software license.

The following API is available:

int readcalibfile(char *fname,struct calibdata *cdata, int rotunits)

This function reads data from the calibration file fname and stores it into cdatastructure which is declared in calibfile.h. Calibration file has the followingstructure:

line 1: total number of records m
line 2: record 1
line 3: record 2
.........
line m+1: record m

where each record contains true x, y, z, measured x, y, z, and measured azimuth,elevation, roll. Angles can be measured in degrees (rotunits = DEGREES) orradians (rotunits = RADIANS). It does not matter what units are used for x, y,and z as long as they are everywhere the same. An example of a calibration file isavailable on-line (2x2x2-100.dat). The function returns theactual number of records if data was read, otherwise it returns 0. The cdatastructure must exist before calling the function, but the memory needed to store the datafrom the file will be allocated by the function.

void deletecalibdata(struct calibdata*cdata)

This function removes the memory allocated by readcalibfile in cdata. Itshould be called after the fitting polynomials has been built.

int fit_initialize(struct calibdata*cdata, int porder, struct fpolynomials*fpol)

This function takes the calibration table loaded by the readcalibfile in cdataand computes the fitting polynomials of the order porder both for position andorientation components. The result is returned in fpol structure which isdeclared in polyfit.h. The fpol structure must exist before calling the function,but the memory needed to store the polynomials will be allocated internally by thefunction.

void fit_evaluate(struct fpolynomials*fpol, float xm, float ym, floatzm, float azm, float elm, floatrlm, float *xf, float *yf, float*zf, float *azf, float *elf, float*rlf)

Once the polynomials fpol have been computed by fit_initialize, this functioncan be called to fit the measured values xm, ym, zm, azm,elm, and rlm. Results are returned in xf, yf, zf,azf, elf, and rlf.

void fit_statistics(struct calibdata*cdata, struct fpolynomials *fpol, char*fname)

This function takes the data cdata loaded by readcalibfile, fits it by thepolynomials fpol computed by fit_initialize, computes statistics and stores theresults into the file fname.fit. This is a useful tool that allows to studyperformance of the calibration procedure.

An example of an application that uses the library is given below.

#include <stdio.h>
#include "calibfile.h"
#include "polyfit.h"

int main (int argc, char **argv)
{
    struct calibdata cdata;
    struct fpolynomials fpol;
    float xm, ym, zm, azm, elm, rlm;
    float xf, yf, zf, azf, elf, rlf;

    if (argc != 3) {
        printf("Usage: %s calibration_filepolyorder\n", argv[0]);
        printf(" polyorder - order of thepolynomial to be used\n");
        exit(1);
    }

    porder = atoi(argv[2]); /* order of the fitting polynomial */

    /* read calibration file */
    if (!readcalibfile(argv[1], &cdata, DEGREES)) {
        printf("Unable to read data file\n");
        exit(1);
    }
    else printf("file %s containing %i records is loaded\n",argv[1], cdata.M);

    /* build fitting polynomials */
    if (!fit_initialize(&cdata, 3, &fpol)) {
        printf("Unable to buildpolynomials\n");
        exit(1);
    }
    else printf("fitting polynomials (%i terms) are built\n",fpol.N);

    deletecalibdata(&cdata);  /* free memory that was allocatedfor the calibration file */

    while (1) {  /* run the fitting loop */
         /* now the angles are in radians */
        printf("enter measured values of x, y, z,az, el, and rl:\n");
        scanf("%f %f %f %f %f %f", &xm,&ym, &zm, &azm, &elm, &rlm);
        fit_evaluate(&fpol, xm, ym, zm, azm, elm,rlm, &xf, &yf, &zf, &azf, &elf, &rlf);
        printf("corrected values are: %2.3f %2.3f%2.3f %2.3f %2.3f %2.3f\n", xf, yf, zf, azf, elf, rlf);
    }

}

dV/MockUp with dV/Immersion option
sensor calibration filter 1.00

[Read Software Copyright] [Download the Source Code] [ReadManuals]

A dV/MockUp-dV/Immersion (Division Inc.) sensor calibration filter has beenimplemented using libTrCalibr library 1.00.Installation procedure follows. Note that the included binary file is compiled for SGIworkstations only. Feel free to download the source codeand compile it for any other platforms in accordance with the softwarelicense.

Acknowledgements

This work was performed at the National Center for SupercomputingApplications (NCSA) and was supported by Caterpillar Inc.  Additional informationregarding the electromagnetic tracking system was provided by Ascension TechnologyCorporation. Division Inc kindly shared the information needed to implement the sensorfilter.


This document was created by VolodymyrKindratenko
Last modified: Friday, December 03, 1999 04:36:56 PM