MTIDevice API Reference#

Classes#

MTIDevice#

class MTIDevice#

ANALOG INPUTS

Methods for handling Analog Input

float GetAnalogInputValue(unsigned int ChannelNumber)#

Samples immediately one value from Analog Input Channel 0 or 1.

void GetAnalogInputBuffer(float *AI0, float *AI1, unsigned int DataLength)#

Gets the sampled values from channel 1 or 2. (Obtained before via MTIDataMode parameter).

unsigned int GetAnalogInputStream(float *AI0, float *AI1, unsigned int DataLength = 0)#

Gets the sampled values from channel 1 or 2 as they stream. Get as many as are available, return how many were obtained.

unsigned int GetSamplesRemaining()#

While running, provides the number of samples that remain to be read from the buffer. Equal to (length of the data buffer - the index position + 1) at the requested moment in time

CREATION AND TERMINATION

Constructor and Destructor of the MTIDevice class

MTIDevice()#
~MTIDevice()#
void DeleteDevice()#

Deletes the device object from the memory

Deprecated since version 11.0.0.0: Use delete or allow MTIDevice object to go out of scope

SEARCH AND CONNECTION

Open the COM port and connect to the addressed device.

void ConnectDevice(char *portName)#

Opens the serial (COM) port and connects to the addressed device.

void ConnectDevice(MTISerialIO *socket)#

Connects to device at a previously connected MTISerialIO socket.

void ConnectDevice(void)#

Connects to first available (compatible) device (at lowest available port number).

void DisconnectDevice()#

Stops communication and closes the serial (COM) port.

void GetAvailableDevices(MTIAvailableDevices *table)#

Searches for available devices to connect to at the host and returns a table of the devices with port settings.

MTIAvailableDevices *GetAvailableDevices()#

DEPRECATED. Searches for available devices to connect to at the host and returns a table of the devices with port settings.

void ListAvailableDevices(MTIAvailableDevices *table)#

Lists all available devices on COM Ports in a console window / terminal.

Parameters:

table[in] The MTIAvailableDevices* object returned by GetAvailableDevices.

void GetAPIVersion(std::string *version)#

Returns string for the MTIDevice API version number in x.y.z.w format.

OPERATION

Methods involved in operating the MEMS device

void StopDataStream()#

Stops the data output operation of the device. Sampling stops asynchronously as soon as command is received by device. Outputs remain at values of last sample X, Y, M (or X, Y, R, G, B etc.) and object obtains info about the last outputted sample.

void SendDataStream(float *x, float *y, unsigned char *m, unsigned int numSamples, unsigned int delaySamples = 0, bool minimizeJump = true, bool compensateFilterDelay = true)#

SendDataStream sends (X,Y) positional coordinates, 8-bit Digital Output numbers, and additional settings for the output operation to the Controller.

By default, the device will start outputting the data after everything is received. To prevent this, preface this function with a call to StopDataStream().

Parameters:
  • x[in] The array of X positional coordinates (Cartesian) to be sent with range of -1 to 1

  • y[in] The array of Y positional coordinates (Cartesian) to be sent with range of -1 to 1

  • m[in] The array of 8-bit Digital Output numbers (unsigned) to be sent with range of 0-255.

  • numSamples[in] Number of samples to be sent to the Controller. Range is from 1 to the length of the passed X/Y/M arrays (or maximum buffer size for the Controller).

  • delaySamples[in] delaySamples is a parameter that allows user to adjust output timing of the digital output with respect to the X,Y outputs by delaying the digital output by a number of samples. delaySamples should be a value between 0 and numSamples-1 which is maximum amount of m-samples rotation possible. When value is 0, there is internal delay added to compensate for the hardware filter’s group delay regardless, so this compensation can be increased by this parameter.

  • minimizeJump[in] A true/false value that dictates whether the function will rotate the data stream so that the distance between the first sample in the new stream is closest to the last sample of the previously sent stream. This is done to minimize the jump and, in turn, any excitation of resonance when transitioning from one stream to next.

  • compensateFilterDelay[in]

    A true/false value that dictates whether the function will rotate the m data (digital output) with respect to the x,y data based on the estimated group delay of the hardware low-pass filter onboard the Controller. Default value

    is true: function will internally delay (buffer rotate) the m samples before streaming to the Controller. When false, the x,y,m data will stream to the Controller exactly as arranged by the user in the function call.

void StartDataStream(int repeatCount = -1, bool confirmOnComplete = true)#

Starts the output operation of the device.

Parameters:
  • repeatCount – The number of times the Controller should output the data stream. If repeatCount is 0 or less, the Controller will output the data stream infinitely until stopped.

  • confirmOnComplete – If confirmOnComplete = false, the function will not wait for a receipt from the device that the data stream was outputted. confirmOnComplete is only useful when repeatCount is not -1.

void ResetDevicePosition()#

Resets the MEMS device position back to its origin. It is a special case of GoToDevicePosition with (X, Y) = (0, 0) and 10ms step duration ResetDevicePosition function also resets any output offsets to (0, 0) For more details see GoToDevicePosition

void GoToDevicePosition(float x, float y, unsigned char m, unsigned int mSec = 5)#

MEMS device will be stopped and position will be changed from stopped position (XStop, YStop) to new (X, Y) with a step of a specific duration of time, specified by user in as (mSec) in milliseconds.

It should be noted that the step happens after approx. 100-200ms of communication and processing. If step time parameter (mSec) is omitted in the function call, the function will use a default value of 5ms. Note that the actual step time of the device from stopped position to new position is ultimately a function of both the stated (mSec) parameter and the bandwidth setting of the hardware filters or HardwareFilterBw which may additionally increase the step time.

Furthermore, if the requested step time is too short for a given MEMS mirror design, and HardwareBandwidthBw is too high, the device may take a longer time to settle into new position while overshooting and ringing about the position.

Parameters:
  • x, y[in] The (X,Y) Cartesian coordinates, with range of -1 to 1

  • m[in] The modulation data, with range of 0-255

  • mSec[in] The duration of the step between (XStop, YStop) and new (X, Y). Range of mSec is 1 to 5000 except in special case where 0 is acceptable. Use mSec=0 to move the device with minimal step time. In the case of mSec=0, only a single step is streamed and mirror will step in the time limited only by the HardwareFilterBw - therefore this can be potentially damage or destroy the device if hardware filter bandwidth is not set to recommended or reasonably low limit.

void SetRGBData(unsigned int *rgbData, unsigned int numSamples)#

Set MTIDevice::m_iRGBData array to an array of RGB values provided by this function

Each rgbData unsigned int has 4 bytes with the format 0x00RRGGBB (most significant byte is not used, then 1 byte of red, 1 byte of green and 1 byte of blue) Each color’s byte is a value from 0 to 255

The RGBData will not be sent to the Controller until MTIDevice::SendDataStream is called.

Parameters:
  • rgbData[in] The array of RGB samples to be set in MTIDevice object’s RGBData array

  • numSamples[in] The number of samples from provided array to be copied to MTIDevice::m_iRGBData Typically the length of the prepared data.

void SetRGBData(unsigned int rgbColor, unsigned int numSamples = 0)#

Populate MTIDevice::m_iRGBData member with a single RGB color value provided by this function

Each rgbData unsigned int has 4 bytes with the format 0x00RRGGBB (most significant byte is not used, then 1 byte of red, 1 byte of green and 1 byte of blue) Each color’s byte is a value from 0 to 255

The RGBData will not be sent to the Controller until MTIDevice::SendDataStream is called.

Parameters:
  • rgbColor[in] The single RGB value to populate the MTIDevice’s RGBData array

  • numSamples[in] The number of samples from provided array to be copied to MTIDevice::m_iRGBData Typically the length of the prepared data.

void SetRGBGammas(float gamma_R, float gamma_G, float gamma_B)#

Apply gamma corrections to the m_iRGBData array. Gamma correction is only applied once SendDataStream is called and only to the RGB samples sent to the Controller. The m_iRGBData array will NOT be altered to reflect the gamma correction.

void GetRGBData(unsigned int *rgbData, unsigned int numSamples)#

Get MTIDevice

object’s RGBData array

Each rgbData unsigned int has 4 bytes with the format 0x00RRGGBB (most significant byte is not used, then 1 byte of red, 1 byte of green and 1 byte of blue) Each color’s byte is a value from 0 to 255

Parameters:
  • rgbData[out] The pre-allocated array for the method to return values in the MTIDevice’s RGBData array

  • numSamples[in] The length of samples in the MTIDevice’s RGBData array to get

void SaveToFlash(MTIFlash flashsave)#

Sends settings to the target to save params, data, or both to flash memory.

CONTROL AND STATUS

Resetting and querying the Controller for status

void ClearInputBuffer()#

Clears the input buffer of the host computer from any data previously received from device at serial port.

void SendSerialReset()#

Clears the SerialIO buffers on host and device and resets the communication.

void ResetDevice()#

Resets/restarts the MCU (processor) on the connected device (Controller).

float GetXStop()#

After StopDataStream(), returns the last outputted X data sample point.

float GetYStop()#

After StopDataStream(), returns the last outputted Y data sample point.

unsigned char GetMStop()#

After StopDataStream(), returns the last outputted M data sample point (digital output).

unsigned int GetIStop()#

After StopDataStream(), returns the (waveform) index of last outputted sample.

bool IsDeviceConnected()#

Verifies if a device socket is non-NULL - should be true when serial socket is connected.

bool IsDeviceResponding()#

Verifies if a device is responding to serial commands - a ping of the Controller.

bool IsDeviceRunning()#

Verifies if the output operation is presently running and outputting samples.

bool IsTrackingSupported()#

Verifies if the Controller’s firmware supports tracking functionality.

MTIError GetLastError()#

Returns the last error. Called after each communication with the device to verify correct transfer.

void SetDefaultDeviceName(char *text, const std::string &pass)#

DEVICE PARAMS

