TrackBufferRead
Function
From the conveyor tracking buffer, read out specified data.
Syntax
TrackBufferRead (Conveyor number, Index number [, Option])
Guaranteed Entry
- Conveyor number
-
Specify the conveyor number (1 or 2) to be used by integer type data.
- Index number
-
Specify the Index number (larger than 0)obtained by the TrackBufferIndexes command by integer type data.
Index number should be 0 or larger. - Option
-
Specify by integer type data. The content of return value can be selected. This is an optional value. This should be "-1" if this is omitted.
Setting value Return value -2 All data of shown below.
(Data structure of the conveyor tracking buffer might expand. In this case, the number of data stored in "-2" will increase.)-1 All data of the following 0 to 10. 0 Encoder value at the trigger detection (integer type data) 1 Current position of the target workpirce. (Position type data)
(Values are based on the currently selected work coordinate and tool coordinate.)X[mm] (Single Precision Real Number Type data) 2 Y[mm] (Single Precision Real Number Type data) 3 Z[mm] (Single Precision Real Number Type data) 4 Rx[deg] (Single Precision Real Number Type data) 5 Ry[deg] (Single Precision Real Number Type data) 6 Rz[deg] (Single Precision Real Number Type data) 7 User data (integer type data) 8 Values are based on the vision sensor detection coordinate of the target workpiece.
(Variant type data array)X-coordinate[pixel] (Single Precision Real Number Type data) 9 Y-coordinate[pixel] (Single Precision Real Number Type data) 10 Posture angle[deg] (Single Precision Real Number Type data) 11 Attribute data (integer type data, or integer type data array)
Return Value
Values specified by "Option" are returned with variant type data.
If the data specified by "Index number" is not exist in the conveyor tracking buffer, variant type data whose VarType command result is VT_NULL(0) (definition of Variant.h) will be returned.
Description
Read the data specified by the conveyor tracking buffer by means of the index number obtained by the TrackBufferIndexes command.
Related Terms
TrackBufferDelete, TrackBufferIndexes, TrackSetSensor, TrackSetVision, TrackTargetPos, TrackTargetRelease, Commands for Conveyor Tracking
Attention
- This is the conveyor tracking operation-dedicated command.
Example
Obtain a one-dimensional array of data Index number stored in the tracking buffer.
Dim vIndex as Variant
vIndex = TrackBufferIndex(1)
From the one dimensional array, take out index numbers one by one, and then refer to and output all data of target index.
Dim idx as long
For idx = LBound(vIndex) To UBound(vIndex)
Dim vVal as Variant
vVal = TrackBufferRead( 1, vIndex(idx) ,-2)
PrintDbg "enc=" & vVal(0), _
"x=" & vVal(1), _
"y=" & vVal(2), _
"z=" & vVal(3), _
"rx=" & vVal(4), _
"ry=" & vVal(5), _
"rz=" & vVal(6), _
"usr=" & vVal(7), _
"vx=" & vVal(8), _
"vy=" & vVal(9), _
"θ=" & vVal(10), _
"attr=" & vVal(11)
Next
From the one dimensional array, take out index numbers one by one, and then refer to and output userdata of applicable index.
Dim idx as long
For idx = LBound(vIndex) To UBound(vIndex)
Dim vVal as Variant
vVal = TrackBufferRead( 1, vIndex(idx), 7 )
PrintDbg "usr=" & vVal
Next
From the one dimensional array, take out index numbers one by one, and then refer to and output attribute data of applicable index.
Dim idx as long
For idx = LBound(vIndex) To UBound(vIndex)
Dim vVal as Variant
vVal = TrackBufferRead( 1, vIndex(idx), 11 )
PrintDbg "attr=" & vVal
Next

