Quick Start: A Vision Guide 8.0 Tutorial

Tutorial Overview

The purpose of this chapter is to walk you through a simple vision application to help introduce you to some of the Vision Guide 8.0 basic usage concepts and to show you how easy it is to use. In many cases we will simply explain the steps to follow but will not explain the details behind what was done. This is because we want you to get used to the examples described in this tutorial as soon as possible. Then in the later chapters, you can read about the details.
We will not be using actual parts for this tutorial but instead we will use simple drawings of objects that you can then make copies of and put under a camera to follow the tutorial. This will guarantee that everyone has the same results when trying this tutorial.
This tutorial will show you how to create a simple application to use vision to find a part and then move the robot to it. It is assumed for the purposes of this tutorial that your robot is a SCARA type with a camera mounted at the end of the 2nd arm link.

This chapter will include the following sections:

  • Items required for this tutorial.
  • Camera lens configuration.
  • Creating a new Epson RC+ 8.0 Project.
  • Creating a new vision sequence.
  • Using a Blob object to find a part.
  • Writing a SPEL+ program to interact with the vision sequence.
  • Calibrating the robot with the camera.
  • Using vision to instruct the robot to move to the part.
  • Finding and moving to multiple like parts.

In Items Required for this Tutorial later in this chapter, you will find two pages with printed targets for our vision tutorial. These pages will be used throughout the tutorial.
Following the target pages is a section entitled Start Epson RC+ 8.0 and Create a New Project. This is where we will start the actual tutorial.

Items Required for this Tutorial

This tutorial will guide you through using an EPSON robot with Vision Guide 8.0. It is assumed that you are comfortable using EPSON RC+ 8.0 and Epson Robots. If you are a little uncertain as to how to use Epson RC+ 8.0 you probably will want to spend a little time reviewing it prior to starting this tutorial. The following items will be required to work through this tutorial:

  • Epson RC+ 8.0 must be installed on your PC.
  • A camera for Vision Guide 8.0 must be installed and working properly.
  • An EPSON robot should be mounted to a base with a work surface attached in front of the robot so the robot can access the work surface.
  • If the robot is a SCARA robot, the camera should be attached to the robot at the end of the 2nd arm link. If the robot is a 6 axis robot, the camera should be attached to the robot’s J6 flange. The camera mounting bracket for the particular robot you are using is available from EPSON. The camera should be mounted so that it is facing downward.

KEY POINTS


Make sure that the PC’s main power, Controller power, and camera power are turned OFF when attaching the Ethernet cables between the PC, camera and Controller. Failure to turn power OFF could result in damage.

  • Copies of the pages that contain drawings of the target parts should be made available to put under the camera. (The target part drawings can be found in the next section following this list.)
  • A camera lens must be selected that will allow a field of view of about 40 mm × 30 mm. In our tests here we have been using a Vision Guide 8.0 mobile camera (CV1 with NET 1044BU camera) with 16 mm lens at a distance of about 210 mm from the work surface. However, to get proper focus will require some adjustment. We’ll help guide you through this.
  • We won’t be picking up any parts in this tutorial. However, we will be moving the robot to the part positions drawn on our target sheets. You will need to attach a gripper or rod to the Z axis shaft. This tutorial assumes that a rod is attached to the Z axis shaft. A rod that comes straight down the center of the Z axis shaft will work fine. This gripper or rod will be used for calibration and also moving to the target parts on the target pages.


A single target feature for tutorial (a drawing of a washer)


Multiple target features for tutorial (multiple washers)

Starting Epson RC+ 8.0 and Create a New Project

  1. Turn ON your Controller.
  2. Double click the [Epson RC+ 8.0] icon on the Windows desktop to start Epson RC+ 8.0.
  3. Click the Project menu from the Epson RC+ 8.0 menu bar.
  4. Click the New Project menu entry of the Project menu. The [New Project] dialog box will appear.
  5. Type a name for the new project. We suggest that you use your name with the letters “tut” attached to the end. That way each individual who tries this tutorial will have a unique name for his or her project. For our project here we will use the name “vgtut”. After you type a name in the name field, click the [OK] button. You have just created a new project called xxxxtut.

