<< Prev        Next >>

TrackBufferIndexes

Function

Take out index numbers of data stored in the conveyor tracking buffer, and then return them as an array.

Syntax

TrackBufferIndexes Conveyor number [, Target tracking buffer ])

Guaranteed Entry

Conveyor number

Specifies the conveyor number (1 or 2) to be used by integer type data.

Target tracking buffer

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 Obtain an index number of data that have been determined as a tracking object by TrackTargetPos.
To perform this operation, Mode 1 of the fourth argument of "TrackTargetPos" must be enabled and the tracking-target work data must remain in the conveyor tracking buffer.
-1 Obtain index numbers of all data.

Return Value

Return the index number as a one-dimensional array of variant type. Each index number is integer type.
If the tracking buffer is empty, variant type data whose internal processing format is "VT_NULL(0)"(see Definition of Variant.h) will be returned.

Description

Take out index numbers of data stored in the conveyor tracking buffer, 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

Attention

  • This is exclusive command for the conveyor 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

<< Prev        Next >>