ID : 5491
TrackBufferIndexes
Function
Take out index numbers of data stored in the tracking buffer, and then return them as an array.
Syntax
TrackBufferIndexes (Conveyor number [, Count object [, userdata ]])
Guaranteed Entry
- Conveyor number
-
Specifies the conveyor number (1-16) to be used by integer type data.
(If your robot controller is Ver.1.11.* or lower, available conveyor number is 1 or 2.) - Count object
-
Specify data that you intend to obtain by integer type. This is omittable. This will be "-1" if it is omitted.
Setting value Description -1 All data 1 Read the data specified as a tracking-target work in TrackTargetPos command.
To perform this operation, Tracking Buffer Data of the fourth argument of "TrackTargetPos" must be enabled and the tracking-target work data must remain in the tracking buffer.2 All data except for the data specified by the above "setting value 1".
This entry is available for Ver.2.0.* or higher.3 Data whose workpiece's current position is upper than the upstream limit of the tracking range.
This entry is available for Ver.2.0.* or higher.4 Data whose workpiece's current position is lower than the upstream limit of the tracking range.
This entry is available for Ver.2.0.* or higher.5 Data whose workpiece's current position is upper than the downstream limit of the tracking range.
This entry is available for Ver.2.0.* or higher.6 Data whose workpiece's current position is lower than the downstream limit of the tracking range.
This entry is available for Ver.2.0.* or higher.7 Data whose workpiece's current position is within the tracking range.
This entry is available for Ver.2.0.* or higher.
This is omittable. This will be "-1" if it is omitted. This entry is available for Ver.2.0.* or higher.
Return Value
Return the index numbers of the specified target data or user data as one dimensional array of variant type data.
If the tracking buffer is empty, variant type data whose internal processing format is "VT_EMPTY(0)" will be returned.
Count object | User data | Return value |
---|---|---|
Pos. | Neg. / No | Return the index number of the specified count object regardless of the user data. |
Pos. | Pos. | Return the index number of count object specified that belongs to the specified user data. |
None / -1 | Neg. / No | Return the index number of data within the tracking buffer. |
None / -1 | Pos. | Return the index number of data in the tracking buffer that belongs to the specified user data. |
Pos. : Positive value entry
None / -1 : No value entry or "-1" is entered.
Neg. / No : Negative value entry or no entry.
Description
From the data stored in the tracking buffer, extract the index numbers that correspond to the specified target data or user data, and then return them as an array. To refer the data with TrackBufferRead command, use the number obtained and specify the tracking buffer data.
Related Terms
TrackBufferDelete, TrackBufferRead, TrackTargetPos, TrackTargetRelease, Commands for Conveyor Tracking, Commands for Circular Tracking
Attention
This command is dedicated for conveyor and circular tracking.
Example
Sub Main
' Take out index numbers of all data
Dim vIndex as Variant
vIndex = TrackBufferIndexes(1, -1)
Dim idx as long
For idx = LBound(vIndex) To UBound(vIndex)
'Obtain data specified by tracking buffer by means of the index number
Dim vVal as Variant
vVal = TrackBufferRead(1, vIndex(idx), -1)
' Data output
PrintDbg "enc=" & vVal(0), _
"x=" & vVal(1), _
"y=" & vVal(2), _
"z=" & vVal(3), _
"rx=" & vVal(4), _
"ry=" & vVal(5), _
"rz=" & vVal(6)
Next
End sub
The example below shows the case that the process differs depending on whether the element is empty or not.
#include "variant.h"
Sub Main
' Take out index numbers of all data
Dim vIndex as Variant
vIndex = TrackBufferIndexes(1, -1)
If VarType(vIndex) = VT_EMPTY then
' The process where the element is empty
'・・・
ElseIf VarType(vIndex) And VT_ARRAY then
' Process in case the elements are not empty (elements constitutes an array).
If ( UBound( vIndex ) <> -1 ) then
' Check that the number of element is not 0, and then read out the data.
' Obtain data specified by tracking buffer by means of the index number
Dim vVal as Variant
vVal = TrackBufferRead(1, UBound( vIndex ), -1)
'・・・
End If
'・・・
End If
End Sub
ID : 5491