Two Robots Parts

Program Example 4.1

Example Type:
2 Robots, 1 Feeder, Multiple Parts - Motion in PF_Robot callback - Picking in a specific order

Configuration

  • Number of Robots: 2
  • Number of Feeders: 1
  • Number of Parts Types on the Feeder: 2
  • Number of Placement Positions: 2
  • Camera Orientation: Fixed Downward Camera

Description
There are two robots and one feeder. Each robot picks up a unique (physically different) part. The robots will take turns picking from the feeder. The pick order matters for this application.
The alternating pick order is accomplished with "PF_ActivePart". Robot motion is performed inside the PF_Robot callback. This example does not have parallel processing of the feeder and robot motion. The code is simple but not efficient.
Robot 1 is picking and placing Part#1. Robot 2 is picking and placing Part#2. Each robot has a point labeled "park" and a point labeled "place".

Sample Code
Main.prg

Function Main
    Robot 1
    Motor On
    Power High
    Speed 50
    Accel 50, 50
    Jump Park
    Robot 2
    Motor On
    Power High
    Speed 50
    Accel 50, 50
    Jump Park
    PF_Start 1, 2
Fend

PartFeeding.prg

Function PF_Robot(PartID As Integer) As Integer
    If PF_QueLen(PartID) > 0 Then
        Select PartID
            Case 1
                Robot 1
                P0 = PF_QueGet(1)
                PF_QueRemove (1)
                Jump P0 /R
                On rbt1Gripper
                Wait 0.25
                Jump Place
                Off rbt1Gripper
                Wait 0.25
                PF_ActivePart 2
            Case 2
                Robot 2
                P0 = PF_QueGet(2)
                PF_QueRemove (2)
                Jump P0 /L
                On rbt2Gripper
                Wait 0.25
                Jump Place
                Off rbt2Gripper
                Wait 0.25
                PF_ActivePart 1
        Send

    EndIf

    PF_Robot = PF_CALLBACK_SUCCESS

Fend

Program Example 4.2

Example Type:
2 Robots, 1 Feeder, Multiple Parts - Motion in separate tasks - Picking in a specific order

Configuration

  • Number of Robots: 2
  • Number of Feeders: 1
  • Number of Parts Types on the Feeder: 2
  • Number of Placement Positions: 2
  • Camera Orientation: Fixed Downward Camera

Description
There are two robots and one feeder. Each robot picks up a unique (physically different) part. The robots will take turns picking from the feeder. This is accomplished by alternating "PF_ActivePart".
If one of the robots does not have parts to pick then the other robot is allowed to continue picking from the feeder until no more parts are available for the robot. Robot 1 is picking and placing Part#1. Robot 2 is picking and placing Part#2.
Each robot has a point labeled "park" and a point labeled "place". "PF_AccessFeeder" & "PF_ReleaseFeeder" are used to prevent both robots from attempting to access the feeder at the same time. When either robot has moved 30% of the way to its place position, the other robot is allowed to access the feeder.

Sample Code
Main.prg

Function Main
    Robot 1
    Motor On
    Power High
    Speed 50
    Accel 50, 50
    Jump Park
    Robot 2
    Motor On
    Power Low
    Speed 50
    Accel 50, 50
    Jump Park
    MemOff PartsToPick1
    MemOff PartsToPick2

    PF_Start 1, 2
    Xqt Robot1PickPlace
    Xqt Robot2PickPlace
Fend

Function Robot1PickPlace
    Robot 1
    Do
        Wait MemSw(PartsToPick1) = On
        PF_AccessFeeder 1
        P0 = PF_QueGet(1)
        PF_QueRemove (1)
        Jump P0 /R
        On 5
        Wait 0.5
        Jump Place ! D30; MemOff PartsToPick1; PF_ReleaseFeeder 1 !
        Off 5
        Wait 0.25
    Loop
Fend

