<< Prev        Next >>

ID : 2982

[Vision Tracking] Programming Examples of Free Curve Interpolation

The below describes programming examples of free curve interpolation (TrackMove S) during vision tracking.
This program is designed for workpieces whose length are less than the tracking range.

Example

Free Curve Interpolation during vision tracking can be possible by the following three programs.

  1. "Main program"

    Main program is a initialization program with regard to the tracking.

  2. "Workpiece detection program"
    Workpiece detection program is a program that detects workpiece positions and saves the obtained data into tracking buffer.
  3. "Tracking operation program"
    Tracking operation program is a program that reads out the data of workpiece positions from the tracking buffer and executes free curve interpolation motion.

1. Main Program (FreeCurveVisionTracking.pcs (PCS:354B))

Clear the tracking buffer area of the specified conveyor number and then start detecting a trigger from vision sensor signal.

TrackInitialize ConvNum, 0

Execute workpiece detection program and tracking operation program concurrently.

Run FreeCurveVision
Run FreeCurveTracking

2. Workpiece Detection Program (FreeCurveVision.pcs (PCS:4KB))

Initialize the vision sensor. The contents of initialization are written by the user for respective vision sensors used.

Call visInitialize

Execute workpiece detection processing with vision sensor. The contents of work detection processing are written by the user for respective vision sensors used.

Call visSearch

Obtain the number of detected workpieces by vision sensor. The contents of processing are written by the user for respective vision sensors used.

Call getWorkNum( workNum )

Obtain the vision sensor coordinates and the userdata values assigned to workpieces as much as the number of detected workpieces.
The contents of processing are written by the user for respective vision sensors used.

For index = 0 To workNum - 1
	Call getVisData( index, visionX, visionY, visionAngl, userData )
	...

Next index

The following program shows the contents of sub-procedure "getVisData()". Vision sensor detection coordinates and user data are returned to the caller of the procedure through a call-by-reference argument of procedure, as a set.
In the following example, a workpiece is considered as being detected when "x = 100[pixel]", "y = 100[pixel]", and "θ= 90 [deg]".

Sub getVisData( _
 ByVal index As Integer, _
 ByRef visionX As Double, _
 ByRef visionY As Double, _
 ByRef visionAngl As Double, _
 ByRef userData As Integer _
 )

 visionX = 100
 visionY = 100 
 visionAngl = 90
 userData = 1
End Sub

Arrange the data obtained by "getVisData()" as an array, and then add it to the tracking buffer.

For index = 0 To workNum - 1
...

	arrayVis( index ) = V( visionX, visionY, visionAngl )
	arrayUser( index ) = userData
Next index

TrackSetVision ConvNum, workNum, arrayVis, arrayUser

3. Tracking Operation Program (FreeCurveTracking.pcs (PCS:3KB))

With a TrackStart command, move a robot arm to the home position before starting the tracking.
Please note that executing any commands designed for non-tracking mode, such as Move command, will interrupt the tracking motion. (Commands whose name do not start from "Track" will interrupt the tracking motion.)

Move P, P[HomePos]

The main loop for the tracking and free curve interpolation that is executed whenever a workpiece is detected.
In this program, turning ON of an internal I/O is specified as the loop continuation condition so that the loop can be stopped in the middle of the program.

Do
    P[10] = TrackTargetPos(1)
 
    ...
 
    TrackApproach P, P[FirstPathPointWork], ApproachLength
 	
    TrackMove S, P[TargetPos], PathNum
	
    ...
 
LOOP UNTIL IO[AbortIONum] = ON

This is the processing within the loop.
Pick up a workpiece from the tracking buffer and then set it to the tracking target work.
If there are no workpieces detected, the program will wait until workpiece is detected and its data is stacked in the tracking buffer.

    P[TargetPos] = TrackTargetPos(ConvNum)

Convert the data of conveyor reference coordinate that was obtained above to the position of base coordinates.

    P[TargetPosBase] = ConvertPosWork( P[TargetPos], -1, 0 )

Obtain the coordinates of the first path point and convert it to the current work coordinates.

    P[FirstPathPoint] = GetPathPoint( PathNum, 1 )
    P[FirstPathPointWork] = ConvertPosWork( P[FirstPathPoint], P[TargetPosBase], -1 )

Start the tracking mode. The robot does not start its motion at the timing of this command execution.
The robot starts its motion once a tracking motion command, such as TrackApproach, is executed.

    TrackStart ConvNum

With performing the catch up motion in order that the robot moves at the conveyor speed, move the robot arm to the approach position which is approach-length above of the first path point.

    TrackApproach P, P[FirstPathPointWork], ApproachLength

With the catch up motion, move the robot arm to the first path point.

    TrackMove P, P[FirstPathPointWork]

Start free curve interpolation motion.

    TrackMove S, P[TargetPos], PathNum

With the catch up motion, move the robot arm to the depart position which is depart-length above of the tracking target work.

    TrackDepart P, DepartLength

Terminate the tracking mode. Stop the catch up motion and reduce the robot arm speed until the robot fully stops.
If the workpiece moves across the downstream limit of the tracking range before executing this command, an error will be issued.

    TrackStop

Place the picked workpiece to the ejection position.

    Approach P, P[EjectPos], ApproachLength

ID : 2982

<< Prev        Next >>