Methods for getting and setting Controller parameters

void GetDeviceParams(MTIDeviceParams *params)#

Get all device parameters from the device (Writable settings and read only firmware values).

MTIDeviceParams *GetDeviceParams()#

DEPRECATED. Get all device parameters from the device (Writable settings and read only firmware values).

void SetDeviceParams(MTIDeviceParams *params)#

Sends the complete device parameter structure to the device (including all settings).

float GetDeviceParam(MTIParam param, int paramID = 0)#

Gets a single device parameter from the object.

void SetDeviceParam(MTIParam param, float paramValue1, float paramValue2 = 0.f)#

Sets a single parameter on the device.

void LoadDeviceParams(MTIDeviceParams *params, const char *fileName)#

Loads a single or multiple device parameters in the parameter structure from a file (by default “mtidevice.ini”).

MTIDeviceParams *LoadDeviceParams(const char *fileName)#

DEPRECATED. Loads a single or multiple device parameters in the parameter structure from a file (by default “mtidevice.ini”).

void SaveDeviceParams(char *fileName)#

Saves the complete device parameter structure into a file.

char *GetEnumString(const char *enumName, int enumValue)#

TRACK PARAMS

Methods for getting and setting Controller tracking parameters

void GetTrackParams(MTITrackParams *params)#

Get the device’s tracking parameter structure from the device (requires tracking functionality).

MTITrackParams *GetTrackParams()#

DEPRECATED. Get the device’s tracking parameter structure from the device (requires tracking functionality).

void SetTrackParams(MTITrackParams *params)#

Sends the complete device tracking parameter structure to the device (requires tracking functionality).

void GetTrackIntegrals(int &TrackIntegralX, int &TrackIntegralY)#

Get back the integration values for tuning parameters.

void GetTrackStatus(MTITrackStatus *trackStatus)#
MTITrackStatus *GetTrackStatus()#

MTIDataGenerator#

Note

Class not available in SDK-Matlab

class MTIDataGenerator#

Plotting

Functions to generate plots of user data in windows and close those windows

unsigned int CreatePlot(const char *windowTitle = "")#

This function creates plot windows with its user defined title

Returns plotID for the plot created so content can be resent to same plot window

Parameters:

windowTitle[in] Allows you to specify a custom title for the plot window. If no title is provided, the function will automatically generate a default title in the format “Plot + (plot number)”.

unsigned int PlotData(unsigned int plotID, float *x, float *y, unsigned char *m, unsigned int npts, unsigned int sps = 1, unsigned int windowWidth = 900, unsigned int windowHeight = 800, unsigned int plotType = PlotType::TimeVsXYData)#

This function generates plots of user data with respect to the plot type

Returns unique plotID. plotID values are auto-assigned starting from 1.

Parameters:
  • plotID[in] The plot’s unique ID, provide 0 to create a new plot and generate a new plotID.

  • x[in] Array of X position data to be plotted.

  • y[in] Array of Y position data to be plotted.

  • m[in] Array of 8-bit Digital Output data to be plotted.

  • npts[in] The number of points in the arrays x and y

  • sps[in] The sample rate to use to determine the time axis of the plots

  • windowWidth[in] Adjust the plot window width in pixels

  • windowHeight[in] Adjust the plot window height in pixels

  • plotType[in] The PlotType to use when drawing the plot axes and content

unsigned int PlotData(float *x, float *y, unsigned char *m, unsigned int npts, unsigned int sps = 1, unsigned int windowWidth = 900, unsigned int windowHeight = 800, unsigned int plotType = PlotType::TimeVsXYData)#

Function that first creates a plot window and then generates plots of the user data in it with respect to the plot type

Returns unique plotID. plotID values are auto-assigned starting from 1.

Parameters:
  • x[in] Array of X position data to be plotted.

  • y[in] Array of Y position data to be plotted.

  • m[in] Array of 8-bit Digital Output data to be plotted.

  • npts[in] The number of points in the arrays x and y

  • sps[in] The sample rate to use to determine the time axis of the plots

  • windowWidth[in] Adjust the plot window width in pixels

  • windowHeight[in] Adjust the plot window height in pixels

  • plotType[in] The PlotType to use when drawing the plot axes and content

unsigned int PlotData(float *x, float *y, unsigned char *m, unsigned int npts, bool xyplot = false, unsigned int sps = 1, unsigned int windowWidth = 900, unsigned int windowHeight = 800)#

Legacy version of the function with only 2 plot types.

This function first creates a plot window and then generates two types of plots for user data: X Data Vs. Y Data and Time Vs. X Data and Y Data

Returns unique plotID. plotID values are auto-assigned starting from 1.

Parameters:
  • x[in] Array of X position data to be plotted.

  • y[in] Array of Y position data to be plotted.

  • m[in] Array of 8-bit Digital Output data to be plotted.

  • npts[in] The number of points in the arrays x and y

  • xyplot[in] Plot type, True = X Data Vs. Y Data, False = Time Vs. X Data and Y Data

  • sps[in] The sample rate to use to determine the time axis of the plots

  • windowWidth[in] Adjust the plot window width in pixels

  • windowHeight[in] Adjust the plot window height in pixels

void ClosePlots()#

This function closes all plot windows

Creation and Termination

Constructor and Destructor of the MTIDataGenerator class

MTIDataGenerator()#
~MTIDataGenerator()#

Transforms

Transform data for content generation

void BoundingBox(float *xData, float *yData, unsigned int numPoints, float &xMin, float &xMax, float &yMin, float &yMax)#

BoundingBox calculates the bounding box limits of the given set of points.

This function processes the xData and yData arrays to find the minimum and maximum values along the X and Y axes respectively. It returns these minimum and maximum values, effectively defining the bounding box for the set of points. If the number of points is less than one, it sets the bounding box limits to zero.

Parameters:
  • xData[in] Array of X position data.

  • yData[in] Array of Y position data.

  • numPoints[in] The number of points in the arrays xData and yData.

  • xMin[out] The minimum X coordinate from the given set of points.

  • xMax[out] The maximum X coordinate from the given set of points.

  • yMin[out] The minimum Y coordinate from the given set of points.

  • yMax[out] The maximum Y coordinate from the given set of points.

unsigned int NormalizeData(float *xData, float *yData, unsigned int numPoints, float amplitude, float theta, float &xMin, float &xMax, float &yMin, float &yMax)#

NormalizeData performs a normalization and rotation on a given set of points.

This function operates on xData and yData, normalizing their values by a defined amplitude, centered around their mean, and rotating the set of points by a given angle theta. The range of normalization is determined based on the maximum and minimum bounds of the points. The rotation is performed via a standard 2D rotation matrix operation.

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • amplitude[in] The amplitude for normalization.

  • theta[in] The angle in radians by which to rotate the data.

  • xMin[in] The minimum X coordinate from the given set of points.

  • xMax[in] The maximum X coordinate from the given set of points.

  • yMin[in] The minimum Y coordinate from the given set of points.

  • yMax[in] The maximum Y coordinate from the given set of points.

Returns:

The number of points processed.

unsigned int AffineTransformData(float *xData, float *yData, unsigned int numPoints, float amplitude, float theta, float xof, float yof)#

AffineTransformData performs an affine transformation (rotation, scaling, translation) on a given set of points.

This function first checks if rotation or translation is necessary. Rotation is performed only when the amplitude is not close to 1 or theta is not close to 0. Translation is performed only when either xof or yof is not close to 0.

For rotation, the function normalizes the xData and yData around their means and then rotates the points by the angle theta. It then translates the data if necessary. After the transformation, the xData and yData are clamped to the range [-1, 1].

For translation only, the function translates the xData and yData by xof and yof respectively, and then clamps the data to the range [-1, 1].

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • amplitude[in] The amplitude for normalization.

  • theta[in] The angle in radians by which to rotate the data.

  • xof[in] The offset for X position data.

  • yof[in] The offset for Y position data.

Returns:

The number of points processed.

unsigned int RotateData(float *xData, float *yData, unsigned int numPoints, float thetaAboutX, float thetaAboutY, float thetaAboutZ, bool useDataOrigin = true, float xOrigin = 0.f, float yOrigin = 0.f)#

RotateData performs transformations (rotations about 3 axes, sequentially) on a given set of points.

This function first checks if rotation or translation is necessary. Rotation is performed only when thetas are not close to 0.

For rotation, the function firstly determines the rotation Origin (offset for x-axis, y-axis, z-axis for the respective rotations). default (omitting last 3 parameters) and useDataOrigin==true will set that origin to center of data bounding box (‘data origin’) omitting last 2 parameters and useDataOrigin==false will set that to 0,0 user entries xOrigin and yOrigin and useDataOrigin==false will set that to xOrigin, yOrigin Then data is rotated about the offset x-axis, y-axis, z-axis, in that sequential order. Finally, all data is clamped to the range [-1, 1].

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • thetaAboutX[in] The angle in radians by which to rotate the data about origin, parallel with x-axis

  • thetaAboutY[in] The angle in radians by which to rotate the data about origin, parallel with y-axis

  • thetaAboutZ[in] The angle in radians by which to rotate the data about origin, parallel with z-axis

  • useDataOrigin[in] If true, data is rotated about origin of the data itself (center of bounding box), rest of parameters ignored

  • xOrigin[in] if useDataOrigin is false, this value places the rotation origin for thetaAboutY to xOrigin

  • yOrigin[in] if useDataOrigin is false, this value places the rotation origin for thetaAboutX to yOrigin

Returns:

The number of points processed.

void InitProjectiveTransformMatrix(float *x, float *y, bool inverse)#

Initializes the projective transformation matrix with the provided data.

This function creates a 3x3 transformation matrix used for projective transformations of data points. If x is NULL, the function initializes a basic transformation matrix that either scales and translates points to the range [-1, 1] or transforms points from the range [-1, 1] to the unit square [0, 1].