Creating a New Vision Sequence

  1. Once you have created a new Epson RC+ 8.0 project, you will notice that many of the toolbar icons are enabled (no longer grayed out). Look for the [Vision] button on the Vision Guide toolbar. Click this button to open the Vision Guide window.
  2. Before we can do anything in the Vision Guide 8.0 window we must first create a vision sequence. This is accomplished by clicking on the [New Sequence] button on the Vision Guide toolbar. Remember that this toolbar button is located on the Vision Guide window toolbar and not on the Epson RC+ 8.0 main toolbar. The [New Sequence] dialog box will now appear.
  3. Enter the name “blobtut” for the new vision sequence and then click the [OK] button. We will be using the name “blobtut” later in our Epson RC+ 8.0 code so be sure to type this name in exactly as spelled above without the quote marks. We have now created a new vision sequence called “blobtut” and everything we do from now on will be for this vision sequence.

Camera Lens Configuration for Tutorial

We mentioned earlier that our target field of view for this tutorial should be about 40 mm × 30 mm. The working distance (WD) from the work surface is about 210 mm. We have found that a 16mm lens and 1 mm extension tube work fine for this field of view at distances ranging from 167 mm up to 240 mm. This means that a 16 mm lens and 1 mm extension tube will probably also work for your tutorial.
If you have not attached a lens to your camera and tried to focus your lens, it would probably be a good idea to do this at this time. In the chapter Installation there is an explanation on how to determine which lens to use and focusing. You will probably want to review this information before proceeding if you are not familiar with how to select a camera lens and focus the camera to your part.
In order to check your focus, obviously you will need to view an image from Vision Guide 8.0. Since we already have the Vision Guide window open, we now only need to make sure we can properly see the target feature on the target sheet. The steps to accomplish this are described in the next section.

Position the mobile camera over the target sheet and focus the lens

  1. Get the copies of the target sheets that you made earlier. Select the target sheet with the single washer feature printed in the center and put it in a location on the work surface where the robot can then position the camera over it easily. The best position is normally directly in front of the robot.
  2. Now move the robot so that the camera is located over the picture of a washer. You should be able to move the robot manually without having to turn servo power ON.
  3. You should be able to see the target feature (the washer) in the image display of the Vision Guide window. Bring the target feature into focus by adjusting the camera lens focus. If you cannot see the target feature or cannot bring it into proper focus go to the section titled Checking and Adjusting for Proper Focal Distance in the chapter Installation. This section will explain the details on selecting and focusing a camera lens.

The camera should now be in position directly over the target feature drawn on the target sheet. You should be able to see the target clearly on the image display of the Vision Guide window. The Vision Guide window should now appear as shown in the figure below. Notice the target feature (the washer) is shown in the center of the image display of the Vision Guide window.


The Vision Guide window with target feature in center of image display

Using a Blob Object to Find a Part

Now that the target feature (washer) is located in the center of the image display of the Vision Guide window, we can create a Blob object to find the washer. The steps to create a Blob object, configure it, and then find the washer are shown next.

Step 1: Create a New Blob Object

  1. Click the [All Tools] - the [Blob] button on the Vision Guide toolbar with the left mouse button and then release the button. (Do not continue holding the left mouse button once you have clicked on the New Blob toolbar button.)
  2. Now move the mouse downward towards the image of the washer in the center of the image display. As you move off the Vision Guide toolbar the mouse pointer will change to the Blob object icon.
  3. Continue moving the mouse to the center of the image display and click the left mouse button. This will position the new Blob object onto the image display.

Your screen should look similar to the one shown in the figure below.

Vision Guide window with new Blob object "Blob01"

Step 2: Position and Size the Blob Object
We now need to set the position and size of the search window for the Blob object.
The search window for the “Blob01” Blob object is the box you see to the left of the washer in the figure below. Let’s make this search window large so that we can search nearly the entire field of view for the washer.

  1. Move the mouse pointer over the name label of the Blob object and hold the left mouse button down. While continuing to hold the left mouse button drag the Blob object to the upper left corner of the image display so that the upper left corner of the search window is almost touching the upper left corner of the image display.
  2. Move the mouse pointer over the lower right sizing handle of the Blob01 search window and hold the left mouse down. While continuing to hold the left mouse down, drag the lower right sizing handle to the bottom right corner of the image display. The Blob object’s search window should now cover the entire image display. This will allow us to find any blob that is located within the camera’s field of view.

