Program Example 8.1

Example Type:
Using Image Buffers and ImageOp SubtractAbs

Configuration

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

Description
Even with the backlight turned on, the corners of the tray can have shadows. If the Part Blob search window includes the corners and if the Blob’s thresholds are not properly adjusted, then the shadows can be mistakenly identified as parts.
The Part Blob Sequence is used to detect individual parts or an accumulation of parts. If the Part Blob sees the shadows as parts, then the system will make a bad decision on how to vibrate or the PF_Control callback may not turn on the hopper since the system thinks that there are sufficient parts in the tray.

The following is an example of how the corner shadowing can be misidentified as parts.

An ImageOp vision object can be added to the Part Blob sequence to help fix this issue. The ImageOp will use the SubtractAbs operation. SubtractAbs outputs the difference between two image buffers. For this example, the ImageBuffer1 property will be an image file of the empty feeder and the ImageBuffer2 property will be the image acquired by the camera (value "0" is the camera’s image buffer). When the image buffers are subtracted, the feeder will effectively be removed from the image.

Here are the steps.

  1. Create a new vision sequence and call it "Part Blob".

  2. Turn on the feeder’s backlight and remove any parts in the feeder tray.

  3. Click on the "Click to Save" button on the Part Blob’s SaveImage property. For this example, we will name the file "Empty IF-240". The image of the file is shown below.

  4. Drag and drop an ImageOp vision object from the Vision Guide toolbar.

  5. Resize the ImageOp to be the entire camera field of view.

  6. Change the ImageOp’s Operation property to "SubtractAbs".

  7. Change the ImageOp’s ImageBuffer1 property to "File".

  8. Click the ImageBufferFile button and navigate to the file which was previously saved as "Empty IF-240".

  9. Add a Blob from the Vision Guide toolbar. Resize the Blob’s Search Window to be larger than the feeder tray.

  10. Change the Blob’s ThresholdColor property to "White".

  11. Place a part on the tray and click the Histogram button on the Vision Guide toolbar.

    Drag the red ThresholdHigh bar on the histogram until the part is properly binarized. Click the Update as necessary and click the OK button on the histogram window when finished.
    Now when the Part Blob sequence is run, the image of the feeder will be completely removed. The part will appear black on a completely white background. The feeder has effectively been masked out of the Part Blob sequence.

  12. Select "PartBlob" as the Part Blob Vision Sequence for the desired part in the Epson RC+ 8.0 Menu - [Tools] - [Part Feeding] Vision page.

No special part feeding code is required.

Sample Code
Main.prg

Function main
    If Motor = Off Then
        Motor On
    EndIf
    Power Low
    Jump Park
    PF_Start 1
Fend

PartFeeding.prg

Function PF_Robot(PartID As Integer) As Integer
    Do While PF_QueLen(PartID) > 0
        P0 = PF_QueGet(PartID)
        Jump P0
        On Gripper; Wait 0.2
        Jump Place
        Off Gripper; Wait 0.2
        PF_QueRemove PartID
        If PF_IsStopRequested(PartID) = True Then
            Exit Do
        EndIf
    Loop
    PF_Robot = PF_CALLBACK_SUCCESS

Fend