|
Gocator Development Kit
|
While the sensor is running, the VProcess method is called whenever there is a scan of data 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. VProcess method can also receive multiple stream inputs and use them to generate zero or more feature, data and/or generic outputs.
Sometimes the data processing VProcess method needs to construct large objects as a byproduct of processing the input data. Memory for the constructed objects created by VProcess should use the memory allocator returned by the API GdkTool_MessageAlloc(). Use of any other allocator can potentially cause performance degradations if a lot of memory needs to be allocated while processing the input data.
If the sensor is configured for either profile or surface generation, the scan data generated 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:
For a non-resampled profile:
The scales can be obtained from GdkDataInfo_Scale, while the offsets are obtained from GdkInputItem_Offset. It should be 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.
For measurement outputs, use GdkToolOutput_InitMeasurementAt to retrieve the GvMeasureMsg object. Then the class methods _SetValue and _SetStatus can be used to update its value and status when it is sent as an output. To retrieve the index of a measurement, GdkTool_MeasurementIndexByType method should be used.
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.