The Screen shot below shows the search window for the “Blob01” Blob object repositioned and sized so that it covers the entire image display.

“Blob01” Blob object with large search window

Step 3: Set Properties and Run the Blob Object
The search window is now large enough for the washer to be seen inside of the search window. We are now ready to test our Blob object to make sure it can find the washer.

  1. Click the Blob01 object located in the tree in the upper right side of the [Vision Guide] window. This will display the properties and results for the Blob01 object.

  2. Look at the Properties list and find the Name property. Double click the Value field for the Name property to cause the current name to be highlighted. Now enter the name (the boxed part in the figure below) “washer”. We have just changed the name of our Blob object to “washer”. If you look at the top of the [Jog] tab in the Name drop down list, and the name label on the search window, you will see that the name has been changed in both places.

    Properties for Blob01 object

  3. While you are looking at the Properties list you might also want to examine the Polarity property. Since we just created a new blob, the default value for Polarity is DarkOnLight, which means find a dark blob on a light background. We could also change this property to LightOnDark. But since we want to find a dark blob (the washer) on a light background, leave the Polarity property as is.

  4. We are now ready to run the Blob object “washer”.
    To run the object click the Run button located at the bottom right of the run panel. This will cause the Blob object “washer” to execute and in this case the Blob object will find a blob that looks like a washer.
    You can tell that the Blob was found by examining the color of the search window after running the Blob object. The search window will be green if the Blob object finds a blob and red if it does not.
    (You can also examine the Results list to see if the Blob was found or not. More on that next.)

  5. Now try moving the paper with your target washer just a little and click the [Run] button again.
    Be sure to keep the washer inside the search window that you created. You can see the new position of the blob is found and highlighted in green on the image display window.
    (If you move the paper so that the washer is outside of the search window boundary, then the Blob object will not find the washer and you can see this because the search window will turn red when the object is not found.)

Step 4: Examining the Results
Now that you have run the Blob object called “washer” you can examine the results that are returned for this object. The results are displayed in the Results list located just below the property list.

  1. Look at the Results list for the result called Found. The value of the Found result should be True at this point because we just found the blob. If no blobs were found then the Found result would display False.
  2. You can also see the Area result at the top of the Results list. This shows the area of the blob that was found.
  3. Use the scroll bar to move the results list down to the bottom. At the bottom of the Blob results list you will see the Time result. This result tells us how much time it took to find this blob.

    Results list scrolled down to show Time result

CAUTION


Ambient lighting and external equipment noise may affect vision sequence image and results. A corrupt image may be acquired and the detected position could be any position in an object’s search area. Be sure to create image processing sequences with objects that use search areas that are no larger than necessary.

Step 5: Saving Your Vision Sequence
We should probably save our work at this time. As with any application, it’s a good idea to periodically save your work often. The Project Management feature of Epson RC+ 8.0 causes everything related to this project to be saved at once. This is done in one easy step as shown below:
Click the [Save] button. It is located on the left side of the Epson RC+ 8.0 main toolbar.
We have now successfully created a new Blob object; properly positioned and sized the search window; and we ran the Blob object to find a blob.
Let’s take the next step and write a simple program to run our vision sequence from the SPEL+ language and retrieve some of the results for use in our application.

Writing a SPEL+ Program to Work with the Vision Sequence

One of the most powerful features of Vision Guide 8.0 is that any vision sequences that are created from the point and click environment can be used from the SPEL+ language. This means that vision sequences are a core part of EPSON RC+ vision applications and are not just a prototyping tool for which you later have to rewrite everything in SPEL+. Vision sequences and the SPEL+ language are integrated together to give you the best of both worlds: the ease of use of a point and click vision development environment and the power and flexibility that a language provides.
Let’s write a quick program to find whether the blob was found, check the area of the blob, and then print a message with this information.

Open the Program File Called MAIN.PRG
You should already know how to open the main.prg program file since you are familiar with the Epson RC+ 8.0 environment. However, for those of you who may not know how to open a file we have included the basic steps below:

  1. Click the [Open File] button on the Epson RC+ 8.0 toolbar. You will see the following [Open File] dialog box:

    The Epson RC+ [Open File] Dialog Box

  2. As you can see in the [Open File] dialog box, the main.prg program file should already be highlighted since you haven’t yet created any other programs. Go ahead and click the [Open] button at the bottom left of the dialog box to open the main.prg program file.

