PF_AccessFeeder
PF_AccessFeeder locks access to a feeder to prevent potential collisions on a multi-robot / one feeder system. This statement is required when two robots are sharing the same feeder at the same time. PF_AccessFeeder gets a lock for the robot accessing a feeder.
When the lock has already been acquired, PF_AccessFeeder pauses the task until the lock is released or until the specified timeout (optional) is reached.
After a robot has finished using a feeder, it releases the lock using the PF_ReleaseFeeder statement to release the feeder to other robots.
Refer to the following for further details.
PF_ReleaseFeeder
Example:
Task 1 executes PF_AccessFeeder 1. Task 1 continues.
Task 2 executes PF_AccessFeeder 1, then Task 2 is paused.
Task 1 executes PF_ReleaseFeeder 1, then Task 2 is resumed.
This command is used for exclusive control in a multi-robot configuration.
Syntax
PF_AccessFeeder feeder number / feeder name [, timeout]
Parameters
- Feeder Number
Specify the feeder number as an expression or a numerical value (an integer from 1 to 4). - Name
Specify the feeder name as a character string. - Timeout
Specify the timeout (in seconds) to wait for the lock to be released, using an expression or a number (real number). This can be omitted.
Return values
None
Description
When timeout is specified, the result can be determined by the return value of the TW function.
For more details, refer to the following manual.
Epson RC+ 8.0 SPEL+ Language - TW Function
- False - The lock was released or the lock was successfully acquired.
- True - Timeout has been reached.
The behavior of the feeder is unaffected by the acquisition/release of locks.
At the end of the task, the locks acquired in that task are automatically released.
If the PF_AccessFeeder is executed twice in a row for the same feeder in the same task, an error occurs.
Cannot be executed from a virtual controller or command window.
Examples
Here is an example of picking a part on one feeder with two robots.
Robot 1 gets the part on the feeder and moves to point place1.
When robot 1 reaches 50% of the movement path, robot 2 moves to get the part.
Function Main
MemOff PartsToPick
Motor On
PF_Start 1
Xqt Robot1PickPlace
Xqt Robot2PickPlace
Fend
Function Robot1PickPlace
Robot 1
Do
If MemSw(PartsToPick) = On Then
If PF_QueLen(1) > 0 Then
PF_AccessFeeder 1
P0 = PF_QueGet(1)
PF_QueRemove 1
Jump P0 /R
On 5
Wait 0.5
Jump Place ! D30; PF_ReleaseFeeder 1 !
Off 5
Wait 0.25
Else
MemOff PartsToPick
EndIf
EndIf
Wait 0.1
Loop
Fend
Function Robot2PickPlace
Robot 2
Do
If MemSw(PartsToPick) = On Then
If PF_QueLen(2) > 0 Then
PF_AccessFeeder 1
P0 = PF_QueGet(2)
PF_QueRemove (2)
Jump P0 /R
On 5
Wait 0.5
Jump Place ! D30; PF_ReleaseFeeder 1 !
Off 5
Wait 0.25
Else
MemOff PartsToPick
EndIf
EndIf
Wait 0.1
Loop
Fend
Function PF_Robot(PartID As Integer) As Integer
Select PartID
Case 1
MemOn PartsToPick
Wait MemSw(PartsToPick) = Off
Case 2
MemOn PartsToPick
Wait MemSw(PartsToPick) = Off
Send
PF_Robot = PF_CALLBACK_SUCCESS
Fend