If x is not NULL, the function initializes a more complex projective transformation matrix based on the four points provided in x and y.

If the transformation matrix needs to be inverted (e.g., for performing the inverse transformation), the function calculates and stores the inverse of the matrix.

Parameters:
  • x[in] Array containing the x-coordinates of four points defining a quadrilateral, or NULL.

  • y[in] Array containing the y-coordinates of four points defining a quadrilateral, or NULL.

  • inverse[in] If true, calculates and stores the inverse of the transformation matrix.

unsigned int ProjectiveTransformData(float *xData, float *yData, unsigned int numPoints)#

Performs a projective transformation on a given set of points.

This function applies a projective transformation to the provided xData and yData, which are modified in-place. The transformation is defined by the matrix initialized by InitProjectiveTransformMatrix(). If the inverse flag was set to true during initialization, the function applies the inverse transformation; otherwise, it applies the forward transformation.

The resulting points are then scaled to the range [-1, 1] (for the inverse transformation) or left in the unit square [0, 1] (for the forward transformation).

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

Returns:

The number of points processed.

unsigned int TangentialTransformData(float *xData, float *yData, unsigned int numPoints, float thetaMax)#

Performs a tangential distortion transformation on a given set of points.

This function applies a tangential distortion to the provided xData and yData, which are modified in-place. The distortion factor is calculated based on the distance from the origin and the maximum distortion angle (thetaMax).

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • thetaMax[in] Maximum distortion angle in radians.

Returns:

The number of points processed.

void InitRadialTransformMult(bool inverse)#

Initializes the lookup table used in radial distortion transformations.

This function calculates and stores a set of multipliers used to quickly perform radial distortions. It should be called before performing any radial distortions.

Parameters:

inverse[in] If true, calculates and stores the inverse transformation multipliers.

unsigned int RadialTransformData(float *xData, float *yData, unsigned int numPoints, float k)#

Performs a radial distortion transformation on a given set of points.

This function applies a radial distortion to the provided xData and yData, which are modified in-place. The distortion factor is calculated based on the distance from the origin and the radial distortion coefficient (k).

The function uses a lookup table initialized by InitRadialTransformMult() to quickly calculate distortion multipliers.

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • k[in] Radial distortion coefficient.

Returns:

The number of points processed.

unsigned int TransformData(float *xData, float *yData, unsigned int numPoints, float amplitude, float theta, float xof, float yof, bool projXfm, float tanXfmTheta, float barXfmK)#

Performs a sequence of transformations on a given set of points.

This function applies a sequence of transformations to the provided xData and yData, which are modified in-place. The sequence includes an affine transformation (always performed), followed by optional projective, radial, and tangential transformations.

The projective transformation is performed if projXfm is true. The radial transformation is performed if the absolute value of barXfmK is greater than 1e-3, and requires that InitRadialTransformMult() has been called before. The tangential transformation is performed if the absolute value of tanXfmTheta is greater than 1e-3.

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • numPoints[in] The number of points in the arrays xData and yData.

  • amplitude[in] Amplitude for the affine transformation.

  • theta[in] Angle for the affine transformation.

  • xof[in] X offset for the affine transformation.

  • yof[in] Y offset for the affine transformation.

  • projXfm[in] Flag indicating whether to perform the projective transformation.

  • tanXfmTheta[in] Maximum distortion angle for the tangential transformation.

  • barXfmK[in] Radial distortion coefficient for the radial transformation.

Returns:

The number of points processed.

Utilities

Utilities for content generation

int gcd(int a, int b)#
float saw(float theta)#
unsigned int AnimationRotate(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int numFrames)#
unsigned int AnimationRotate(float *xData, float *yData, unsigned char *mData, unsigned int *rgbData, unsigned int numPoints, unsigned int numFrames)#
unsigned int AnimationScroll(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int numFrames, bool leftToRight = true)#
unsigned int AnimationScroll(float *xData, float *yData, unsigned char *mData, unsigned int *rgbData, unsigned int numPoints, unsigned int numFrames, bool leftToRight = true)#
unsigned int AnimationBounce(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int numFrames, float theta)#
unsigned int AnimationBounce(float *xData, float *yData, unsigned char *mData, unsigned int *rgbData, unsigned int numPoints, unsigned int numFrames, float theta)#
unsigned int CloseCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int closePoints, bool retrace = false)#

Closes a curve described by the input points and modifies the data in-place.

This function closes a curve by either retracing it or interpolating between the first and the last points. The operation depends on the retrace flag and the closePoints value. If retrace is true, the curve is retraced - points are added to the curve in reverse order from last point to first. If retrace is false and closePoints is more than 0, closePoints new points are added to the curve by interpolating from last point back to the first point. If neither condition is satisfied, the curve is not closed and the original data is returned. Function assumes memory pre-allocation of at least numPoints+closePoints for each array

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • mData[inout] Array of 8-bit Digital Output data, which will be modified in-place.

  • numPoints[in] The number of points in the curve.

  • closePoints[in] The number of points for the curve closure.

  • retrace[in] Flag indicating whether to retrace the curve.

Returns:

The number of points processed.

unsigned int CloseCurve(float *xData, float *yData, unsigned char *mData, unsigned int *rgbData, unsigned int numPoints, unsigned int closePoints, bool retrace = false)#

Closes a curve described by the input points and modifies the data in-place. This function is an overload of the previous function and supports RGB data for use with Mirrorcle’s RGB Playzers.

Parameters:
  • xData[inout] Array of X position data, which will be modified in-place.

  • yData[inout] Array of Y position data, which will be modified in-place.

  • mData[inout] Array of 8-bit Digital Output data, which will be modified in-place.

  • rgbData[inout] Array of RGB data for each point, which will be modified in-place. NULL if no RGB data.

  • numPoints[in] The number of points in the curve.

  • closePoints[in] The number of points for the curve closure.

  • retrace[in] Flag indicating whether to retrace the curve.

Returns:

The number of points processed.

unsigned int ConcatenateData(float **xData, float **yData, unsigned char **mData, float *xConc, float *yConc, unsigned char *mConc, unsigned int numLists, unsigned int *numPoints, unsigned int connectionPoints = 0)#

ConcatenateData combines multiple lists of data into a single list with smooth connections with user - defined number of points(“connectionPoints”) connectionPoints is defined as the number of points to be interpolated between the last point of each list and the first point of the next list (exclusive of those two points), using triangular (velocity) interpolation.

Function returns the number of points in the concatenated list (in output arrays xConc, yConc, mConc). (xConc, yConc, mConc) should be allocated for enough space to contain arrays of length at least: (sum of the elements of numPoints + (connectionPoints * numLists))

If a list of data has been closed where the last point is the same as the first point and points preceding the last have an M value of 0 (i.e. it has been passed through CloseCurve()), then the last point and all preceding points with M of 0 until the first non-zero will be removed as an optimization during concatenation.

Parameters:
  • xData[in] Array of X position arrays

  • yData[in] Array of Y position arrays

  • mData[in] Array of M digital output number arrays

  • numLists[in] The number of lists to be concatenated. xData, yData, mData must have at least this many arrays. i.e. the number of pointers in xData/yData/mData to be concatenated

  • numPoints[in] Array containing the number of points in each list. The length of the array should be at least equivalent (or greater) than numLists.

  • xConc[out] Resulting X position data after concatenation

  • yConc[out] Resulting Y position data after concatenation

  • mConc[out] Resulting M digital output data after concatenation

  • connectionPoints[in] The number of points to be interpolated between the last point of each list and the first point of the next list (defaults to 0 if not used)

Waveforms

Useful waveforms for content generation

unsigned int SineWaveform(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float amplitude, unsigned int frequency, float phase)#

Generates a sine waveform.

This function generates a sine waveform with a given amplitude, frequency, and phase. It can operate in two modes depending on whether yData is provided or not. If the pointer for yData is null, the function generates a 1D sine waveform (stored in xData). This waveform has N complete periods of a sine waveform noted by ‘frequency’ parameter described by numPoints samples. If yData is provided as a non-null address, the function generates a sine waveform “graph” (x-axis of the graph with points uniformly increasing from -1 to +1 is in xData and sin() is in yData again with ‘frequency’ periods, and given amplitude and phase offset).

Parameters:
  • xData[in] Pointer to the array for X data samples, should be pre-allocated.

  • yData[in] Pointer to the array for Y data samples, should be pre-allocated.

  • mData[in] Pointer to the array for M data samples, should be pre-allocated.

  • numPoints[in] Number of points to be generated for the waveform.

  • amplitude[in] Amplitude of the sine waveform.

  • frequency[in] Frequency of the sine waveform.

  • phase[in] Phase of the sine waveform.

Returns:

Number of points in the generated waveform.

unsigned int SawtoothWaveform(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float amplitude, unsigned int frequency, float width, float phase)#

Generates a sawtooth waveform.

This function generates a sawtooth waveform with a given amplitude, frequency, width, and phase. It can operate in two modes depending on whether yData is provided or not. If yData is null, the function generates a 1D sawtooth waveform (stored in xData). If yData is provided as a non-null address, the function generates a 2D sawtooth waveform (stored in xData and yData).

Parameters:
  • xData[in] Pointer to the array for X data samples, should be pre-allocated.

  • yData[in] Pointer to the array for Y data samples, should be pre-allocated.

  • mData[in] Pointer to the array for M data samples, should be pre-allocated.

  • numPoints[in] Number of points to be generated for the waveform.

  • amplitude[in] Amplitude of the sawtooth waveform.

  • frequency[in] Frequency of the sawtooth waveform.

  • width[in] Width (duty cycle) of the sawtooth waveform.

  • phase[in] Phase of the sawtooth waveform.

Returns:

Number of points in the generated waveform.

unsigned int SquareWaveform(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float amplitude, unsigned int frequency, float width, float phase)#

Generates a square waveform.