Create a SPEL+ Program to Work with our Vision Sequence
Shown below is an example program that will run the vision sequence “blobtut” and then check some of the properties associated with the Blob object called “washer”.
For example, we will check if the blob is found or not. If it is we will display a “The washer was found!” message and the area of the blob. If no blob is found we will display a “The washer was not found!” message.
You should now see an editor window with MAIN.PRG displayed on the Title bar. The cursor will be located at the beginning of the 1st line in the edit window. (The perfect position to begin typing in our program.) Go ahead and enter the following program into the editor window. Don’t worry about the capital vs. small letters. The editor automatically capitalizes all keywords.

Function main  
  Real area  
  Boolean found  
  
  VRun blobtut  
  VGet blobtut.washer.Found, found  
  
  If found = TRUE Then  
    VGet blobtut.washer.Area, area  
    Print "The washer was found!"  
    Print "The washer area is: ", area, "Pixels"  
  Else  
    Print "The washer was not found!"  
  EndIf  
Fend  

Running the main Function
You should be familiar with the Run window for Epson RC+ 8.0. We will use the Run window to run our sample program that was created in the previous section. The steps to accomplish this are shown below:

  1. Click the [Open Run Window] button on the Epson RC+ 8.0 toolbar. This will cause the Run window to appear. Notice that in the figure below, the Run window is split into 2 parts. The left half of the Run window is the image display (note the washer shown in the center) and the right half of the Run window is the text area which is used for displaying text messages.

    KEY POINTS


    If the Run window only shows the Text Area (b) and doesn’t appear with both an image display (a) and a text area, click the Display Video check box on the Run window.

    Run window with Image Display and Text Area

  2. Click the [Start] button located at the bottom left corner of the Run window. This will cause the function called “main” to run.

  3. You can see sample results in the figure in Step (4) from running the function “main”. Notice that when the blob is found, it is highlighted in green in the image display on the left side of the Run window. The right side of the Run window displays text that states that the blob was found and the area of the blob.

  4. Double click the Control-menu box of the Run window that is located in the upper left corner of the Run window. This will close the Run window.

    A sample Run window display after running “main”

Calibrating the Robot Camera

This part of the tutorial will guide you through how to calibrate the robot with the mobile camera that is mounted to the end of joint 2 on a SCARA.
Calibration provides the mechanism to allow the vision system to understand the robot’s coordinate system. Once calibrated, the vision system can be used to find the robot coordinate position of parts for the robot to pick up.
However, before we start calibration we need to prepare the robot for use by turning the motors ON and calibrating (homing) the robot.

Step 1: Turn ON Motors

  1. Click the [Robot Manager] button on the Epson RC+ 8.0 main toolbar. You will see the following screen appear.
  2. Click the [MOTOR Off] button at the top of the screen.
  3. A message box will appear asking if you are “Ready to turn robot motors ON”. Click the [Yes] button. This will turn the robot’s motors ON.

