Laser Tracking Guide

Guide to the parameters and functions which can be used with USB-SL MEMS Controllers with the Tracking Add-On to create laser tracking applications.

Requires Mirrorcle’s Laser Tracking Bundle


Video Example:

Laser Tracking Data Modes

The following Data Modes are featured in the USB-SL MEMS Controller for laser tracking applications:

  • MTIDataMode::Sample_And_Analog_Input_Track
  • MTIDataMode::Auto_Track


In Sample_And_Analog_Input_Track mode, the host computer (Windows PC) must perform any searching and tracking functions by calculating possible target locations and updating the Controller offsets.

In this mode, when sampling starts (using MTIDevice::StartDataStream(-1) ) data is constantly streaming back to the PC from the Controller. The Controller data reports photosensor voltage as AI0 and at which index of the buffer that data was obtained.

With the index, user can recover what the laser modulation was at the time of each sample (on or off), and therefore perform calculations as to the likely center location of the target with respect to the current center of the scan pattern.


In Auto_Track Data Mode, the controller tracks a target automatically by internally performing the integration calculations, based on the settings in the MTITrack Params.

These may be adjusted and downloaded to the controller with MTIDevice::SetTrackParams().

Key MTITrackParams include:

  • Threshold to find and lock onto the target
  • BufferDelay to center the Lissajous onto the target
  • NormalGain to maintain track once the target is moving.

Calibrating with Auto_Track

Place a tracking target at the center of the MEMS field-of-view at the start of the AutoTrack, with Tracking and Searching disabled.

MTIDevice::GetTrackIntegrals() function is used to determine the amount of X and Y Offsets the controller is applying to its current position to maintain tracking.

By moving the target in one direction (e.g. positive X), the track integrals will return a positive adjustment in X and no adjustment in Y.

If this is not the case, the BufferDelay may need to be adjusted until the correct track integrals are returned.

The integrals should show appropriate numbers which if added to X and Y positions would adjust the scan location toward the target’s center.

Once the correct integrals are being returned, and the Threshold voltage is set to trigger when the scan is over the target, the user may use the settings.

User can also flash the settings for future use, or set the Controller to boot and autorun the settings in Auto_Track mode.

The Tracking and Searching may be enabled to let the controller track the target automatically.

Entering and Leaving Tracking Data Modes

To enter one of the Data Modes, user issues the following commands:

mti->StopDataStream( );      // Recommended to stop the data stream first
mti->SetDeviceParam( MTIParam::DataMode, MTIDataMode::Sample_And_Analog_Input_Track );

// Send data to the Controller and begin output
SendDataStream(x, y, m, numSamples);


mti->StopDataStream( );      // Recommended to stop data stream first
mti->SetDeviceParam( MTIParam::DataMode, MTIDataMode::Auto_Track );

// Generate data
SendDataStream(x, y, m, numSamples);

To leave one of the Data Modes, user issues the following commands:

mti->SetDeviceParam( MTIParam::DataMode, MTIDataMode::Sample_Output);
mti->SendSerialReset();       // To purge any leftover serial data in the comm channel
mti->ResetDevicePosition();  // To return the device to origin and restart sampling in default mode

Track Parameters

Getting Track Parameters: GetTrackParams

After the connection to the device is established, Track parameters can be queried directly from the USB Controller.

The controller responds with all of the parameters which are stored then in the MTITrackParams properties.

This includes read only Track properties and all adjustable Track parameters.

The first property in the class is “Success” which returns a Boolean value showing whether the communication with the Controller was without error.


MTITrackParams* tparams = mti->GetTrackParams();

Refer to MTITrackParams table for a full list of Track parameters, and a brief description of each.

Setting Track Parameters: SetTrackParams

In most cases, user may alter some of the Track parameters in the application to be different from the boot-up defaults.

A single call to the SetTrackParams function will send all values to the Controller, after the user modifies some of the parameters in the application.

void MTIDevice::SetTrackParams( MTITrackParams* params )

MTITrackParams* tparams = mti->GetTrackParams( );
tparams->Threshold = 0.5;
tparams->HitRatio = 1.0;
tparams->BufferDelay = 22;
tparams->EnableSearch = true;
tparams->NormalGain = -1;             // Gain is applied as 2^NormalGain
tparams->TangentialGain = 0;
mti->SetTrackParams ( tparams );    // Sends the structure to the device.

Track Status

Getting Track Status

Track Status can be queried directly from the USB Controller to get read only properties of the tracker status whether it is locked onto a target or not, and the location of a locked target.

The controller responds with all of the parameters which are then stored in the MTITrackStatus properties.

The first member in the class is MTITrackParams::Success which returns a Boolean value showing whether the communication with the Controller was without error (Success = true)


MTITrackStatus* tstatus = mti->GetTrackStatus();
if (!tstatus->Success)

Refer to MTITrackStatus table for a full list of Track parameters, and a brief description.

Track Integrals

Get Track Integrals

As the Controller moves the X and Y positions of the output laser beam in a nutation/dither pattern prescribed by the user, it integrates two values for its internal AutoTrack function.

One integral is for all X nutation data which retuned a reflection above threshold, and the other is for all Y nutation data which returned a reflection above threshold.

The final integral value at the end of one nutation cycle provides information about the direction (X, Y) in which the laser beam should move in order to improve centering on the target object.

∑_(𝑛=1)^(𝑛=𝑏𝑢𝑓𝑓𝑒𝑟)(𝑋_(𝑛−𝑏𝑢𝑓𝑓𝑒𝑟𝑑𝑒𝑙𝑎𝑦 )∗𝐼_𝑛 )

Track Integrals return the amount of normalized X and Y offsets needed to re-center the MEMS scan onto the tracking target.

The two integrals are returned by reference in the function.

This function is only valid in DataMode 8 or AutoTrack.

void MTIDevice::GetTrackIntegrals( int &TrackIntegralX, int &TrackIntegralY )

mti->GetTrackIntegrals( TrackIntegralX, TrackIntegralY );