This function generates a square waveform with a given amplitude, frequency, width, and phase. It can operate in two modes depending on whether yData is provided or not. If yData is null, the function generates a 1D square waveform (stored in xData). If yData is provided as a non-null address, the function generates a 2D square waveform (stored in xData and yData).

Parameters:
  • xData[in] Pointer to the array for X data samples, should be pre-allocated.

  • yData[in] Pointer to the array for Y data samples, should be pre-allocated.

  • mData[in] Pointer to the array for M data samples, should be pre-allocated.

  • numPoints[in] Number of points to be generated for the waveform.

  • amplitude[in] Amplitude of the square waveform.

  • frequency[in] Frequency of the square waveform.

  • width[in] Width (duty cycle) of the square waveform.

  • phase[in] Phase of the square waveform.

Returns:

Number of points in the generated waveform.

unsigned int LissajousWaveform(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int waveType, unsigned int &sps, float xAmplitude, float yAmplitude, float xFreq, float yFreq, float phase, unsigned int modType, float modAmplitude, float modFreq, float modPhase)#

Generates a Lissajous waveform.

This function generates a Lissajous waveform with the given parameters. The Lissajous waveform is determined by the type of wave, the amplitudes and frequencies for x and y, the phase, and the modulation parameters. Modulation can be none, amplitude modulation, unipolar amplitude modulation, or frequency modulation.

Parameters:
  • xData[in] Pointer to the array for X data samples, should be pre-allocated.

  • yData[in] Pointer to the array for Y data samples, should be pre-allocated.

  • mData[in] Pointer to the array for M data samples, should be pre-allocated.

  • numPoints[in] Number of points to be generated for the waveform.

  • waveType[in] Type of the waveform. Determines if the waveform is sinusoidal or sawtooth.

  • sps[inout] Sampling rate that is calculated in the function based on the number of points and a 5 second total waveform time.

  • xAmplitude[in] Amplitude of the X waveform.

  • yAmplitude[in] Amplitude of the Y waveform.

  • xFreq[in] Frequency of the X waveform.

  • yFreq[in] Frequency of the Y waveform.

  • phase[in] Phase of the waveform.

  • modType[in] Modulation type of the waveform. Can be ModulationType::ModulationNone, ModulationType::ModulationAmpl, ModulationType::ModulationAmplUnipolar, ModulationType::ModulationFreq, or any other value (which defaults to ModulationType::ModulationAmplUnipolar).

  • modAmplitude[in] Modulation amplitude of the waveform.

  • modFreq[in] Modulation frequency of the waveform.

  • modPhase[in] Modulation phase of the waveform.

Returns:

Number of points in the generated waveform.

unsigned int NoiseWaveform(float *xData, unsigned int numPoints, float amplitude)#

Generates a random noise waveform.

This function generates a random noise waveform with a given amplitude.

Parameters:
  • xData[in] Pointer to the array for X data samples, should be pre-allocated.

  • numPoints[in] Number of points to be generated for the waveform.

  • amplitude[in] Amplitude of the random noise.

Returns:

Number of points in the generated waveform.

unsigned int RQWaveform(float *xData, float *yData, unsigned char *mData, unsigned int &sps, bool sawtoothOnY, float xAmplitude, float yAmplitude, unsigned int xFrequency, unsigned int numPeriods, float dutyCycle, float yBandwidth)#

Generates Resonant-Quasistatic (RQ) waveform data where one axis of the MEMS is driven at resonance while the other is driven point-to-point.

The function attempts to generate an RQ waveform where the xData will contain the fast-axis (resonant) waveform while the yData will contain the slow-axis (quasi-static) waveform. It will adhere to the requested frequency parameters up to an enforced limit for sample rate (sps) of 90,000 and the maximum samples per frame of the USB MEMS Controller.

The slow-axis waveform on Y-axis can be either sawtooth or sine based on the boolean flag sawtoothOnY.

Different DOut (M) bits are enabled and disabled at specific events/conditions throughout the generation of data.

Note

DOut bits have the following functionality:

  • DOut0, DOut6, DOut7: Turn on laser at every point and keep it bright.

  • DOut1: Show half sample rate.

  • DOut2: Indicate horizontal direction (high for each left-right scan).

  • DOut3: Indicate horizontal active line (may need phase adjust) for each left-right scan.

  • DOut4: Vsync. High during the rising portion, low during the falling portion of the waveform.

  • DOut5: Frame sync at start of complete pattern.

Parameters:
  • xData[out] Pointer to output array for X position data, should be pre-allocated.

  • yData[out] Pointer to output array for Y position data, should be pre-allocated.

  • mData[out] Pointer to output array for M digital output data, should be pre-allocated.

  • sps[inout] Sampling rate that is calculated in the function based on xFrequency and points per X period.

  • sawtoothOnY[in] Boolean flag to decide if the wave on Y-axis should be sawtooth (true) or sine (false).

  • xAmplitude[in] Amplitude for X position data.

  • yAmplitude[in] Amplitude for Y position data.

  • xFrequency[in] Frequency for X position data.

  • numPeriods[in] Number of periods for the waveform.

  • dutyCycle[in] Duty cycle for the waveform.

  • yBandwidth[in] Bandwidth of the software filter applied to the Y position data.

Returns:

Number of points in the generated waveform.

Curves

Curves for content generation

unsigned int SpiralCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float xAmplitude, float yAmplitude, unsigned int frequency, float phase)#
unsigned int PolygonCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float amplitude, unsigned int frequency, float phase)#
unsigned int SpirographCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int curveType, unsigned int waveType, float amplitude, int p1, int p2, int p3)#
unsigned int LissajousCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int waveType, float amplitude, unsigned int xFreq, unsigned int yFreq, float phase, unsigned int modType, float modAmplitude, unsigned int modFreq, float modPhase)#
unsigned int LissajousCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int waveType, float xAmplitude, float yAmplitude, unsigned int xFreq, unsigned int yFreq, float phase, unsigned int modType, float modAmplitude, unsigned int modFreq, float modPhase)#
unsigned int AnalogClockCurve(float *xData, float *yData, unsigned char *mData, unsigned int hrs, unsigned int min, unsigned int sec, float amplitude)#
unsigned int DigitalClockCurve(float *xData, float *yData, unsigned char *mData, unsigned int hrs, unsigned int min, unsigned int sec, unsigned int fontIndex, float amplitude, float theta, bool retrace)#
unsigned int DynamicsCurve(float *xData, float *yData, unsigned char *mData, unsigned int numPoints, float x0, float y0, float xVel, float yVel, float xAcc, float yAcc, float fRatio)#

ILDA Files

Tools to load and display ILDA files

void ClearIldaData()#

Clears ILDA data arrays to prepare for new data.

This function deletes all current ILDA data arrays to clean up memory and to prepare for loading new data.

void LoadIldaFile(const char *filename)#

Loads ILDA file.

This function opens an ILDA file, clears any previous ILDA data, and then loads data from the file into corresponding arrays. It reads data in various formats, then processes and stores the data for use in subsequent functions.

Parameters:

filename[in] The name of the ILDA file to load.

unsigned int *IldaFrameIds()#

Retrieves the Frame IDs of the loaded ILDA file.

This function returns a pointer to the array of frame IDs read from the ILDA file.

Returns:

A pointer to the array of frame IDs.

unsigned int IldaFrameType()#

Retrieves the Frame Type of the loaded ILDA file.

This function returns the frame type read from the ILDA file.

Returns:

The frame type of the ILDA file.

unsigned int IldaNumFrames()#

Retrieves the number of Frames in the loaded ILDA file.

This function returns the total number of frames read from the ILDA file.

Returns:

The number of frames in the ILDA file.

unsigned int IldaNumMaxPoints()#

Retrieves the maximum number of points in any frame of the loaded ILDA file.

This function returns the maximum number of points found in any frame of the ILDA file.

Returns:

The maximum number of points in any frame of the ILDA file.

unsigned int IldaNumTotalPoints()#

Retrieves the total number of points across all frames in the loaded ILDA file.

This function returns the total number of points found across all frames of the ILDA file.

Returns:

The total number of points in the ILDA file.

unsigned int IldaFrameSize(unsigned int frameId)#

Retrieves the number of points in a specific frame of the loaded ILDA file.

This function returns the number of points in the specified frame.

Parameters:

frameId[in] The ID of the frame for which to retrieve the number of points.

Returns:

The number of points in the specified frame.

unsigned int IldaAnimSize(unsigned int *frameIds, unsigned int numFrames)#

Calculates the total number of points in a subset of frames from the loaded ILDA file.

This function sums the number of points across a specified subset of frames.

Parameters:
  • frameIds[in] An array of frame IDs to include in the total.

  • numFrames[in] The number of frames specified in the frameIds array.

Returns:

The total number of points in the specified frames.

unsigned int IldaDataStream(float *xData, float *yData, unsigned char *mData, unsigned int *frameIds, unsigned int numFrames, float amplitude, float theta, float theta1, float theta2, bool retrace)#

Generates a data stream from ILDA file data without color information.

IldaDataStream retrieves the frames specified by frameIds from the ILDA file and transforms them based on the given parameters. It also adjusts the output arrays xData, yData and mData with the data of each point in the frames.

It applies a 3D transformation using the provided theta, theta1 and theta2 parameters. Retrace parameter allows users to close open curves in the data for retracing. If retrace is true, it will close any open curves in the data to make them suitable for retracing.

Parameters:
  • xData[inout] Pointer to a float array where x coordinate data will be stored. Must be pre-allocated.

  • yData[inout] Pointer to a float array where y coordinate data will be stored. Must be pre-allocated.

  • mData[inout] Pointer to an unsigned char array where Digital Output data will be stored. Must be pre-allocated.

  • frameIds[in] An array of frame IDs to include in the data stream.

  • numFrames[in] The number of frames specified in the frameIds array.

  • amplitude[in] The amplitude of the laser scan.

  • theta[in] The tilt angle of the laser scan.

  • theta1[in] The first rotation angle used in 3D transformation.

  • theta2[in] The second rotation angle used in 3D transformation.

  • retrace[in] If true, open curves in the data will be closed for retrace.

