PF_Robot

Describe robot behavior for retrieving parts from the feeder and placing them in a designated location.
Make sure this function is written.

Syntax
Function PF_Robot(part ID As Integer) As Integer
' Robot movement
Fend

Parameters

  • Part ID
    The part ID (integer number from 1 to 32) goes here.
    When multi-part operation, the active part goes here.

Return values
To control the Part Feeding process after the PF_Robot function exits, set the following values. (Each constant is defined in PartFeeding.inc)

  • PF_CALLBACK_SUCCESS
    Normally this value should be specified. When there is no data in the part coordinate queue (in the case of multi-part operation, there is no data of the active part), the Part Feeding process continues.
    When there is data left in the queue (in case of multipart operation, there is some data of the active part), the PF_Robot callback function is restarted with no changing the contents of the part coordinate queue.

  • PF_CALLBACK_RESTART
    The Part Feeding process continues and regenerates the part coordinate queue, regardless of whether or not there is data remaining in the queue. This can be used when you want to get the part coordinate with each pick for picking with high accuracy.

  • PF_CALLBACK_RESTART_ACTIVEPART
    The Part Feeding process continues and regenerates the part coordinate queue for the active part only, regardless of whether or not there is data remaining in the queue. The part coordinate queue will not be regenerated for other parts. This can be useful to speed up of the vision process by omitting other than the active parts.

  • User defined error numbers (8000 - 8999)
    This is set when you want to invoke the PF_Status callback function to handle errors. The set value is passed as an argument to the PF_Status callback function.

Description
This function should contain the following operations:

  1. Get the coordinates of the part from the coordinate queue (using PF_QueGet function).
  2. Move the robot to the part coordinates on the feeder
  3. Grasping a part by operating a hand, etc.
  4. Move the robot to the part placement coordinates.
  5. Releasing a part by operating a hand, etc.
  6. Delete a coordinate queue (using the PF_QueRemove command)

Normally steps 1 -6 (listed above) are executed in a loop until all the coordinate queue data has been removed. The list of coordinates for parts detected in the most recent vision process are added to the coordinates queue. Coordinates are defined in the local coordinate system. In the case of multi-part operation, a coordinate queue is generated for each part ID.
The Robot # used in the PF_Robot callback function needs to match the robot # that was selected for the part. In the case of multi-robot, you can use Robot statements to switch the robot #.
For more details, refer to the following manual.
Epson RC+ 8.0 SPEL+ Language Reference - Robot

CAUTION


  • To acquire part ID using the parameters is recommended.
  • Be careful not to change to wrong robot number when changing the robot number in the callback function in a multi-robot system.

Program Example
The following is an example of a simple program written to use a vacuum end effector to process all parts.
A vacuum sensor is used to monitor suction when picking up parts.
Three attempts are made when suction cannot be applied. User error code 8001 is returned as a return value if suction still cannot be applied.

' ** IO Label (Output) **
' O_Adsorb Suction
' ODesorb	Release
'
' ** IO Label (Input) **
' IAdsorbed	Suction sensor
'
' ** Point **
' PlacePos	Parts place position
'
' ** User Error **
' 8001 Suction timeout occurred
'
Function PF_Robot(partID As Integer) As Integer

    Byte retry

    ' Process entire coordinates queue, or loop until a stop request is issued
    Do While PF_QueLen(partID) > 0 And PF_IsStopRequested(partID) = False

        ' Move the robot to pick up position
        Jump PF_QueGet(partID)

        ' Vacuum ON & suction check (retry three times)
        On O_Adsorb
        retry = 3
        Do While retry > 0
        Wait Sw(I_Adsorbed) = On, 0.5
        If TW = True Then
            ' If timed out, stop and reapply suction
            Off O_Adsorb
            Wait 0.1
            On O_Adsorb
        EndIf
    Loop
    If TW = True Then
        ' Terminate with error as suction still cannot be applied after reattempts
        ' Perform error processing according to Status callback function
        PF_Robot = 8001
        Exit Function
    EndIf

    ' Move the robot to place position
    Jump PlacePos

    ' Vacuum OFF & vacuum break
    Off O_Adsorb
    On O_Desorb
    Wait 0.1
    Off O_Desorb

    ' Delete one data entry in the coordinates queue
    PF_QueRemove partID

    Loop

    PF_Robot = PF_CALLBACK_SUCCESS

Fend