ID : 2223
Sample Program for a Workpiece whose Length is Over the Tracking Range
The below describes programming example of the sensor tracking.
This program is designed for workpieces whose length is over the tracking range.
If the workpiece is a long object, divide the total workpiece length by the tracking range length, and then perform the sensor tracking for respective divided areas. If the calculation result of the division is N, perform the sensor tracking N times.
This sample program is available to Ver.1.10.* or higher.
Example
Sensor tracking for a long workpiece is achieved by the following three programs.
-
"Main program"
Main program is a initialization program with regard to the conveyor tracking.
-
"Workpiece detection program"
Workpiece detection program is a program that detects workpiece positions and saves the obtained data into conveyor tracking buffer.
-
"Tracking operation program"
The tracking operation program obtains the positional data of the workpiece from the tracking buffer area, and then executes tracking and picking up operation by use of obtained positional data.
1. Main program (SensorTracking.pcs (PCS:280B))
Clear the tracking buffer area of conveyor 1, and then start detecting a trigger from sensor signal.
TrackInitialize 1, 0
Execute workpiece detection program and tracking operation program concurrently.
Run Sensor
Run Tracking
2. Workpiece detection program (Sensor.pcs (PCS:2KB))
Detect a rising edge.
Wait IO[48] = OFF
Wait IO[48]
Add the latest sensor detection coordinates (encoder value) to the tracking buffer as much as the number of N.
As the following figure shows, if the total workpiece length is 1500 mm and the tracking range length is 300 mm, the workpiece is divided into 5 areas. (N = 5).
TrackSetSensor 1, I[10], arrayUser
3. Tracking operation program (Tracking.pcs (PCS:3KB))
With a TrackStart command, move a robot arm to the home position before starting the conveyor 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[50]
The main loop for the tracking and pick-up motion 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.
When the workpiece is a long object, the loop is performed N times in one sensor detection since the workpiece is divided into N areas.
To find which division is processed in the current loop processing, the loop count needs to be retained by a local variable.
Dim divCount As Integer
divCount = 0
Do
divCount = divCount + 1
If (divCount > I[10]) Then
divCount = 1
End If
P[10] = TrackTargetPos(1, -1, -1, 4)
...
TrackApproach P, P[10], 50
...
LOOP UNTIL IO[128] = ON
This is the processing within the loop.
Pick up a workpiece from the conveyor 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 conveyor tracking buffer.
P[10] = TrackTargetPos(1, -1, -1, 4)
See the figure below. A workpiece is a long object whose length is divided into 5 divisions. In this case, it is impossible to perform sensor tracking for the division 2 to 5 because the top of the workpiece (the most downstream point of the workpiece) has already passed the downstream limit of the tracking range, which means that the workpiece is excluded from the the tracking-target work.
In order to perform sensor tracking for division 2 or later, on Data Processing Type (the fourth argument) of TrackTargetPos command, set Downstream limit picking to "Enabled".
To perform the sensor tracking for two or more points on one workpiece, you need to specify respective tracking positions in addition to the TrackTargetPos command setting mentioned above. To set respective positions, specify offset values from the top of the workpiece (on the most downstream point of the workpiece). Enter offset values in the opposite of the conveyor vector direction according to the number of divisions.
To obtain conveyor vector, use TrackConveyorVector command. Offset values are calculated by the length of the tracking range and the current loop count. To obtain the length of the tracking range, use TrackCurStartArea command.
Dim curDivNo As Integer
curDivNo = (divCount - 1)
Dim trckArea As Variant
Dim trckRange As Integer
trckArea = TrackCurStartArea(1)
trckRange = (trckArea(1) - trckArea(0))
P[10] = P[10] - (convVec * (curDivNo * trackRange))
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.
In the default setting, an error occurs when the tracking-target work passes the downstream limit of the tracking range.
TrackStart 1, 2
As explained in the figure above, in order to perform the sensor tracking for the division 2 or later of the working area, on Option setting (the second argument) of TrackStart command, set Error setting to "Enabled" so that an error is not issued when a workpiece passes the downstream of the tracking range.
Doing so will allow the robot arm to wait until the top of respective divisions entering the tracking target range.
Wait TrackInRange(1, (-trckRange * curDivNo)), 10000, timeoutFlg
In the default setting, "TrackInRange" command makes a judgment for the top of the tracking target work. To make a judgment for respective divisions, you need to specify offset values (the second argument) for each division. "Offset value" in this context indicates the distance between the most downstream point of the target workpiece and the most downstream point of respective divisions. Offset value is calculated by the length of the tracking range and the current loop count. To obtain the length of the tracking range, use TrackCurStartArea command.
With performing the catch up motion in order that the robot moves with the conveyor speed, move the robot arm to the approach position which is 50 mm above of the tracking target work.
TrackApproach P, P[10], 50
With the catch up motion, move the robot arm to the tracking target work.
TrackMove L, P[10]
With performing the catch up motion, draw a rectangle over the target work.
TrackMove L, P[10] + P(0, 50, 0)
TrackMove L, P[10] + P(-100, 50, 0)
TrackMove L, P[10] + P(-100, -50, 0)
TrackMove L, P[10] + P(0, -50, 0)
TrackMove L, P[10]
With the catch up motion, move the robot arm to the depart position which is 50 mm above of the tracking target work.
TrackDepart P, 50
Terminate the tracking mode. Stop the catch up motion and reduce the robot arm speed until the robot fully stops.
TrackStop
Place the picked workpiece to the ejection position.
Approach P, P[52], 50
ID : 2223