Returns:

Returns the number of points in the generated data stream.

unsigned int IldaDataStream(float *xData, float *yData, unsigned char *mData, unsigned int *rgbData, unsigned int *frameIds, unsigned int numFrames, float amplitude, float theta, float theta1, float theta2, bool retrace)#

Generates a data stream from ILDA file data with color information. Intended for use with RGB Playzers.

Parameters:
  • xData[inout] Pointer to a float array to store x coordinate data.

  • yData[inout] Pointer to a float array to store y coordinate data.

  • mData[inout] Pointer to an unsigned char array to store 8-bit Digital Output data.

  • rgbData[inout] Pointer to an unsigned int array to store color data. If NULL, no color data is included.

  • frameIds[in] An array of frame IDs to include in the data stream.

  • numFrames[in] The number of frames specified in the frameIds array.

  • amplitude[in] The amplitude of the laser scan.

  • theta[in] The tilt angle of the laser scan.

  • theta1[in] The first rotation angle in 3D transformation.

  • theta2[in] The second rotation angle in 3D transformation.

  • retrace[in] If true, open curves in the data will be closed for retrace.

Returns:

Returns the number of points in the generated data stream.

unsigned int GenerateIldaSampleData(float *xKey, float *yKey, unsigned char *mKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int numKeyPoints, unsigned int numSamples, unsigned int numFrames, float rr, bool interpIlda, float atime, bool retrace)#

Generates and animates keypoints into samples from information loaded from an ILDA file. This overload does not include RGB data.

This function interpolates and optionally animates keypoint data loaded from an ILDA file to create the sample data that can be sent to the USB MEMS Controller.

If numFrames > 1, GenerateIldaSampleData will create an animation according to the atime parameter. Otherwise, it will only interpolate keypoints to samples.

When animating, numSamples will be discarded and the function will adhere to the refresh rate (rr), animation time (atime), and number of frames (numFrames) constraints. When not animating, numSamples determines the target number of samples in the interpolation.

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamples[in] Desired number of samples to be generated per frame

  • numFrames[in] Number of frames to generate in the animation

  • rr[in] Frame rate to adhere to during animation

  • interpIlda[in] If true, interpolate ILDA data, if false treat key points directly as samples

  • atime[in] Animation time in seconds for the full animation.

  • retrace[in] If true, enable retracing (MEMS retraces the path to the first sample)

Returns:

Number of points in the generated samples

unsigned int GenerateIldaSampleData(float *xKey, float *yKey, unsigned char *mKey, unsigned int *rgbKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int *rgbSample, unsigned int numKeyPoints, unsigned int numSamples, unsigned int numFrames, float rr, bool interpIlda, float atime, bool retrace)#
unsigned int CurvesDataSize(unsigned int curveType, unsigned int sps, float rr, unsigned int animType, float atime, bool retrace, unsigned int fileType, unsigned int m1, unsigned int m2, float p2, float p3, float p4, const char *txt, unsigned int numChars)#

Hershey Text

Tools to generate Hershey text

void ClearHersheyData()#
void LoadHersheyFile(const char *filename)#

Loads data from a Hershey file into the MTIDataGenerator object.

This function reads data from the provided Hershey file, such as the number of characters, fonts, mathematical symbols, etc. The data is then stored into the object’s member variables and arrays.

Typically used with the provided hershey.dat file.

Parameters:

filename[in] The path to the Hershey file to be loaded.

unsigned int HersheyNumMath()#

Retrieves the number of mathematical symbols in the loaded Hershey file.

Returns:

The number of mathematical symbols.

unsigned int HersheyNumSym()#

Retrieves the number of symbols in the loaded Hershey file.

Returns:

The number of symbols.

unsigned int HersheyNumOR()#

Retrieves the number of original representation characters in the loaded Hershey file.

Returns:

The number of original representation characters.

unsigned int HersheyNumOC()#

Retrieves the number of orthogonal coordinates characters in the loaded Hershey file.

Returns:

The number of orthogonal coordinates characters.

unsigned int HersheyIndexMath(unsigned int i)#

Retrieves the index of a mathematical symbol in the loaded Hershey file.

Parameters:

i[in] Index of the mathematical symbol to retrieve.

Returns:

The index of the mathematical symbol. If the index is out of range, return (unsigned int)-1.

unsigned int HersheyIndexSym(unsigned int i)#

Retrieves the index of a symbol in the loaded Hershey file.

Parameters:

i[in] Index of the symbol to retrieve.

Returns:

The index of the symbol. If the index is out of range, return (unsigned int)-1.

unsigned int HersheyIndexFont(unsigned int i, unsigned int j)#

Retrieves the index of a font in the loaded Hershey file.

Parameters:
  • i[in] Index of the font to retrieve.

  • j[in] Index of the character within the font.

Returns:

The index of the font. If the index is out of range, return (unsigned int)-1.

unsigned int HersheyDataSize(unsigned int *charIds, unsigned int numChars, bool ocMode)#

Calculates the total size of Hershey data based on provided character ids.

This function calculates the total size of Hershey data points based on the provided character ids and mode. The ocMode determines whether to use orthogonal coordinates (true) or original representation (false).

Parameters:
  • charIds[in] Pointer to an array of character ids.

  • numChars[in] Number of character ids provided.

  • ocMode[in] If true, use orthogonal coordinates mode. If false, use original representation.

Returns:

The total number of data points.

unsigned int HersheyDataSize(const char *text, unsigned int numChars, unsigned int fontIndex)#

Calculates the total size of Hershey data based on provided text.

This function calculates the total size of Hershey data points based on the provided text and font index. The text is mapped to character ids using the HersheyIndexFont function. The function currently uses the orthogonal coordinates mode.

Parameters:
  • text[in] Pointer to the text string.

  • numChars[in] Number of characters in the text.

  • fontIndex[in] Index of the font to be used.

Returns:

The total number of data points.

unsigned int HersheyDataStream(float *xData, float *yData, unsigned char *mData, unsigned int *charIds, unsigned int numChars, bool ocMode, float amplitude, float theta, bool retrace)#

Generates a data stream representing a sequence of Hershey characters.

This function creates a sequence of Hershey characters given their IDs and streams the generated data into the provided arrays. The function also provides the option to normalize and close the data curve. Special handling is provided for the characters “O”, “o”, and “0”.

Parameters:
  • xData[out] Pointer to the array where the X data points will be stored.

  • yData[out] Pointer to the array where the Y data points will be stored.

  • mData[out] Pointer to the array where the M data points will be stored.

  • charIds[in] Pointer to an array of character ids.

  • numChars[in] Number of characters to generate.

  • ocMode[in] If true, use orthogonal coordinates mode. If false, use original representation.

  • amplitude[in] The amplitude for the normalization of the data.

  • theta[in] The rotation angle (in radians) for the normalization of the data.

  • retrace[in] If true, the curve will be closed by retracing it in reverse.

Returns:

The total number of data points generated.

unsigned int HersheyDataStream(float *xData, float *yData, unsigned char *mData, const char *text, unsigned int numChars, unsigned int fontIndex, float amplitude, float theta, bool retrace)#

Generates a data stream representing a sequence of Hershey characters from a text string.

This function creates a sequence of Hershey characters given a text string and streams the generated data into the provided arrays. The function also provides the option to normalize and close the data curve. It always uses orthogonal coordinates mode.

Parameters:
  • xData[out] Pointer to the array where the X data points will be stored.

  • yData[out] Pointer to the array where the Y data points will be stored.

  • mData[out] Pointer to the array where the M data points will be stored.

  • text[in] The text string to generate Hershey data for.

  • numChars[in] Number of characters in the text string.

  • fontIndex[in] Index of the font to be used.

  • amplitude[in] The amplitude for the normalization of the data.

  • theta[in] The rotation angle (in radians) for the normalization of the data.

  • retrace[in] If true, the curve will be closed by retracing it in reverse.

Returns:

The total number of data points generated.

Point Files

Point files have 3 columns, for X data (-1 to 1), Y data (-1 to 1), and M data (0-255 for digital output) File may specify sample per second rate SPS in the first line

void ClearPointFileData()#

Deletes and clears any point data currently loaded into the file buffers.

This function removes all point data that was previously loaded from a point file.

void AllocPointFileData(unsigned int numPoints)#

Allocates space for point file data.

This function creates new arrays for the X, Y, and M data of the point file if the specified number of points is greater than the currently allocated space. The number of points is then updated.

Parameters:

numPoints[in] The number of points to allocate space for.

unsigned int LoadPointFile(const char *filename)#

Loads point data from a specified file.

This function opens a file, reads its lines, and loads the point data into internal (object) X, Y, and M arrays. If the file specifies a samples per second rate (SPS) in first line, this is also internally recorded. The number of points read from the file is returned.

Parameters:

filename[in] The name of the file to load.

Returns:

The number of points loaded from the file.

unsigned int PointFileDataStream(float *xData, float *yData, unsigned char *mData)#

Copies point data loaded from file to the specified output buffers.

The function copies X, Y, and M data from the internal (object) arrays to the specified output arrays.

Parameters:
  • xData[out] The X data output buffer.

  • yData[out] The Y data output buffer.

  • mData[out] The M data output buffer.

Returns:

The number of points copied to the output buffers.

unsigned int GetPointFileSize()#

Retrieves the size of the loaded point file.

This function returns the number of points loaded from the most recent file.

Returns:

The number of points in the loaded point file.

unsigned int GetPointFileSps()#

Retrieves the samples per second rate of the loaded point file.

This function returns the samples per second rate specified by the most recent file. If loaded point file did not specify sample rate (SPS or sps) value is 0

Returns:

The samples per second rate of the loaded point file.

