Gocator Development Kit
 All Classes Files Functions Variables Typedefs Friends Modules Pages
Data Processing

While the sensor is running, the GdkTool_Process method will be called whenever there is a scan ready to be used.

The implementation of this method can walkthrough the information contained in that scan, perform some measurements according to user configuration, and output the result before the method returns.

GdksFx(kStatus) GdksTestTool_VProcess(GdksTestTool tool, GdkToolInput input, GdkToolOutput output)
{
GdksTestPeakToolClass* obj = GdksTestTool_Cast_(tool);
GdkToolCfg config = GdkTool_Config(tool);
GdkInputItem inputItem;
kSize i;
inputItem = GdkToolInput_Selected(input);
for (i = 0; i < GdkToolCfg_MeasurementCount(config); i++)
{
GdkMeasurementCfg measurementConfig = GdkToolCfg_MeasurementAt(config, i);
if (GdkMeasurementCfg_Enabled(measurementConfig))
{
k64f value = 1.0;
GdkMeasurementDecision decision = GT_MEASUREMENT_OK;
// Perform measurements here
kCheck(GdkToolOutput_SetResult(output, mmtIndex, value, decision));
}
}
return kOK;
}

The scan data produced by the sensor is generally a one or two dimensional array of integers or integer tuples. For uniformly-spaced (resampled) data, the array content are the Z values, while the indice encode the other dimensions. For non-resampled data, the array index is irrelevant, and the coordinates are directly contained in the arrays.

For example, for a uniformly-spaced profile:

1 x = xOffset + xIndex * xScale
2 z = zOffset + zAt(xIndex) * zScale

For a non-resampled profile:

1 x = xOffset + xAt(index) * xScale
2 z = zOffset + zAt(index) * zScale

The scales can be obtained from GdkDataInfo_Scale, while the offsets are obtained from GdkInputItem_Offset. It should noted that the offsets can change during runtime, because with features such as part detection, the starting corner of the data array can change between scans.

Anchoring

Custom tools can both anchor to as well as providing anchoring offsets to other tools, including built-in ones. To enable anchoring to other tools, use GdkToolInfo_EnableAnchoring. If selected by the end-user, the anchoring offsets can be obtained from GdkToolInput_AnchorPosition.

To make a measurement available as an anchor source for other measurements, use GdkMeasurementInfo_SetValueType to set the value type to be GT_MEASUREMENT_VALUE_TYPE_X, GT_MEASUREMENT_VALUE_TYPE_Y or GT_MEASUREMENT_VALUE_TYPE_Z. The measurement will be available as an anchor source in the specified dimension.