Step 2: Use the Tool Setting to create a new tool
In order to use the robot with a vision system for a guidance application requires that precise measurement of the position of the tool or gripper mounted at the end of the arm. Some tools are offset from the center of the Z-axis flange and other tools are mounted in line with the center of the Z-axis. Regardless of how careful we are when mounting robot tooling, you can almost always guarantee that there will be some offset from the center of the Z axis. For this reason we must use the Tools feature of SPEL+ to compensate for this adjustment.
A good understanding of tools is required to use Vision Guide for robot guidance. We will use the Tool Wizard feature to create a tool for our calibration rod (gripper).

  1. Click the [Tools] tab.
  2. Click the [Tool Wizard] button.
  3. For the first point in the Tool Wizard, jog the robot to the target position (position of washer on your paper target) so that the rod or gripper is located exactly in the center of the washer. You will need to jog the robot downward so that you are close to touching the paper but don’t quite touch the paper. (Anywhere from 5 to 10 mm space above the paper will be fine. You just need to jog as close to the paper as is required to be able to see the rod (or gripper) well enough to center it on the washer.
  4. For the second point in the Tool Wizard, jog the U axis approximately 180°, then jog the rod (or gripper) until it is centered over the washer.
  5. Click the [Finish] button to define the new tool and exit the Tool Wizard. We have just defined the parameters for Tool 1.
    The new tool values for Tool 1 will appear as shown in the figure below.

    The [Tools] Tab (for defining tools)

Step 3: Test the New Tool
You should now be back in the Jog and Teach Window. And since we haven’t jogged the robot since we positioned it above the target position (the washer), the robot’s gripper (or rod) should still be located just above the target position.

  1. Jog the robot about 10 to 15 mm up in the Z direction (+Z). This will get our gripper (or rod) away from the work surface just in case there is a problem.
  2. Click the down arrow for the [Tool] of the Jog and Teach Window.
  3. Click “1” since we want to select Tool 1. (Remember this was the tool we just taught in Step 4.)
  4. Now try jogging the U axis in the positive or negative direction. You should see the tip of the gripper (or rod) stay in its current XY position while the robot rotates around this point. (This is easily seen for tools that are offset from the center of the Z-axis. If you are using a rod that comes straight down from the Z-axis, this may be difficult to see.
  5. You should expect some movement of the gripper (rod) from the XY position when the U axis is moving. However, the gripper should return to the XY position of the target (the washer) after each U axis jog step is complete.
  6. If your tool doesn’t appear to be working properly, go back to the beginning of step 2 and try again.
  7. Close the Robot Manager. We are now finished defining and testing the tool.

Step 4: Starting the Camera Calibration Process
We are now ready to calibrate the robot with the mobile camera.

  1. Click the [Vision] button on the Epson RC+ 8.0 toolbar to bring the Vision Development Window back to the front position on the screen.
  2. Click the [New calibration] button on the Vision Guide toolbar. This will open the [New Calibration] dialog box.
  3. Type in the name “downcal” without the quotes and click the OK button.
  4. The CameraOrientation property to “Mobile J2” on the property list on the [Calibration] window.
  5. Change the RobotTool property to 1. This will select Tool 1 to be used when teaching the reference point for the calibration.
  6. Set the TargetSequence property to blobtut. We will use this sequence for finding the parts during calibration.

Step 5: Teaching the Calibration Points

  1. Click the [Teach Points] button located below the video display.
  2. The Vision Guide window will change the Teach Points mode, as shown below. Notice the message at the top of the Vision Guide window that requests that you “Jog to top left camera position”, as shown in the figure below. This means to jog the robot (and camera) to a position where the washer can be seen in the upper left corner of the image display of the Vision Guide window. The figure below shows the approximate position where you should jog the robot. As you can see in the figure, this is the 1st of 9 camera positions required for calibration.

    Teaching camera positions for calibration
  3. Teaching the 1st Camera Position: Jog the robot so that the camera is positioned where you can see the washer in the top left corner position of the image display of the Vision Guide window.
  4. Click the Teach button on the Vision Guide window.
  5. Teaching the 2nd Camera Position: Jog the robot to the right of the 1st camera position so that the camera is positioned where you can see the washer in the top center position of the image display of the Vision Guide window.
  6. Click the Teach button on the Vision Guide window.
  7. Teaching the 3rd Camera Position: Jog the robot to the right of the 2nd camera position so that the camera is positioned where you can see the washer in the top right position of the image display of the Vision Guide window.
  8. Click the Teach button on the Vision Guide window
  9. Teaching the 4th Camera Position: Jog the robot down from the 3rd camera position so that the camera is positioned where you can see the washer in the center right position of the image display of the Vision Guide window. This position will be below the 3rd camera position starting a zigzag pattern when you refer to all the camera positions in order.
  10. Click the [Teach] button on the Vision Guide window.
  11. Teaching the 5th to 9th Camera Positions: Continue jogging the robot and teaching points as instructed at the bottom of the Vision Guide window for each of the 5th through 9th camera positions. The Vision Guide window will display which position to move to for each camera position. Camera positions 5 to 9 are described below:
    5 - center
    6 - left center
    7 - bottom left
    8 - bottom center
    9 - bottom right
  12. Next, the message shown at the top of the window that says “Jog to fixed reference”. This means to jog the robot so that the gripper (rod) is centered on the calibration target part (in this case the washer). At this point you can ignore the video display, since we are aligning the robot gripper with the calibration target. Go ahead and jog the robot so that the gripper is positioned at the center of the washer. The positioning of this is very important so you will need to jog the robot down close to the washer to get a good alignment.
  13. Once you have the robot gripper positioned at the center of the washer, click the [Teach] button located at the bottom of the Vision Guide window.
  14. Jog the Z-axis up high enough to keep the gripper away from the work surface and any possibility to bumping into other objects during calibration because the robot gripper was too low. When we teach each of the 9 calibration points this Z height will be used for each.
  15. After the last camera position is taught a dialog box will appear which says “All calibration points are now taught”. Click the Finish button to continue.

Teaching the points required for Calibration is now complete.

Step 6: Running the Camera Calibration
Shown below are the final steps required to complete the camera calibration process:

  1. Click the [Calibrate] button on bottom of the Vision Guide window [Calibration] tab.
  2. A message box will appear with the message “CAUTION Robot will move during calibration at Speed 10, Accel 10 Continue?” Click the [Yes] button to continue calibration.
    The robot will move through each of the 9 points 2 times during calibration. If you need to abort the calibration while the robot is moving around, click the [Abort] button at the bottom of the [Calibration Cycle] dialog box.
  3. After the calibration cycle is complete, the [Calibration Complete] dialog box appears and displays the calibration result data. Examine the data and then click the [OK] button.
  4. Notice that the calibration results are displayed in the Results list on the [Calibration] window.

Step 7: Assign the “downcal” Calibration to the blobtut Sequence
Now that the “downcal” calibration has been created, we will need to assign this calibration to our vision sequence (blobtut). This will give the blobtut sequence the ability to calculate results in robot and camera coordinate values.

  1. Click the vision sequence: “blobtut” from the sequence tree on the [Vision Guide] window to bring the [Sequence] window to the front.
  2. Set the Calibration property to “downcal” by clicking once on the value field of the Calibration property, then clicking on the down arrow, and finally clicking on the calibration displayed which is called “downcal”. This was the calibration we just finished creating.
  3. Click the [Jog] button displayed on the right side of the sequence and the calibration tree to display the [Jog] tab.
  4. Use the jog buttons to position the camera over the washer so that you can see the washer within the image display.
  5. Click the “washer” object from the sequence tree and bring the [Object] window to the front.
  6. Click the [Run Object] button to run the “washer” object. When the part is found look at the Result list. You will see that the CameraX, CameraY, RobotX, RobotY and RobotU results no longer show a “nocal” result. You can now see coordinate position data with respect to the Robot and Camera coordinate systems.

Teaching Points for Vision Guidance

Now we must teach a few points to define the Z height of the washer pickup position, the position where the camera will take a picture of the washer for processing, and a safe position that for this tutorial will act as a starting position.

Step 1: Define the “camshot” Position
The “camshot” position is the position where the robot must be located so that the camera is positioned over the part in a way that allows the part to be seen by the vision system. The robot must be moved towards the part until the washer can be seen in the image display on the screen. It is a good idea to position the robot so that the washer is located in the middle of the image display and not close to one of the edges of the search window. Since we just finished running the washer object, the camera should be in a good position for acquiring an image that contains the washer.

  1. Click the [Robot Manager] button on the main toolbar, then click the [Jog & Teach] tab.
  2. Since we want the camera shot position to be taught using Tool 1, check the drop down list box labeled Tool to make sure that it is set to 1. If it is not set to 1, then go ahead and click the arrow on the drop down list box and set the Tool to 1.
  3. Verify that the current point in the Point # field is P0. We want to teach the camshot position as point P0. If it is not point P0, then select P0 in the point # field.
  4. Click the [Teach] button on the [Jog & Teach] window. You will be prompted for a label. Enter the name “camshot”. This will teach the “camshot” position.

Step 2: Define a Safe Position Away from the Washer
We will need a taught point position away from the washer that will be used as a safe position that we will move to at the start of the program.

  1. Select P1 in the point field.
  2. Jog the Z-Axis of the robot up and then jog in X and Y to position the robot in a safe position. This will be like your start position for your program. The robot will always move to this position first before moving to the washer.
  3. Click the [Teach] button on the [Jog & Teach] page. Enter “safept” for the label. This will teach the “safept” position.

Step 3: Calculate a Z Height for the "washer" Pickup Position
If we were doing an actual application to pick up a real washer, rather than moving to a drawing of a washer, we would need to set a Z height for the washer pickup position. Let’s find a good Z height for our washer position. This case is explained that the gripper is equipped to the Arm #3 (J3).

CAUTION


Be sure to set the Z height for robot motion carefully. If the calculated Z height is incorrect, it may cause a malfunction of the system and/or safety problems.

  1. Click the [Robot Manager] button on the main Epson RC+ toolbar. Then click the [Jog & Teach] tab.
  2. Use the Jog buttons to position the gripper of the robot about 5 to 10 mm above the washer. Take care of positioning the gripper not to hit the washer.
  3. Write down the current Z coordinate value when the robot gripper is just above the washer. This z coordinate will be used in our program later to move the robot to this height.
  4. Select P2 in the point field.
  5. Click the [Teach] button on the [Jog & Teach] window. Enter the label name “washpos”. This will teach our initial “washpos” position. (However, the Vision System will be used to calculate a new X and Y position and then move to this point. We will also set a fixed Z height in our program based on the current Z coordinate position.)

Using Vision and Robot to Move to the Part

Now all that’s left is to modify our program to cause the vision system and robot to work together to find the position of the washer and then move to it.

Step 1: Modify the SPEL+ Program

  1. Click the - [Open File] button on the Epson RC+ 8.0 toolbar.

  2. The MAIN.PRG program file should already be highlighted since you still haven’t created any other programs. Click the [Open] button at the bottom left of the dialog box to open the MAIN.PRG program file. You should see the following program that we ran earlier in this tutorial.

    Function main  
      Real area  
      Boolean found  
      
      VRun blobtut  
    VGet blobtut.washer.found, found  
       
      If found = TRUE Then  
        VGet blobtut.washer.area, area  
        Print "The washer was found!"  
        Print "The washer area is:", area, "Pixels"  
      Else  
        Print "The washer was not found!"  
      EndIf  
    Fend  
    
  3. Now modify the program so that it appears as shown on the next page.

    KEY POINTS


    Remember that the SPEL+ language uses apostrophes ' to denote comments. Any characters that follow an apostrophe are considered comments and are not required for the program to execute properly. (This means that you can omit any characters that follow an apostrophe out to the end of the line where the apostrophe exists.)

    Function main  
      
       '***********************************************  
      ' Very important statement below:	*  
      ' Use the Z height which you wrote down earlier in Step 3 of "Teaching Robot Points for use with Vision Guidance".	*  
      	*  
      ' Substitute the Z height value (a negative number) which you wrote down in the place of the xx shown below.	*  
      '***********************************************  
      #define ZHeight -xx	  
      
      Real area, x, y, u  
      Boolean found  
      Integer answer  
      String msg$, answer$  
      
      Power Low          ‘Run robot at a slow speed and accel  
      Tool 1             'Use Tool 1 for positioning  
      Jump safept        ‘Move robot to safe start position  
    
      Do                 ‘Continue looping until user stops  
        Jump camshot     ‘Move robot to take picture  
        VRun blobtut     'Run the vision sequence blobtut  
        VGet blobtut.washer.RobotXYU, found, x, y, u  
      
        If found = True Then  
          VGet blobtut.washer.area, area  
          Print "The washer was found!"  
          Print "The washer area is: ", area, "Pixels"  
          washpos = XY(x, y, ZHeight, u) 'Set pos to move to  
          Jump washpos	  
          msg$ = "The washer was found!"  
        Else  
           msg$ = "The washer was not found!"  
        EndIf  
         msg$ = msg$ + CRLF + "Run another cycle(Y/N)?"  
        Print msg$  
        Input answer$  
        If Ucase$(answer$) <> "Y" Then  
        Exit Do  
        EndIf  
      Loop  
    Fend  
    

Step 2: Run the Program to Find the Washer and Move to it

  1. Click the [Run] button on the Epson RC+ 8.0 main toolbar. This will cause the program to be compiled and then open the Run window.
  2. Click the [Start] button on the Run window.
  3. Your program will now find the washer and move the robot to it. After you successfully find the washer, try moving the washer a little and then click the [Yes] button in the dialog box that asks if you would like to run another cycle.
    If the washer is not found, a different dialog box will appear asking whether you would like to try again.
    Clicking [No] in either dialog box will cause the program to stop running.