void ExportFile(const char *filename, float *xData, float *yData, unsigned char *mData, unsigned int numPoints, unsigned int sps = 0)#

Writes a data stream to a specified file.

This function opens a file and writes the specified X, Y, and M data, along with the sampling rate in samples per second (if specified > 0).

Parameters:
  • filename[in] The name of the file to write to.

  • xData[in] The X data.

  • yData[in] The Y data.

  • mData[in] The M data.

  • numPoints[in] The number of points to write.

  • sps[in] The samples per second rate.

static float ReadFileParameter(const char *filename, const char *paramName, float paramValue = 0.f)#

Reads a specified parameter from a file.

This function opens a file, searches for the specified parameter, and returns its value. If the parameter is not found, the default value is returned.

Parameters:
  • filename[in] The name of the file to read from.

  • paramName[in] The name of the parameter to read.

  • paramValue[in] The default value to return if the parameter is not found.

Returns:

The value of the parameter read from the file, or the default value if not found.

Point-Time Files - Files

Point-Time files have 4 columns, for X data (-1 to 1 float), Y data (-1 to 1 float), M data (0-255 for digital output), and T data (0 to 1 float) for time duration at specified XYM values File may specify sample per second rate SPS in the first line

void ClearPointTimeFileData()#
void AllocPointTimeFileData(unsigned int numPoints)#
unsigned int LoadPointTimeFile(const char *filename)#

Loads point (keypoint) and time data from a specified file.

This function opens a file, reads its lines, and loads the point and time data into internal (object) X, Y, M, and T arrays. If the file specifies a samples per second rate (SPS), this is also internally recorded. The number of points read from the file is returned.

Parameters:

filename[in] The name of the file to load.

Returns:

The number of points loaded from the file.

unsigned int PointTimeFileDataStream(float *xData, float *yData, unsigned char *mData, float *tData)#

Copies point and time data loaded from file to the specified output buffers.

The function copies X, Y, M, and T data from the internal (object) arrays to the specified output arrays.

Parameters:
  • xData[out] The X data output buffer.

  • yData[out] The Y data output buffer.

  • mData[out] The M data output buffer.

  • tData[out] The T (time) data output buffer.

Returns:

The number of points copied to the output buffers.

unsigned int GetPointTimeFileSize()#

Retrieves the size of the loaded Point-Time file.

This function returns the number of points loaded from the most recent file.

Returns:

The number of points in the loaded Point-Time file.

unsigned int GetPointTimeFileSps()#

Retrieves the samples per second rate of the loaded Point-Time file.

This function returns the samples per second rate specified by the most recent file. If loaded point file did not specify sample rate (SPS or sps) value is 0

Returns:

The samples per second rate of the loaded point time file.

Interpolation

Functions for interpolating data using various interpolation methodologies

void ClearInterpData()#

Clears interpolation data by deallocating the memory used by the array m_fDs.

void AllocInterpData(unsigned int numKeyPoints, unsigned int numSamplePoints)#

Allocates memory for the interpolation data array (m_fDs) with the specified number of key points.

The number of key points is rounded up to the nearest multiple of 10,000 before allocation. If the newly calculated number of key points exceeds the maximum number of key points currently allocated (m_iMaxKeyPoints), the existing memory for m_fDs is deallocated and reallocated with the new size.

Note: Users typically will not need to use this function when calling the InterpolateData function family, as these functions make calls to AllocInterpData on their own.

Parameters:
  • numKeyPoints[in] The initial number of key points.

  • numSamplePoints[in] The number of sample points (currently unused).

unsigned int InterpolateData(float *xKey, float *yKey, unsigned char *mKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int numKeyPoints, unsigned int numSamplePoints, float ooRatio = 2.5f, float onFrac = 0.1f, float offFrac = 0.5f)#

Interpolates keypoint data using either linear or trapezoidal interpolation methodologies.

This function interpolates keypoint data to create sample data. The interpolation methodology is selected based on the provided ooRatio, onFrac, and offFrac parameters.

If onFrac and offFrac are 0, then InterpolateDataLinear() is used. Otherwise, InterpolateDataTrapezoidal() is used.

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamplePoints[in] Desired number of samples to be generated

  • ooRatio[in] On-off ratio used to adjust keypoint interpolation

  • onFrac[in] Proportional acceleration distance for laser-on segments: 0.05 to 0.2 are recommended

  • offFrac[in] Proportional acceleration distance for laser-off segments: best results with 0.5 Values >0.5 will break the function’s behavior as you need at least as much time to decelerate as accelerate

Returns:

Number of points in the generated samples data stream

unsigned int InterpolateDataLinear(float *xKey, float *yKey, unsigned char *mKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int numKeyPoints, unsigned int numSamplePoints, float ooRatio = 2.5f)#

Performs linear interpolation of keypoint data to generate sample data.

This function interpolates keypoint data to create sample data using linear interpolation methodology.

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamplePoints[in] Desired number of samples to be generated

  • ooRatio[in] On-off ratio used to adjust keypoint interpolation

Returns:

Number of points in the generated samples data stream

unsigned int InterpolateDataTrapezoidal(float *xKey, float *yKey, unsigned char *mKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int numKeyPoints, unsigned int numSamplePoints, float ooRatio = 2.5f, float onFrac = 0.1f, float offFrac = 0.5f)#

Interpolates keypoint data into sample data using trapezoidal interpolation.

Trapezoidal interpolation is especially useful in this context where the MEMS mirror’s velocity needs to be controlled. ooRatio, onFrac, and offFrac are the key parameters used to tune the velocity profile of the MEMS as the position samples are sampled to the device at a constant sample rate.

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamplePoints[in] Desired number of samples to be generated (the target length of the output data stream).

  • ooRatio[in] On-off ratio used in linear interpolation. Function clamps value to [1,10].

  • onFrac[in] Proportional acceleration distance for laser-on segments: 0.05 to 0.2 are recommended. Function clamps value [0,0.5].

  • offFrac[in] Proportional acceleration distance for laser-off segments: best results with 0.5 Values >0.5 will break the function’s behavior as you need at least as much time to decelerate as accelerate Therefore the function clamps value [0,0.5].

Returns:

Number of points in the generated samples

unsigned int InterpolateDataOptimized(float *xKey, float *yKey, unsigned char *mKey, unsigned int *rgbKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int *rgbSample, unsigned int numKeyPoints, unsigned int numSamplePoints)#

Interpolates data points from the input keypoints, including RGB data, using an optimized interpolation algorithm.

This function is an overload of InterpolateDataOptimized() function and also includes RGB data interpolation. It uses a series of data optimizations to interpolate from keypoints to sample data points. It performs checks and adjustments on the data to ensure effective and safe interpolation. These include handling corner cases, adjusting for short segments, assigning acceleration, uniform velocity, and deceleration points for sufficient sample points, and applying linear interpolation when there are too few points per segment. If RGB data is provided (i.e., rgbKey and rgbSample are not NULL), it is also interpolated.

Typically preceded by a call to OptimizeKeypoints()

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • rgbKey[in] Pointer to array of RGB color keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • rgbSample[out] Pointer to output array for RGB color samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamplePoints[in] Desired number of samples to be generated

Returns:

Number of points in the interpolated samples

unsigned int InterpolateDataOptimized(float *xKey, float *yKey, unsigned char *mKey, float *xSample, float *ySample, unsigned char *mSample, unsigned int numKeyPoints, unsigned int numSamplePoints)#

Interpolates data points from the input keypoints, using an optimized interpolation algorithm.

This function uses a series of data optimizations to interpolate from keypoints to sample data points. It performs checks and adjustments on the data to ensure effective and safe interpolation. These include handling corner cases, adjusting for short segments, assigning acceleration, uniform velocity, and deceleration points for sufficient sample points, and applying linear interpolation when there are too few points per segment. RGB data is not included in this overload.

