<< Prev        Next >>

ID : 2836

TrackPrepareData

Function

TrackPrepareData deletes the duplicated data in the tracking buffer among several workpice data detected by a vision sensor, rearranges the workpiece data in order from the most downstream one, and then return the data set.
This command deletes duplicated data and rearranges workpiece data before setting the workpiece data in the tracking buffer by TrackSetVision. The return value of this command will be used as arguments of TrackSetVision without any modification.

This command is available in Ver.2.1.* or higher.

Syntax

TrackPrepareData (Conveyor number, Number of workpieces to detect, Sensor detection coordinate [, UserData [, Attribute data]])

Guaranteed Entry

Conveyor number

Specify the conveyor number (1-16) to be used by integer type data.

Number of workpieces to detect

This is the same value as the one specified in the "Number of workpieces to detect" in TrackSetVision command. Enter the number of workpieces that is stored in the tracking buffer at one detection by integer type data.
If negative value is set, the internal trigger mode, which does not require trigger input from I/O, will be set.
If any duplicated workpiece data is found in the tracking buffer, when this entry is a positive value, the number of duplicated data is deleted from the return value, and when this entry is a negative value, the number of duplicated data is added to the return value.

Value Description
Positive values Specify the number of workpieces detected by the vision sensor by positive value.
The conveyor encoder value must be stored beforehand by receiving I/O input from the vision sensor.
0 Error
Negative values Specify the number of workpieces you want to set based on the internal trigger by negative value.
This does not require I/O input from the vision sensor, and the conveyor encoder value when this command is executed is stored.
Sensor detection coordinate

This is the same value as the one specified in the "Sensor detection coordinate" in TrackSetVision command. Specify the vision sensor detection coordinates as many as the number of workpiece to detect. There are three ways to specify the sensor detection coordinate as follows.
If any duplication is found in the tracking buffer, the duplicated coordinate is deleted before sending the return value, so the return value does not include any duplication. Also, if two or more workpiece data are sent, these data are stored in the return value from the most downstream one.

Data Type Description
Vector Type Available only when the Number of workpieces to detect is one.
One dimensional array of variant type data Available when the Number of workpieces to detect is one or more.
To enter the value of each element, use vector type data.
One dimensional array of vector type data Available when the Number of workpieces to detect is one or more.
To enter the value of each element, use vector type data.

 

UserData

This is the same value as the one specified in the "UserData" in TrackSetVision command. For about the way of specification, refer to TrackSetVison.
This is an optional value. This should be "-1" if this is omitted. If minus value is set, it is treated same as when it is omitted.
In the return value, this item is rearranged with the workpiece data.

Attribute data

This is the same value as the one specified in the "Attribute data " in TrackSetVision command. For about the way of specification, refer toTrackSetVison.
This is an optional value. This should be "-1" if this is omitted.
In the return value, this item is rearranged with the workpiece data.

Return Value

Guaranteed Entry Description
Number of workpieces to detect The value to set to the "Number of workpieces to detect" of TrackSetVision. The duplicaiton found in the tracking buffer has been deleted from this value.
Sensor detection coordinate The value to set to the "Sensor detection coordinate" of TrackSetVision. The duplicaiton found in the tracking buffer has been deleted from this value and the data are rearranged from the most downstream's one.
UserData The value to set to the "UserData" of TrackSetVision. The order of UserData is rearranged along with the data rearrangement.
Attribute data The value to set to the "Attribute data" of TrackSetVision. The order of Attribute data is rearranged along with the data rearrangement.

According to the guaranteed entry, the number of workpieces to detect, sensor detection coordinate, user data, and attribute data are returned by Variant type data.

Guaranteed Entry Return Value
Number of workpieces to detect Sensor detection coordinate UserData Attribute data
Conveyor number, Number of workpieces to detect, Sensor detection coordinate -1 -1
Conveyor number, Number of workpieces to detect, Sensor detection coordinate, UserData -1
Conveyor number, Number of workpieces to detect, Sensor detection coordinate, UserData, Attribute data

If any of specified sensor detection coordinates are not saved in the tracking buffer, variant type data that the number of data is "0" and whose sensor detection coordinate, user data, and attribute data being "VT_EMPTY" is returned.

Description

TrackPrepareData deletes the duplicated data in the tracking buffer among several workpice data detected by a vision sensor, rearranges the workpiece data in order from the most downstream one, and then return the data set.
This command deletes duplicated data and rearranges workpiece data before setting the workpiece data in the tracking buffer by TrackSetVision. The return value of this command will be used as arguments of TrackSetVision without any modification.

Attention

This command is dedicated for conveyor and circular tracking.

Example

Vision sensor detects Work 1 whose image coordinates are x=100[pixel], y=10[pixel] and the workpiece's attitude angle is θ=30[deg].

Dim visPos1 As Variant
visPos1 = Array(100, 10, 30)

Vision sensor detects Work 2 whose image coordinates are x=100[pixel], y=200[pixel] and the workpiece's attitude angle is θ=0[deg].

Dim visPos2 As Variant
visPos2 = Array(100, 200, 0)

Vision sensor detects Work 3 whose image coordinates are x=10[pixel], y=200[pixel] and the workpiece's attitude angle is θ=45[deg].

Dim visPos3 As Variant
visPos3 = Array(10, 200, 45)

With three workpieces detected by the vision sensor, check the duplication in the tracking buffer.

Dim visPreparePos As Variant
visPreparePos = TrackPrepareData (1,3, Array(visPos1, visPos2, visPos3), Array(1, 2, 3), Array(1, 1, 1))

Save the not-duplicated workpieces into the tracking buffer with user data and attribute data specification.

TrackSetVision 1, visPreparePos (0), visPreparePos (1), visPreparePos (2), visPreparePos (3)

Sample Application

To track work pieces with two robots in turn, assign each work piece to a user data 1 and user data 2 alternately, and then save them to the tracking buffer.

' Obtain the sensor detection coordinates
Dim visPos1 As Variant
visPos1 = Array(100, 10, 30)
Dim visPos2 As Variant
visPos2 = Array(100, 200, 0)
Dim visPos3 As Variant
visPos3 = Array(10, 200, 45)

' Obtain the sensor detection coordinates that have no duplicaiton in the tracking buffer.
Dim visPreparePos As Variant
visPreparePos = TrackPrepareData (1,3, Array(visPos1, visPos2, visPos3))

' Create UserData by the number of data in the tracking buffer that has no duplicated data.
' Define CreateUserData to perform any process executed by a user.
Dim vntUserData As Variant
vntUserData = CreateUserData(visPreparePos (0))

' Save data in the tracking buffer
TrackSetVision 1, visPreparePos (0), visPreparePos (1), vntUserData

' [User data]
' Operation to Prepare User data
' [out] vntUserData : User data 
Function CreateUserData( ByVal workNum As Integer ) As Variant

        ' --------Prepare User data for the workpieces detected by vision sensor--------
        
        CreateUserData= CreateArray(workNum, VT_I4)

End Function

ID : 2836

<< Prev        Next >>