Function Robot2PickPlace
    Robot 2
    Do
        Wait MemSw(PartsToPick2) = On
        PF_AccessFeeder 1
        P0 = PF_QueGet(2)
        PF_QueRemove (2)
        Jump P0 /L
        On 2
        Wait 0.5
        Jump Place ! D30; MemOff PartsToPick2; PF_ReleaseFeeder 1 !
        Off 2
        Wait 0.25
    Loop
Fend

PartFeeding.prg

Function PF_Robot(PartID As Integer) As Integer
    Select PartID
        Case 1
            If PF_QueLen(1) > 0 Then
                MemOn PartsToPick1
                Wait MemSw(PartsToPick1) = Off
                PF_ActivePart 2
            Else
                PF_ActivePart 1
            EndIf
        Case 2
            If PF_QueLen(2) > 0 Then
                MemOn PartsToPick2
                Wait MemSw(PartsToPick2) = Off
                PF_ActivePart 1
            Else
                PF_ActivePart 2
            EndIf
    Send
    PF_Robot = PF_CALLBACK_SUCCESS
Fend

Program Example 4.3

Example Type:
2 Robots, 1 Feeder, Multiple Parts - Motion in separate tasks - Picking in a specific order

Configuration

  • Number of Robots: 2
  • Number of Feeders: 1
  • Number of Parts Types on the Feeder: 3
  • Number of Placement Positions: 2
  • Camera Orientation: Fixed Downward Camera

Description
There are two robots and one feeder. Each robot will pick a different parts.
Robot 1 will pick and place one of Part 1.
Robot 2 will then pick and place one Part 4 and one Part 5. The pick order matters for this application. The alternating pick order is accomplished with "PF_ActivePart". Robot motion is performed in parallel with the feeder vibration.

Sample Code
Main.prg

Function Main
    Robot 1
    Motor On
    Power High
    Speed 50
    Accel 50, 50
    Jump Park
    Robot 2
    Motor On
    Power High
    Speed 50
    Accel 50, 50
    Jump Park
    MemOff PartsToPick1
    MemOff PartsToPick4
    MemOff PartsToPick5

    PF_Start 1, 1, 5
    Xqt Robot1PickPlace
    Xqt Robot2PickPlace
Fend

Function Robot1PickPlace
    Robot 1
    Do
        Wait MemSw(PartsToPick1) = On
        PF_AccessFeeder (1)
        P0 = PF_QueGet(1)
        PF_QueRemove (1)
        Jump P0 /R
        On rbt1Gripper; Wait .25
        Jump Place ! D30; MemOff PartsToPick1; PF_ReleaseFeeder 1 !
        Off rbt1Gripper
        Wait 0.25
    Loop
Fend

Function Robot2PickPlace
    Robot 2
    Do
        Wait MemSw(PartsToPick4) = On
        PF_AccessFeeder (1)
        P0 = PF_QueGet(4)
        PF_QueRemove (4)
        Jump P0 /L
        On rbt2Gripper; Wait .25
        Jump Place ! D30; MemOff PartsToPick4 !
        Off rbt2Gripper; Wait 0.25
        Wait MemSw(PartsToPick5) = On
        P0 = PF_QueGet(5)
        PF_QueRemove (5)
        Jump P0 /L
        On rbt2Gripper; Wait 0.25
        Jump Place ! D30; MemOff PartsToPick5; PF_ReleaseFeeder 1 !
        Off rbt2Gripper; Wait 0.25
    Loop
Fend

PartFeeding.prg

Function PF_Robot(PartID As Integer) As Integer
    Select PartID
        Case 1
            MemOn PartsToPick1
            Wait MemSw(PartsToPick1) = Off
            PF_ActivePart 4
        Case 4
            MemOn PartsToPick4
            Wait MemSw(PartsToPick4) = Off
            PF_ActivePart 5
        Case 5
            MemOn PartsToPick5
            Wait MemSw(PartsToPick5) = Off
        PF_ActivePart 1
    Send
    PF_Robot = PF_CALLBACK_SUCCESS
Fend