Typically preceded by a call to OptimizeKeypoints()`

Parameters:
  • xKey[in] Pointer to array of X position keypoints

  • yKey[in] Pointer to array of Y position keypoints

  • mKey[in] Pointer to array of M digital output keypoints

  • xSample[out] Pointer to output array for X position samples, should be pre-allocated.

  • ySample[out] Pointer to output array for Y position samples, should be pre-allocated.

  • mSample[out] Pointer to output array for M digital output samples, should be pre-allocated.

  • numKeyPoints[in] Number of keypoints provided in each input array

  • numSamplePoints[in] Desired number of samples to be generated

Returns:

Number of points in the interpolated samples

unsigned int OptimizeKeypoints(float *xKey, float *yKey, unsigned char *mKey, unsigned int numKeyPoints, unsigned int targetNumKeyPoints = 0)#

Optimizes the given arrays of keypoints, targeting the requested number of keypoints post-optimization.

This function aims to enhance the distribution and minimize the redundancy of keypoints in a given dataset. It primarily addresses the removal of repeated identical keypoints, multiple blanking keypoints, and non-essential keypoints where the angle of adjacent vectors is equal.

Typically followed by a call to InterpolateDataOptimized().

Parameters:
  • xKey[inout] Pointer to array of X position keypoints, this array will be updated based on optimizations.

  • yKey[inout] Pointer to array of Y position keypoints, this array will be updated based on optimizations.

  • mKey[inout] Pointer to array of M digital output keypoints, this array will be updated based on optimizations.

  • numKeyPoints[in] Initial number of keypoints provided in each input array.

  • targetNumKeyPoints[in] Desired number of keypoints after optimization.

Returns:

Number of keypoints after the optimization process.

unsigned int OptimizeKeypoints(float *xKey, float *yKey, unsigned char *mKey, unsigned int *rgbKey, unsigned int numKeyPoints, unsigned int targetNumKeyPoints = 0)#

Optimizes the keypoints of given data arrays, including consideration of RGB data.

This function aims to enhance the distribution and minimize the redundancy of keypoints in a given dataset, also taking into account RGB data. It addresses the removal of repeated identical keypoints, multiple blanking keypoints, and non-essential keypoints where the angle of adjacent vectors is equal.

Typically followed by a call to InterpolateDataOptimized().

Parameters:
  • xKey[inout] Pointer to array of X position keypoints, this array will be updated based on optimizations.

  • yKey[inout] Pointer to array of Y position keypoints, this array will be updated based on optimizations.

  • mKey[inout] Pointer to array of M digital output keypoints, this array will be updated based on optimizations.

  • rgbKey[inout] Pointer to array of RGB data keypoints, this array will be updated based on optimizations.

  • numKeyPoints[in] Initial number of keypoints provided in each input array.

  • targetNumKeyPoints[in] Desired number of keypoints after optimization.

Returns:

Number of keypoints after the optimization process.

Filtering

Functions for filtering data

void LoadIIRFilterParams(const char *filename)#
unsigned int GetIIRFilterOrder()#
unsigned int GetIIRFilterSps()#
void SetupSoftwareFilter(unsigned int type, unsigned int order, float cutoffFreq, float sampleFreq, bool twoChannel = true)#
void FilterData(float *xData, float *yData, float *xFilt, float *yFilt, unsigned int numPoints, bool zeroPhase = true)#
void FilterData(float *xData, float *xFilt, unsigned int numPoints, bool zeroPhase = true)#

Scan Patterns

Functions to generate various scan patterns

unsigned int LinearRasterPattern(float *xData, float *yData, unsigned char *mData, float xAmp, float yAmp, unsigned int numLines, unsigned int numPixels, float lineTime, bool ppMode, bool retrace, int triggerShift, float theta, unsigned int &sps, int spsMin = 1000, int spsMax = 100000)#

LinearRasterPattern constructs a linear raster scan pattern based on the given parameters.

Parameters:
  • xData[inout] X position output container with pre-allocated length (recommended 1,000,000 points for large waveform streaming)

  • yData[inout] Y position output container with pre-allocated length (recommended 1,000,000 points for large waveform streaming)

  • mData[inout] 8-bit Digital Output number output container with pre-allocated length (recommended 1,000,000 points for large waveform streaming)

    • Bit 0: On during the “active” portion of line

    • Bit 1: On during the pixel portion of line

    • Bit 2: Pulsed at the beginning of the frame

    • Bit 3: Indicates Y-Axis direction (if implemented). High for increasing Y position, low for decreasing Y position.

    • Bit 4: On during the “active portion of line” (same as Bit 0)

    • Bit 5: On during the “active portion of line” (same as Bit 0)

    • Bit 6: On during the “active portion of line” (same as Bit 0)

    • Bit 7: On during the “active portion of line” (same as Bit 0)

  • xAmp[in] Amplitude of X-axis of the raster scan (normalized from 0.0 to 1.0)

  • yAmp[in] Amplitude of Y-axis of the raster scan (normalized from 0.0 to 1.0)

  • numLines[in] Total number of raster lines. During each line scan there is a high output on DOut0, and during each turn-around there is a low output on DOut0.

  • numPixels[in] When ppMode = true, numPixels corresponds to the number of stop-and-go locations (“pixels”) along a line. In both ppMode = false and ppMode = true, numPixels corresponds to the number of equally spaced Digital Output pulses along a line, contained in Bit 1 of mData.

  • lineTime[in] Duration of time allocated to each raster line in seconds. The time is specifically allocated to the ‘active’ portion of each line. The actual scan along one line will include a small additional percentage of time for turn-around.

  • ppMode[in] ppMode = 1 corresponds to point-to-point raster with near stopping at each point. ppMode = 0 corresponds to a uniform velocity line raster.

  • retrace[in] Toggles between bi-directional writing on (1) and off (0)

  • triggerShift[in] Number of samples the synchronous digital output should be rotated with respect to the MEMS Driver X, Y output (can be negative or positive). User may want to differently align the locations of the TTL pulses on DOut0-3 and can therefore rotate forward or backward a number of samples.

  • theta[in] Rotation angle for the raster pattern (looking toward display surface) in radians. Passing 0 results in vertical lines.

  • sps[inout] Sample rate of raster scan. The user can pre-set this sample rate, however the function will likely override and return (in-place) the rate based on the numLines and numPixels input to best match the desired scan

  • spsMin[in] Sets the lower limit for samples-per-second rate generated internally by the function. Typically this is the controller’s lower sample rate limit (MTIDeviceLimits::SampleRate_Min).

  • spsMax[in] Sets the upper limit for samples-per-second rate generated internally by the function. Typically this is the controller’s upper sample rate limit (MTIDeviceLimits::SampleRate_Max).

Returns:

Returns the number of points in the constructed scan pattern.

unsigned int LinearRasterPatternImaging(float *xData, float *yData, unsigned char *mData, float xAmp, float yAmp, unsigned int numLines, unsigned int numPixels, float lineTime, bool ppMode, bool retrace, int triggerShift, float theta, unsigned int &sps, int spsMin = 1000, int spsMax = 100000)#
unsigned int PointToPointPattern(float *xData, float *yData, unsigned char *mData, float *xPoint, float *yPoint, unsigned char *mPoint, float *tPoint, int nPoints, float stepTime, unsigned int &sps, int spsMin, int spsMax)#

PointToPointPattern constructs a scan pattern that traces a path between specified points, spending a specified amount of time at each point, and attempting to step between points with the specified step time.

Parameters:
  • xData[inout] X position output container with pre-allocated length (recommended 100,000 points)

  • yData[inout] Y position output container with pre-allocated length (recommended 100,000 points)

  • mData[inout] 8-bit Digital Output number output container with pre-allocated length (recommended 100,000 points)

  • xPoint[in] Array of X position keypoints specifying the path for the function to trace

  • yPoint[in] Array of Y position keypoints specifying the path for the function to trace

  • mPoint[in] Array of M 8-bit Digital Output number keypoints specifying the digital output number at each position on the path. Note that the M value for step segments between points is forced to 0 by the function, so the specified M value is only sampled by the Controller at the corresponding X/Y position for the amount of time tPoint[position] - stepTime.

  • tPoint[in] Array of time keypoints specifying the time spent at each position on the path (in milliseconds) Note that the time allocated with tPoint to a given point is a total of time dwelling at position plus the stepTime to next position therefore dwell time at position is tPoint[position]-stepTime unless stepTime is longer than allocated time

  • nPoints[in] Number of keypoints in the xPoint, yPoint, mPoint, and tPoint arrays to be used in the pattern

  • stepTime[in] Desired time spent on the step/transition between points (in milliseconds) Note that if stepTime is 0 or too small, function will assign a minimum number of points to the step (usually 6 samples) stepTime should be less than any tPoint since dwellTime[position] = tPoint[position]-stepTime

  • sps[inout] Sample rate of the point-to-point scan. If the sample rate is set to 0, the function will calculate the optimal sample rate for the given path parameters and populate the given reference. For a non-zero sample rate, the function will attempt to use the given sample rate. Note that user must use the sample rate sps when sampling this waveform to have the resulting scan follow prescribed point-to-point timing

  • spsMin[in] Sets the lower limit for samples-per-second rate generated internally by the function. Typically this is the controller’s lower sample rate limit (MTIDeviceLimits::SampleRate_Min).

  • spsMax[in] Sets the upper limit for samples-per-second rate generated internally by the function. Typically this is the controller’s upper sample rate limit (MTIDeviceLimits::SampleRate_Max).

Returns:

Returns the number of points in the constructed point-to-point pattern.

void LaserWriterInterpData(int inCount, int outCount, unsigned char *inM, float *inX, float *inY, unsigned char *outM, float *outX, float *outY, float DON, float DOFF, int closed_trajectory)#
void LaserWriterInterpData1Seg(int inCount, int outCount, float *inX, float *outX, float DON)#

MTIDeviceParams#

class MTIDeviceParams#

Public Members

bool Success#
char DeviceName[32]#
char FirmwareName[16]#
char CommType[16]#
char BluetoothMAC[16]#
unsigned int HardwareFilterOn#
float VmaxMEMSDriver#
unsigned int DeviceState#
unsigned int DeviceErrorRegister#
unsigned int USARTBaudRate#
unsigned int SampleRate#
unsigned int HardwareFilterBw#
float VdifferenceMax#
float Vbias#
float XOffset#
float YOffset#
float DataScale#
float DataRotation#
unsigned int MEMSDriverEnable#
unsigned int DigitalOutputEnable#
unsigned int LaserModulationEnable#
unsigned int BufferOffset#
MTIAxes DeviceAxes#
MTIBoot BootSetting#
MTIDataMode DataMode#
MTISync SyncMode#
MTIDataFormat DataFormat#
unsigned int SampleRate_Min#
unsigned int SampleRate_Max#
unsigned int SamplesPerFrame_Min#
unsigned int SamplesPerFrame_Max#
unsigned int HardwareFilterBw_Min#
unsigned int HardwareFilterBw_Max#
unsigned int FramesPerSecond_Min#
unsigned int FramesPerSecond_Max#
unsigned int VdifferenceMax_Min#
unsigned int VdifferenceMax_Max#
unsigned int Vbias_Min#
unsigned int Vbias_Max#
struct MTIDeviceParams::[anonymous] DeviceLimits#

MTIAvailableDevices#

class MTIAvailableDevices#

Public Members

char DeviceName[MTI_MAXDEVICES][32]#
char FirmwareName[MTI_MAXDEVICES][16]#
char CommType[MTI_MAXDEVICES][16]#
unsigned int USARTBaudRate[MTI_MAXDEVICES]#
unsigned int CommPortNumber[MTI_MAXDEVICES]#
char CommPortName[MTI_MAXDEVICES][10]#
float VmaxMEMSDriver[MTI_MAXDEVICES]#
unsigned int NumDevices#

MTITrackParams#

class MTITrackParams#

Public Members

bool Success#
float Threshold#
int NormalGain#
int TangentialGain#
unsigned int BufferDelay#
float HitRatio#
unsigned int EnableSearch#
unsigned int EnableOffsetStreaming#
unsigned int EnableTrack#

MTITrackStatus#

class MTITrackStatus#

Public Members

bool Success#
bool TrackLocked#
float XOffset#
float YOffset#
unsigned int HitCount#

Enums#

MTIParam#

enum MTIParam#

Values:

enumerator HardwareFilterOn#

Hardware Filter Available on Driver (Read only)

enumerator VmaxMEMSDriver#

Maximum Voltage range of MEMS driver (Read only)

enumerator DeviceState#

16-Bit register with various device states and flags (Read only)

enumerator DeviceErrorRegister#

Register for device error states (Read only)

enumerator USARTBaudRate#

USART communication Baud Rate - Default of 460kBaud.

enumerator SampleRate#

Sample Rate of the controller to update MEMS position, DOut, read AIs, etc.

enumerator HardwareFilterBw#

Hardware filter cut-off frequency - Recommended by MEMS Datasheet.

enumerator VdifferenceMax#

Maximum differential voltage - Recommended by MEMS Datasheet.

enumerator Vbias#

Bias Voltage for the MEMS - Recommended by MEMS Datasheet.

enumerator OutputOffsets#

Offsets for MEMS driver output, Normalized value from -1 to +1.

enumerator DataScale#

Normalized scale of VdifferenceMax MEMS output from 0.0 to 1.0.

enumerator DataRotation#

Rotation of MEMS output in radians.

enumerator MEMSDriverEnable#

Enable/ disable MEMS driver.

enumerator DigitalOutputEnable#

Enable/ disable digital outputs.

enumerator LaserModulationEnable#

Enable/ disable laser modulation at 2x sample rate (for Tracking)

enumerator BufferOffset#

Offset memory buffer.

enumerator DeviceAxes#

Device Axes orientation (Device Parameter Structure)

enumerator BootSetting#

Device startup settings (Device Parameter Structure)

enumerator DataMode#

Defines the data mode for operation (Device Parameter Structure)

enumerator SyncMode#

Defines the sync port operation (Device Parameter Structure)

enumerator DataFormat#

The format of the data sent to the Controller. Should align with the Controller’s firmware.

enumerator FramesPerSecond#
enumerator InterpolationType#
enumerator WaveformType#

MTIError#

enum MTIError#

Values:

enumerator MTI_SUCCESS#

Last operation/ communication was succesful.

enumerator MTI_ERR_INVALID_HANDLE#

Handle is not existing.

enumerator MTI_ERR_INVALID_DEVICEID#

No or wrong device ID.

enumerator MTI_ERR_GENERAL#

General error.

enumerator MTI_ERR_SERIALCOMM#

Communication error ocurred.

enumerator MTI_ERR_SERIALCOMM_READ_TIMEOUT#

Communication timed out.

enumerator MTI_ERR_SERIALCOMM_SERIAL_RESET_FAIL#

Reset of the communication failed.

enumerator MTI_ERR_INCORRECT_TARGET_RESPONSE#

Incorrect response received from target device.

enumerator MTI_ERR_PARAMETER_OUT_OF_RANGE#

Parameter value out of range.

enumerator MTI_ERR_SOME_PARAMETERS_CANNOT_BE_SET#

Some parameters can not be set in the device.

enumerator MTI_ERR_INVALID_PARAMETER_NAME#

Invalid parameter name.

enumerator MTI_ERR_CONNECTDEVICE_INVALID_PORTNAME#

Invalid port name.

enumerator MTI_ERR_CONNECTDEVICE_PORT_NOT_AVAILABLE#

Port not available.

enumerator MTI_ERR_LOADDEVICEPARAMS_FILE_NOT_FOUND#

INI file not found.

MTIDeviceLimits#

enum MTIDeviceLimits#

Values:

enumerator SampleRate_Min#

Minimum sample rate (Read only firmware)

enumerator SampleRate_Max#

Maximum sample rate (Read only firmware)

enumerator SamplesPerFrame_Min#

Minimum samples per frame (Read only firmware)

enumerator SamplesPerFrame_Max#

Maximum samples per frame (Read only firmware)

enumerator HardwareFilterBw_Min#

Minimum hardware filter bandwidth (Read only firmware)

enumerator HardwareFilterBw_Max#

Maximum hardware filter bandwidth (Read only firmware)

enumerator FramesPerSecond_Min#

Minimum frames per second (Read only firmware)

enumerator FramesPerSecond_Max#

Maximum frames per second (Read only firmware)

enumerator VdifferenceMax_Min#

Minimum differential voltage (Read only firmware)

enumerator VdifferenceMax_Max#

Maximum differential voltage (Read only firmware)

enumerator Vbias_Min#

Minimum bias voltage (Read only firmware)

enumerator Vbias_Max#

Maximum bias voltage (Read only firmware)

MTIDataMode#

enum MTIDataMode#

Values:

enumerator Sample_Output#

Output mode at sample rate (default) (Continuous Run)

enumerator Sample_And_Analog_Input_Buffer#

Output mode for sampling analog input signals into buffer while outputting samples (Single Run)

enumerator Keypoint#

Output mode keypoints.

enumerator Sample_Output_FIFO#

Output mode for continuous data streaming. Data streams are stored into a FIFO buffer and sampled out at the current sample rate. Requires new samples to be continuously streamed to the Controller.

enumerator Waveform#

Output mode waveforms.

enumerator Analog_Input_To_Output#

Output mode passing analog inputs (+/-10V) to MEMS driver.

enumerator Sample_And_Analog_Input_Stream#

Output mode for streaming analog inputs while outputting samples.

enumerator Sample_And_Analog_Input_Track#

Output mode for streaming analog inputs and streaming samples.

enumerator Auto_Track#

Automatic tracking.

enumerator Sample_And_SyMPL1_Stream#

Output mode for streaming distances with SyMPL1 lidar architecture.

MTISync#

enum MTISync#

Values:

enumerator Output_DOut0#

Default digital output levels at pin 0.

enumerator Output_Inverted_DOut0#

Inverted digital output levels at pin 0.

enumerator Output_Sample_Clock#

Output a clock signal at sync connector.

enumerator Output_Start_Trigger#

Output a trigger signal at sync connector.

enumerator External_Sample_Clock#

Input a external clock signal at sync connector.

enumerator External_Start_Trigger#

Input a start trigger signal at sync connector.

enumerator External_Frame_Trigger#

Input an external trigger signal at sync connector to start single scan of frame.

MTIAxes#

enum MTIAxes#

Values:

enumerator Normal#

Normal X,Y Axes Definition.

enumerator FlipXY#

Flip both axes.

enumerator MirrorY#

Mirror Y axis.

enumerator MirrorY_FlipXY#

Mirror Y, flip X with Y axis.

enumerator MirrorX#

Mirror X axis.

enumerator MirrorX_FlipXY#

Mirror X, flip X with Y axis.

enumerator MirrorX_MirrorY#

Mirror X,Y axes.

enumerator MirrorX_MirrorY_FlipXY#

Mirror and flip both axes.

MTIFlash#

enum MTIFlash#

Values:

enumerator Device_Params#

Store device parameters in flash.

enumerator Data_In_Buffer#

Store data in buffer in flash.

MTIBoot#

enum MTIBoot#

Values:

enumerator Boot_With_Factory_Defaults#

Boot with factory settings (default)

enumerator Boot_With_Flash_Device_Params#

Boot with (customized) device parameters from flash.

enumerator Boot_With_Flash_Data_And_Autorun#

Boot with (customized) device parameters and data from flash and auto run.

enumerator Boot_With_Flash_Data_No_Autorun#

Boot with (customized) device parameters and data from flash and wait for commands.

MTITrack#

enum MTITrack#

Values:

enumerator Threshold#

Analog input voltage threshold to trigger tracking.

enumerator NormalGain#

Tracking gain to follow target - corrections toward the estimated center of the target. Actual gain is applied in the Controller as 2^NormalGain, and therefore NormalGain is often a negative value.

enumerator TangentialGain#

Tracking gain to move along the perimeter of target (Positive is clockwise and negative is counterclockwise). Corrections perpendicular to the estimated vector from current position to the center of the target.

enumerator BufferDelay#

Tracking setting which corrects the time-correlation of XY MEMS positions and the M Digital Output, due to the fact that XY MEMS positions are delayed by filtering.

enumerator HitRatio#

The ratio of the MEMS scan (nutation) that should hit/cover the target. (e.g. 1 to fully cover the target, 0.5 to cover half of the target).

enumerator EnableSearch#

Toggle to enable / disable the search feature. When all points are below threshold, system can start a search raster pattern or stay in the same position depending on this setting.

enumerator EnableOffsetStreaming#

Toggle to enable / disable offset streaming feature. When on, Controller will continuously stream current X and Y offset positions - during tracking this provides real time azimuth and elevation data about the target location. The other option is to disable this feature and asynchronously poll the positions using the GetDeviceParam( MTIParam::OutputOffsets, n)

enumerator EnableTrack#

Toggle to enable / disable the track feature. When disabled, position will not be updated based on one nutation cycle. When enabled, offsets are updated to improve centering on the target, at each end of frame/buffer.

MTIBlockingMode#

enum MTIBlockingMode#

Values:

enumerator MTI_BLOCKING_MODE_ERR#
enumerator MTI_BLOCKING_MODE_OFF#
enumerator MTI_BLOCKING_MODE_ON#

PlotType#

enum PlotType#

The style of plot to use when using MTIDataGenerator::PlotData

Values:

enumerator TimeVsXYData#
enumerator XDataVsYData#
enumerator TimeVsXData#
enumerator TimeVsYData#
enumerator TimeVsMData#
enumerator TimeVsXMData#
enumerator TimeVsYMData#
enumerator TimeVsXYMData#