One Robot Multiple Parts
Program Example 2.1
Example Type:
1 Robot and Multiple Parts - Parallel processing vision & vibration with robot motion
Configuration
- Number of Robots: 1
- Number of Feeders: 1
- Number of Parts Types on the Feeder: 2
- Number of Placement Positions: 1
- Camera Orientation: Fixed Downward Camera
Description
There are two unique (physically different) parts. The robot will continuously pick and place two of Part #1and then pick and place one of Part #2. This is accomplished by alternating "PF_ActivePart". For this application, the pick order matter (for example, in the case of a part assembly). When the last part has been placed, the "PF_ActivePart" is changed to feed the desired part and signal the system to vibration and acquire images if necessary. This is accomplished in parallel with the robot motion (30% of the way to "place").
Sample Code
Main.prg
Function Main
Integer numToPick1, numToPick2, i
Robot 1
Motor On
Power High
Speed 50
Accel 50, 50
Jump Park
MemOff PartsToPick1
MemOff PartsToPick2
numToPick1 = 2
numToPick2 = 1
PF_Start 1, 2
Do
i = 0
Do
Wait MemSw(PartsToPick1) = On
P0 = PF_QueGet(1)
PF_QueRemove (1)
Jump P0 /R
On Gripper
Wait 0.25
i = i + 1
If i < numToPick1 And PF_QueLen(1) > 0 Then
Jump Place
Else
'Last part or no more parts available to pick
If i = numToPick1 Then
PF_ActivePart 2
EndIf
Jump Place ! D30; MemOff PartsToPick1 !
EndIf
Off Gripper
Wait 0.25
Loop Until i = numToPick1
i = 0
Do
Wait MemSw(PartsToPick2) = On
P0 = PF_QueGet(2)
PF_QueRemove (2)
Jump P0 /R
On Gripper
Wait 0.25
i = i + 1
If i < numToPick2 And PF_QueLen(2) > 0 Then
Jump Place
Else
'Last part or no more parts available to pick
If i = numToPick2 Then
PF_ActivePart 1
EndIf
Jump Place ! D30; MemOff PartsToPick2 !
EndIf
Off Gripper
Wait 0.25
Loop Until i = numToPick2
Loop
Fend
PartFeeding.prg
Function PF_Robot(PartID As Integer) As Integer
Select PartID
Case 1
MemOn PartsToPick1
Wait MemSw(PartsToPick1) = Off
Case 2
MemOn PartsToPick2
Wait MemSw(PartsToPick2) = Off
Send
PF_Robot = PF_CALLBACK_SUCCESS
Fend