VisionWare User`s Guide - Adept Technology, Inc.
Transcription
VisionWare User`s Guide - Adept Technology, Inc.
VisionWare User’s Guide Version 3.0 VisionWare User’s Guide Version 3.0 Part Number 00713-00230, Rev. A October 1995 ® 150 Rose Orchard Way • San Jose, CA 95134 • USA • Phone (408) 432-0888 • Fax (408) 432-8707 Otto-Hahn-Strasse 23 • 44227 Dortmund • Germany • Phone 0231/75 89 40 • Fax 0231/75 89 450 adept technology, inc. 11, Voie la Cardon • 91126 • Palaiseau • France • Phone (1) 69.19.16.16 • Fax (1) 69.32.04.62 1-2, Aza Nakahara Mitsuya-Cho • Toyohashi, Aichi-Ken • 441-31 • Japan • (0532) 65-2391 • Fax (0532) 65-2390 The information contained herein is the property of Adept Technology, Inc. and shall not be reproduced in whole or in part without prior written approval of Adept Technology, Inc. The information herein is subject to change without notice and should not be construed as a commitment by Adept Technology, Inc. This manual is periodically reviewed and revised. Adept Technology, Inc. assumes no responsibility for any errors or omissions in this document. Critical evaluation of this manual by the user is welcomed. Your comments assist us in preparation of future documentation. A form is provided at the back of the book for submitting your comments. Copyright 1992, 1995 by Adept Technology, Inc. All rights reserved. The Adept logo is a registered trademark of Adept Technology, Inc. Adept, AdeptOne, AdeptOne-MV, AdeptThree, AdeptThree-MV, PackOne, PackOne-MV, HyperDrive, Adept 550, Adept 550 CleanRoom, Adept 1850, Adept 1850XP, A-Series, S-Series, Adept MC, Adept CC, Adept IC, Adept OC, Adept MV, AdeptVision, AIM, VisionWare, AdeptMotion, MotionWare, PalletWare, AdeptNet, AdeptFTP, AdeptNFS, AdeptTCP/IP, AdeptForce, AdeptModules, and V+ are trademarks of Adept Technology, Inc. Any trademarks from other companies used in this publication are the property of those respective companies. Printed in the United States of America Table Of Contents Read Me First! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What Is VisionWare? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 How Does VisionWare Make Inspections? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 What Is Not Included in This Guide? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Do I Have to Read All the Manuals? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Are You Using VisionWare With a Motion Device? . . . . . . . . . . . . . . 3 Are You Customizing VisionWare? . . . . . . . . . . . . . . . . . . . . . . . . . . 3 What Is the Fastest Way to Get Started? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 How Can I Get Help? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Within the Continental United States . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Service Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Application Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Applications Internet E-Mail Address . . . . . . . . . . . . . . . . . . . . . . . . . 5 Training Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Within Europe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 France . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7 1.1 Loading and Executing VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 Using the Basic Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Working With the Pointing Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Working in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Clicking and Dragging. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Opening a Window (Making a Menu Selection) . . . . . . . . . . . . . . . . . . . . 9 Selecting a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Moving a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Scrolling Within a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Sizing a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Closing a Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Main Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Window Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.3 Using VisionWare Menu Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Standard Menu Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 About This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Menu Selection Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Keyboard Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Selecting, Choosing, Pressing, and Performing . . . . . . . . . . . . . . . . . . . 13 VisionWare User’s Guide, Rev. A iii Table of Contents Selecting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Choosing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Pressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Performing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.4 What Is a Resource Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Loading and Selecting Resource Modules . . . . . . . . . . . . . . . . . . . . . . . 15 Resource Module Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.5 Managing Resource Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.6 Resource Module Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Module Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Global Databases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Dual-Vision Systems and AIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.7 Editing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Selecting (Highlighting). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Active/Inactive. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 The Typing Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Creating New Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Copying and Deleting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Selecting Different Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Exiting Record Editing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Record-Editing Menu Bars and Quick Keys . . . . . . . . . . . . . . . . . . . . . . 24 1.8 Creating a New Vision Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1.9 Additional Record-Creation Aids. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1.10 The Vision Record Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.11 Building and Executing Inspections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.12 Access Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Assigning Access Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Creating User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Editing User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Logging On the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Logging Off the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2 Sequence Creation and Execution . . . . . . . . . . . . . . . . . . . . . . . . .33 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.2 Sequences and Resource Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Control Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Creating a Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 The Sequence Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2.3 Editing a Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Selecting a Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Statement Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Completing a Statement Argument. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Adding a Sequence Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Completing Optional Statement Arguments . . . . . . . . . . . . . . . . . . . . . . 38 Optional Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Completing Constant Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 iv VisionWare User’s Guide, Rev. A Table of Contents Adding Comments to a Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Removing Sequence Lines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Cutting, Copying, and Pasting Statement Lines . . . . . . . . . . . . . . . . . . . 39 Copying Statement Lines Between Sequences . . . . . . . . . . . . . . . . . . . 40 Sequence Editor Special Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Finding and Finding/Changing Statement Arguments . . . . . . . . . . . . . . 43 2.4 What Are the Sources for Statement Arguments? . . . . . . . . . . . . . . . . . . . . 43 Avoiding Trouble With Statement Arguments. . . . . . . . . . . . . . . . . . . . . 45 2.5 The Statement Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Statement Tree Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Source Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2.6 Task Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.7 Debugging Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Task Control Debug Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Activating Single-Step Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2.8 Using AIM Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 How Do I Start A Task? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.9 Master Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.10 Editing Sequence Records During Execution . . . . . . . . . . . . . . . . . . . . . . . 56 3 VisionWare Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.2 General VisionWare Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 INSPECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 INSPECT_LIST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 OCR_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 AUTO_BRIGHTNESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 PICTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 MESSAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 SET_RESPONSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 3.3 Control Structure Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Using Expressions in Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Conditional and Looping Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 CALL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 RETURN Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 IF Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 END Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ELSE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 FOR Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 REPEAT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 WHILE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 EXIT_LOOP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 NEXT_LOOP Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 CASE Structure (Includes VALUE and ANY Statements) . . . . . . . . . . . 67 GOTO Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 SET Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 VisionWare User’s Guide, Rev. A v Table of Contents 3.4 Sequence Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 LOAD Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 PAUSE_TASK Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 RESUME_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 SELECT_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 START_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 STOP_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 UNLOAD Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.5 The Variable Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 4 Building Inspections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.2 Inspection Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 4.3 Inspection Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Pass/Fail Criteria for Numeric Values. . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Pass/Fail Criteria for Boolean Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.4 Picture Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.5 Picture Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 4.6 Camera Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.7 Camera Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.8 Calibrating a Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.9 Camera Calibration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Method 1: Adept Calibration Sheet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Method 2: Square of Know Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . 86 Method 3: Circle of Known Radius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Method 4: Solid Bar of Known Width . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Method 5: Specify mm/pixel Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Calibration Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 5 Record Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 5.1 5.2 5.3 5.4 6 Why Are Record Classes Important? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 What are the Record Classes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Records That Return Cartesian Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Records in the Test-a-Value Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 6.1 What Types of Measurements Can Be Made? . . . . . . . . . . . . . . . . . . . . . . . 96 6.2 Measuring the Distance Between Two Points . . . . . . . . . . . . . . . . . . . . . . . 97 Tutorial: Measuring a Point-to-Point Distance . . . . . . . . . . . . . . . . . . . . 98 Create the Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Add an Inspect Statement to a Sequence . . . . . . . . . . . . . . . . . . . . . . 100 6.3 Measuring the Distance From a Point to a Line . . . . . . . . . . . . . . . . . . . . . 101 Tutorial: Editing an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . 102 Modify the Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.4 Measuring the Angle Between Two Lines . . . . . . . . . . . . . . . . . . . . . . . . . 103 vi VisionWare User’s Guide, Rev. A Table of Contents 6.5 Measuring Circle’s Radius or Diameter . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 7 Testing a Value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 7.1 Which Values Can Be Tested? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 7.2 Creating a Test-a-Value Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 7.3 Testing Results From Rulers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Create a Ruler Record:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 7.4 Testing Results From Finder Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Tutorial: Testing the Orientation of a Blob . . . . . . . . . . . . . . . . . . . . . . 112 Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Create a Blob Finder Record: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 7.5 Testing Window Stats: Graylevel Statistics. . . . . . . . . . . . . . . . . . . . . . . . . 113 Picture Records and Graylevel Statistics . . . . . . . . . . . . . . . . . . . . . . . 114 Tutorial: Calculating an Average Graylevel . . . . . . . . . . . . . . . . . . . . . 115 Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Edit the Sample Window Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Edit the Picture Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 7.6 Testing Window Stats: Pixel Counts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 How Does VisionWare Know Which Pixels to Count? . . . . . . . . . . . . . 117 Picture Records and Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Window Records and Pixel Count Inspections . . . . . . . . . . . . . . . . . . . 118 Pixel Count Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 8 Vision Model Processing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 8.1 Prototype Model Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 8.2 Creating Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Editing Prototypes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Prototype Training Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Prototype Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.3 Prototype Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 8.4 Prototype Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 8.5 Image Correlation Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 8.6 Correlation Template Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 8.7 Correlation Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 8.8 Correlation Window Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.9 OCR Font Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 8.10 Creating a Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 8.11 OCR Field Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.12 OCR Field Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 OCR Field Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 9 Frame Relative Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .139 9.1 Why Use Frame Relative Records? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 VisionWare User’s Guide, Rev. A vii Table of Contents 9.2 9.3 9.4 9.5 What Is a Vision Frame? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Vision Frame Class Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Vision Frames Generated by Vision Tools . . . . . . . . . . . . . . . . . . . . . . . . . 140 Computed Vision Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Fixed Frame and Null Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Frame Origin, a Point on the X axis, and a Point in the Positive Y Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Frame Origin and a Point on the Positive X Axis . . . . . . . . . . . . . . . . . 145 Line and a Point in the Positive Y Direction . . . . . . . . . . . . . . . . . . . . . 146 A Line for the X Axis, and a Line Through the Origin . . . . . . . . . . . . . . 147 9.6 Making Vision Tools Relative to a Vision Frame. . . . . . . . . . . . . . . . . . . . . 147 Tutorial: Creating a Vision Frame Relative Arc Finder . . . . . . . . . . . . . 148 A. Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 B. Create an Arc Finder Record . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 C. Create a Computed Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 D. Complete the Arc Finder Record . . . . . . . . . . . . . . . . . . . . . . . . 150 E. Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . 150 Vision Frame Relative Inspection Tree. . . . . . . . . . . . . . . . . . . . . . . . . 151 10 Repeating and Combining Operations. . . . . . . . . . . . . . . . . . .153 10.1 Looping in VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Repeat Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Value Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 10.2 Examples Using Combination-Repeat Pairs. . . . . . . . . . . . . . . . . . . . . . . 155 Example 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Example 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Additional Observations of Interest . . . . . . . . . . . . . . . . . . . . . . . . 161 Restrictions on Combination-Repeat Loops . . . . . . . . . . . . . . . . . . . . . 163 11 Viewing and Recording Vision Results . . . . . . . . . . . . . . . . . .165 11.1 Viewing Vision Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Displaying Tool Graphics During Sequence Execution . . . . . . . . . . . . 166 11.2 Displaying Vision Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Recent History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.3 Inspection Results Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 11.4 Inspection Results Page Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 11.5 Charts of Inspection Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 11.6 inspection Chart Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Inspection Charts for Boolean Inspections . . . . . . . . . . . . . . . . . . . . . . 171 11.7 Logging Vision Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 The Form of the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 The Output File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 The Shifted Process Capability Index. . . . . . . . . . . . . . . . . . . . . . . . . . 173 viii VisionWare User’s Guide, Rev. A Table of Contents 12 Using Digital I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 12.2 Installing Digital I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Displaying the State of Digital I/O Signals . . . . . . . . . . . . . . . . . . . . . . 176 12.3 Digital I/O Signal Numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Soft Signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Special Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Negative Signal Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 12.4 Using Digital I/O With Vision Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 12.5 Using Digital I/O Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 WAIT_FOR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 WAIT_UNTIL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 IO Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 IO_LIST Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 13 Vision Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181 13.1 Pixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Computer Image Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.2 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3 Grayscale vs. Binary Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Contrast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 13.4 Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 13.5 Blobs and Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Holes in Blobs or Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 13.6 Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 13.7 Lighting Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Diffuse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Directional. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Structured . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Strobe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.8 Filtering and Special Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Polarizing Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Color Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Infrared Filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 A Installing VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 A.1 Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 A.2 Initialization Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 A.3 Autostarting VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 B Menu Bars and Quick Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 B.1 Main Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 B.2 Record Editing Menu Bar and Quick Keys . . . . . . . . . . . . . . . . . . . . . . . . . 203 VisionWare User’s Guide, Rev. A ix Table of Contents B.3 Vision Window Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 B.4 Sequence Editing Menu Bar and Quick Keys . . . . . . . . . . . . . . . . . . . . . . 208 C VisionWare Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 C.1 The File Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 File Manager Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 C.2 The Backup and Restore Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 The Backup Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Backup Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Creating a Backup Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Restoring Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Restore Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 D Basic, OCR, and Special Purpose Records . . . . . . . . . . . . . . . .221 D.1 Inspection Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 D.2 Inspection Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 D.3 Inspection Record Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 D.4 Picture Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 D.5 Picture Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 D.6 Value Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 D.7 Value Combination Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 D.8 Prototype Model Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 D.9 Prototype Model Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 D.10 Prototype Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 D.11 Prototype Finder Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 D.12 OCR Font Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 D.13 OCR Font Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 D.14 OCR Field Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 D.15 OCR Field Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 D.16 Correlation Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 D.17 Correlation Template Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 D.18 Correlation Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 D.19 Correlation Window Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 D.20 Frame Pattern Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 D.21 Frame Pattern Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 D.22 Conditional Frame Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 D.23 Conditional Frame Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 E Finder Tool Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249 E.1 Line Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 E.2 Line Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 x VisionWare User’s Guide, Rev. A Table of Contents E.3 Point Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 E.4 Point Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 E.5 Arc Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 E.6 Arc Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 F Computed Feature Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 F.1 Computed Line Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 F.2 Computed Line Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 F.3 Computed Point Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 F.4 Computed Point Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 F.5 Computed Circle Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 F.6 Computed Circle Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 F.7 Computed Frame Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 F.8 Computed Frame Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 G General Tool Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 G.1 Linear Ruler Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 G.2 Linear Ruler Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 G.3 Arc Ruler Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 G.4 Arc Ruler Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 G.5 Ruler Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 G.6 Ruler Profile Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 G.7 Window Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 G.8 Window Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 G.9 Image Processing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 G.10 Image Processing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Add Two Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Subtract Images (A - B) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Convolve. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Morphological Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Edge Detection Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Threshold Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Copy Image to New Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 G.11 Blob Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 G.12 Blob Finder Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289 VisionWare User’s Guide, Rev. A xi Table of Contents List of Figures Figure 1 Steps to Complete a Vision Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Figure 1-1 Start-up Message. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Figure 1-2 Monitor Window Feature Identification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Figure 1-3 VisionWare Menu Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Figure 1-4 Example Resource Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Figure 1-5 New Module Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Figure 1-6 Edit Module Components Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Figure 1-7 Select New Module Component Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Figure 1-8 Edit Module Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Figure 1-9 Searching for a Database Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Figure 1-10 Creating a New Vision Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Figure 1-11 Vision Record Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Figure 2-1 New Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Figure 2-2 Sequence Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Figure 2-3 Sequence Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 Figure 2-4 Find and Change Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Figure 2-5 Sample Statement Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Figure 2-7 Task Control Panel With Debug Options . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Figure 2-8 Master Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Figure 3-1 Variable Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Figure 4-1 Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Figure 4-2 Inspection Limits and Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Figure 4-3 Pass/Fail Criteria for Boolean Inspections . . . . . . . . . . . . . . . . . . . . . . . . . 79 Figure 4-4 Picture Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Figure 4-5 Camera Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Figure 4-6 Camera Calibration Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Figure 4-7 Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Figure 6-1 POINT-POINT Distance Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Figure 6-2 POINT-LINE Distance Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Figure 7-1 Test a Value Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Figure 7-2 Sample Vision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Figure 7-3 Window Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Figure 8-1 Prototype Model Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Figure 8-2 Prototype Editing Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Figure 8-3 Prototype Finder Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 xii VisionWare User’s Guide, Rev. A Table of Contents Figure 8-4 Correlation Template Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Figure 8-5 Correlation Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Figure 8-6 OCR Font Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Figure 8-7 OCR Field Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 Figure 9-1 Vision Frame Relative Arc Ruler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Figure 9-2 Vision Frame Relative Linear Rulers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Figure 9-3 Computed Frame, Three Point Method . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Figure 9-4 Computed Frame, Two Point Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Figure 9-5 Computed Frame, Point and Line Method . . . . . . . . . . . . . . . . . . . . . . . . 146 Figure 9-6 Computed Frame, Two Line Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Figure 9-7 Vision Frame Relative Inspection Tree . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Figure 10-1 Combination Inspection Tree (Example 1). . . . . . . . . . . . . . . . . . . . . . . . 157 Figure 10-2 Combination Inspection (Example 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 Figure 10-3 Combination Record Tree (Example 2) . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Figure 10-4 Combination Record (Example 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Figure 10-5 Combination Record Tree (Example 3) . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Figure 10-6 Repeat Tree With Multiple Inspection Records . . . . . . . . . . . . . . . . . . . . 162 Figure 10-7 Valid and Invalid Combination-Repeat Trees . . . . . . . . . . . . . . . . . . . . . 163 Figure 11-1 Inspection Results Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 Figure 11-2 Charts of Inspection Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Figure 12-1 Digital I/O Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Figure 13-1 A Grayscale Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Figure 13-2 A Binary Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Figure 13-3 Resolution Factors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Figure 13-4 Sample Vision Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 Figure 13-5 Binary Representation of Sample Matrix . . . . . . . . . . . . . . . . . . . . . . . . . 185 Figure 13-6 Setting Both Binary Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Figure 13-7 Grayscale Representation of Sample Matrix . . . . . . . . . . . . . . . . . . . . . . 186 Figure C-1 File Manager Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Figure C-2 Backup Selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Figure C-3 List of Backup Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Figure C-4 Backup Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Figure C-5 List of Backup Savesets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Figure C-6 Restore Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Figure D-1 Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Figure D-2 Picture Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Figure D-3 Value Combination Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 Figure D-4 Prototype Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 Figure D-5 Prototype Finder Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Figure D-6 OCR Font Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 VisionWare User’s Guide, Rev. A xiii Table of Contents Figure D-7 OCR Field Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 Figure D-8 Correlation Template Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 Figure D-9 Correlation Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 Figure D-10 Frame Pattern Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 Figure D-11 Conditional Frame Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 Figure E-1 Line Finder Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Figure E-2 Point Finder Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Figure E-3 Circle Finder Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Figure F-1 Computed Line Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Figure F-2 Computed Point Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Figure F-3 Computed Circle Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Figure F-4 Computed Frame Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Figure G-1 Linear Ruler Tool Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 Figure G-2 Arc Ruler Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 Figure G-3 Ruler Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Figure G-4 Window Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Figure G-5 Image Processing Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 Figure G-6 Blob Finder Tool Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 List of Tables Table 1 Manuals Used for Custom Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Table 2 Quick Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Table 1-1 Conventions Used in This Manual for Menu Instruction Lines. . . . . . . . . . 11 Table 1-2 Typographic Conventions Used in This Manual. . . . . . . . . . . . . . . . . . . . . 13 Table 2-1 Statement Argument Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Table 5-1 Records Returning Point Values (Point-Class Records) . . . . . . . . . . . . . . 91 Table 5-2 Records Returning Line Values (Line-Class Records) . . . . . . . . . . . . . . . 91 Table 5-3 Records Returning Circle Values (Circle-Class Records) . . . . . . . . . . . . . 92 Table 5-4 Records Returning Vision Frame Values (Vision-Frame Class Records) . 92 Table 5-5 Test-a-Value Class Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Table 7-1 List of Values That Can Be Tested . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Table 10-1 Repeat Class Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Table 13-1 Types of Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 Table A-1 Options in the Baseline File (BASEINI.DB) . . . . . . . . . . . . . . . . . . . . . . . 195 Table A-2 Options in the Vision (VISWINI.DB) File . . . . . . . . . . . . . . . . . . . . . . . . . 196 xiv VisionWare User’s Guide, Rev. A Table of Contents Table A-3 Options in the VisionWare (VWINI.DB) File. . . . . . . . . . . . . . . . . . . . . . . 197 Table A-4 Options in the User File (USERINI.DB) . . . . . . . . . . . . . . . . . . . . . . . . . . 197 Table B-1 Record Editing Quick Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Table B-2 Sequence Editing Quick Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 Table D-1 Inspection Record Type: Measure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 Table D-2 Inspection Record Type: Test a Value. . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Table D-3 Inspection Record Type: Combine Inspections . . . . . . . . . . . . . . . . . . . . 226 Table D-4 Blob Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Table D-5 Inspection Record Type: Window Statistics . . . . . . . . . . . . . . . . . . . . . . 227 VisionWare User’s Guide, Rev. A xv Read Me First! Compatibility This manual is for use with VisionWare version 3.0 operating in conjunction with V+ version 11.2 or later. What Is VisionWare? VisionWare is an application module for the Adept AIM system. VisionWare allows you to produce machine-vision inspection applications in a “point and click” environment. VisionWare has programmed all the tools necessary to perform inspections– you simply use the VisionWare mouse and menu system to tell VisionWare where to put the tools and how to interpret the results. How Does VisionWare Make Inspections? vision tools Vision inspections are made by the vision tools provided with VisionWare. These tools include rulers for measuring distances; windows for calculating the intensity ranges in an image; finder tools for locating lines, circles, and other features of objects that you place in the field of view of the camera; and prototype and optical character recognition (OCR) tools. Each of these tools requires several items of information to know what data to collect, how to interpret the data, and where in the camera field of view to look for that data. VisionWare allows you to specify all these items of information either by making menu selections or by using the mouse to manipulate the tools directly. records Once you have created a vision tool, VisionWare saves all the information about that tool in a vision record that can be recalled for future use. Vision records are a key ingredient in VisionWare. They automatically store all the characteristics you specify when creating a vision tool or vision operation (in addition to tools, VisionWare has operations, which coordinate and support the work of the various vision tools). A single inspection requires several records to specify what you want done with the data returned from a vision tool, the characteristics of the tool itself, and the camera settings to use when a picture is taken. The creation, storing, and connecting of records is done automatically by VisionWare; you simply make menu selections to tell VisionWare what you want the different records to do. VisionWare User’s Guide, Rev. A 1 top-level record Every individual inspection you create will have a master, or top- level, record that specifies what type of inspection is going to be made, what other records are needed to make the inspection, and what the requirements are for the inspection to be successful. sequence If you are inspecting multiple features of an object, you will create sev eral different individual inspections to look at the different features. To make a complete inspection of an object, you will combine the individual inspections into a sequence of inspections that examines all the critical features of the object. sequence execution Once you have created the individual inspections and combined them into a complete sequence of inspections, you actually run the sequence. VisionWare provides a control panel from which you can control execution of sequences of inspections, debug the sequence of inspections, and make any adjustments necessary to finetune the performance of the tools being used to make the individual inspections. The steps required to perform a vision inspection are shown in Figure 1. 1. Create the top-level inspection record. 2. Create the additional records needed to accomplish the inspection specified by the top-level inspection record. 3. Combine the individual inspections into a complete sequence of inspections. 4. Run the sequence of inspections. Record: Record: Record: Record: Record: Record: Record: Record: Record: Record: + Record: Record: Record: + + Record: Record: Record: Record: Record: Record: + Record: Record: Record: Figure 1 Steps to Complete a Vision Inspection What Is Not Included in This Guide? 1. The physical installation and configuration of the computer hardware (including digital I/O equipment). These procedures are covered in the controller user’s guide that came with your controller. Before you can begin building inspections, you must have completed the installation of your controller as described in the controller user’s guide. 2. Instructions for use and installation of any additional hardware that is used along with VisionWare. 2 VisionWare User’s Guide, Rev. A Do I Have to Read All the Manuals? Do I Have to Read All the Manuals? In addition to the manual you are reading, you should also read the Adept MV Controller User’s Guide, which describes the physical controller VisionWare runs on. Are You Using VisionWare With a Motion Device? If you are using VisionWare with an Adept robot or a motion device connected to an AdeptMotion Servo system, you receive additional manuals that detail the special capabilities of VisionWare with a motion device. The MotionWare User’s Guide provides basic details about Adept motion applications including the Path, Tool, and Frame databases. These databases are included with your system in addition to the other databases detailed in this manual. The MotionWare User’s Guide also details calibrating cameras associated with a motion device. Are You Customizing VisionWare? The following set of optional reference material that allows you to not only use VisionWare but also to customize VisionWare at the programming (V +) level and write your own vision applications. These manuals are: Table 1 Manuals Used for Custom Programming Manual Material Covered AIM Customizer’s Reference Guide The AIM database structures and the routines used to drive the AIM system. If you are going to use VisionWare as delivered, you can ignore this material. It outlines the basic strategies for customizing the AIM system that VisionWare is based on. It also provides information on creating and modifying statements, databases, and menu pages. AIM Vision/VisionWare Module Reference Guide Information specific to customizing the vision module. V+ Operating System Reference Guide and V+ Language Reference Guide The operating system and language in which all V+ and AIM programs are written. Unless you are writing custom V+ code, you can ignore this material. AdeptVision Reference Guide Details of the vision enhancements to the V+ language. This reference manual is a companion to the V+ reference guides. AdeptVision VME User’s Guide The “how-to” material for Adept’s vision system. Unless you are programming custom vision applications, you can ignore this manual although a quick review of the manual might help you better understand the vision process. What Is the Fastest Way to Get Started? This manual assumes you have completed the following steps: • Installed the controller (see the controller user’s guide). VisionWare User’s Guide, Rev. A 3 • Installed the input/output (I/O) modules. (If you are using digital I/O. See your controller user’s guide.) • Installed the VisionWare software onto the hard disk. • Installed the cameras (and strobes) that you will be using (see your controller user’s guide). • Installed any additional hardware and lighting that will be used in conjunction with the vision system. Once these steps have been completed, refer to Table 2 for the minimum steps to getting started. Table 2 Quick Start Step Section Activate VisionWare. 1.1 If you are new to menu-driven, window-based software, learn how to use the VisionWare menus, icons, and window system. 1.2 If you are new to machine vision systems, learn the basic principles and vocabulary of computer-aided inspection systems. Chapter 13 Learn the basics of running an inspection sequence. Chapter 4 Edit the default picture record for your working environment. 4.4 You can use VisionWare with the default calibration, but the absolute measurements returned by VisionWare (distances, angles, etc.) will not be accurate. To obtain accurate measurements, you must calibrate your cameras. 4.8 Learn how to use the top-level inspection record. 4.2 Learn to use the different tools needed for the inspections you want to make. Chapters 3-9 How Can I Get Help? Within the Continental United States Adept Technology maintains a Customer Service Center at its headquarters in San Jose, CA. The phone numbers are: Service Calls (800) 232-3378 (24 hours-a-day, 7 days-a-week) (408) 433-9462 FAX NOTE: When calling with a controller related question, please have the serial number of the controller. If your system includes an Adept robot, also have the serial number of the robot. The serial numbers can be determined by using the ID command (see the V+ Operating System User’s Guide) . 4 VisionWare User’s Guide, Rev. A How Can I Get Help? Application Questions (800) 232-3378 (Monday to Friday, 8:00 A.M. to 5:00 P.M., Pacific time) (408) 434-6248 FAX Applications Internet E-Mail Address If you have access to the Internet, you can send applications questions by e-mail to: applications@adept.com This method also enables you to attach a file, such as a portion of V+ program code, to your message. Training Information For information regarding Adept Training Courses in the USA, please call (408) 434-5024. Within Europe Adept Technology maintains a Customer Service Center in Dortmund, Germany. The phone numbers are: (49) 231 /75 89 40 from within Europe (Monday to Friday, 8:00 A.M. to 5:00 P.M) (49) 231/75 89 450 FAX France For customers in France, Adept Technology maintains a Customer Service Center in Paris, France. The phone numbers are: (33) 1 69 19 16 16 (Monday to Friday, 8:30 A.M. to 5:30 P.M, CET) (33) 1 69 32 04 62 FAX VisionWare User’s Guide, Rev. A 5 Getting Started 1 1.1 Loading and Executing VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.2 Using the Basic Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3 Using VisionWare Menu Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 What Is a Resource Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.5 Managing Resource Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.6 Resource Module Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1.7 Editing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 1.8 Creating a New Vision Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1.9 Additional Record-Creation Aids. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 1.10 The Vision Record Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 1.11 Building and Executing Inspections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 1.12 Access Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 VisionWare User’s Guide, Rev. A 7 Chapter 1 - Getting Started 1.1 Loading and Executing VisionWare If VisionWare has not already been copied to the hard disk drive, see Appendix A. Once VisionWare has been copied to the hard disk drive, the steps to load the vision program into system memory and start up VisionWare are:1 1. Turn on the controller and monitor. The system starts up and displays a series of messages on the monitor window. When the screen looks similar to Figure 1-1, you are ready to start VisionWare. Copyright (c) 1984-1995 by Adept Technology, Inc. All rights reserved. Software: 11.2 83-1C0 (Edit P4, 03-Aug-1995) Controller: 3302-773 0 Processor 1: 0.0 2-7 8Mb 100-0 0-0 8 Robot 1: 100-0 0-0 8 Robot 2: Vision 1: 11.2 500 1 1.25Mb 11-Oct-95 15:11:22 Figure 1-1 Start-up Message 2. Make the AIM subdirectory (or whichever subdirectory you copied VisionWare to) the default directory: Type default = c:\aim\ and press the ENTER key. 3. Load and execute the software: Type load lvw and press the ENTER key. Type comm lvw and press the ENTER key. 1 8 If you are using MotionWare with the vision option, you must follow the startup instructions from the MotionWare User’s Guide. In this case, VisionWare becomes a server task for MotionWare. In order to use MotionWare with the vision option, you need to be familiar with all the material in this manual. VisionWare User’s Guide, Rev. A Using the Basic Interface 1.2 Using the Basic Interface Working With the Pointing Device The pointing device controls the position of the cursor arrow on the monitor screen. The pointing device can be used for selecting windows, moving windows on the screen, and opening applications. A standard Microsoft compatible mouse uses the center mouse button. The track ball on the standard Adept keyboard uses only the left button. Working in Windows Figure 1-2 shows the features of a standard Adept window. The callouts shown in the figure are described in the rest of this section. adept Execute Main Menu Bar Edit I/O Show Set-Up Close Icon Title Bar Utilities Special Help Scroll Bar Icon Zoom Icon Accounts Go Seek Edit Help Scroll Handle Window Menu Bar Vertical Scroll Bar Scroll Arrows Cursor Arrow Horizontal Scroll Bar Size Icon Figure 1-2 Monitor Window Feature Identification Clicking and Dragging To click an item, position the cursor arrow (using the mouse or trackball) over the item; press and release the button. To drag an item, position the cursor arrow over the item, press and hold down the button, then drag the item to a new location and release the button. Opening a Window (Making a Menu Selection) 1. Position the pointer on the adept logo at the top left corner of the screen. 2. Press and hold down the button to display a pull-down menu. Drag the pointer until the command that you want to open is selected. 3. Release the button to open, or choose, the window. VisionWare User’s Guide, Rev. A 9 Chapter 1 - Getting Started Multiple windows can be open at one time, and windows can overlap each other. When windows overlap, the active (selected) window appears on top of any other open windows. Selecting a Window You can only work in the currently selected window. To select a window, click anywhere inside the window. The title bar will change from white to dark blue when the window is selected. You can also make a window the currently selected window by choosing the window from the pull-down menu under the adept logo. Moving a Window Click the window title bar and drag the window to a new location. Scrolling Within a Window The scroll bars can be turned on and off by clicking the scroll-bar icon. The arrows at the end of the scroll bar allow you to scroll through a window one line at-a-time. Drag the scroll handles or click anywhere in the scroll bar to scroll quickly to any part of the window. (Scroll handles are not displayed when the window has been expanded to its full size.) Sizing a Window You can change the size of a window by clicking the size icon and dragging it to a new size. Another way to change the size of a window is to click the zoom icon to toggle the window between its maximum size and its current reduced size. Closing a Window To close a window, click the close icon in the upper left corner. Closing the vision or monitor window does not terminate the process that is running in that window. The process will continue to run in the background. For example, if you are formatting a disk, closing the monitor window will not stop the format process. Main Menu Bar This menu bar will be displayed whenever VisionWare is being run. The use of all the main menu bar options is summarized in Appendix B. Window Menu Bar Each open window has its own menu bar with pull-down options. Menu bars are specific to the window in which they appear. Menu bars for VisionWare windows are summarized in Appendix B. 1.3 Using VisionWare Menu Pages Standard Menu Features Screens (windows) displayed by VisionWare are called menu pages. Inspections are built by making selections from the VisionWare menu pages. Menu page features are common 10 VisionWare User’s Guide, Rev. A Using VisionWare Menu Pages to many menu pages. The appearance of each menu page feature tells you what will happen when you select a given feature. Figure 1-3 describes the menu page features. Information box. A gray grooved box presents an item of information. You cannot edit data in this type of box. Data Box. A light blue recessed box accepts data entry. When this box is ready for entry, it turns a darker shade of blue. Radio Buttons. These buttons allow you to select a single option from among the group of buttons displayed. A green center indicates the button has been selected. Check Boxes. These boxes allow you to turn a given option on or off. Push Buttons. These buttons initiate some type of action by the system or indicate system status. A green center indicates the button is on or active; a gray center indicates the action is off or unavailable. Standard Buttons. When the button appears as a gray box, the option is not available. When the button appears as a light blue raised box, clicking the button initiates the indicated action. After being clicked, the button momentarily turns a darker blue to indicate it has been chosen. Scroll Bars. Clicking the scroll arrows increments or decrements the value by one “unit.” Dragging the scroll handle moves through the range of values.The size of a “unit” and range of values vary. Menu features surrounded by this type of box are referred to as a group. Menu features are often grouped according to the overall operation they influence. Figure 1-3 VisionWare Menu Features About This Manual To facilitate understanding and use of menu bars and menu page selections, this manual uses the following conventions: Table 1-1 Conventions Used in This Manual for Menu Instruction Lines Symbol or Appearance Action Edit Select (click and hold down mouse button) the menubar item with the same title. Part Choose this option from the pull-down options presented after a menu-bar item has been selected. VisionWare User’s Guide, Rev. A 11 Chapter 1 - Getting Started Table 1-1 Conventions Used in This Manual for Menu Instruction Lines (Continued) Symbol or Appearance Action ➡ Move to the next action in the instruction sequence. Goto Choose (click) the button with the same name. Arc Select the radio button with the same name. ✔ Relative Select the check box with the same name. enter “hi” Actions such as entering data, text, or double clicking an item are shown in italics. ✼ This symbol calls your attention to an important point. Menu Selection Example The instruction line Edit ➡ Part Type ➡ Edit ➡ New Record box ➡ ✔ Search enabled ➡ Done ➡ Enter “my.rec” in the name data indicates that you should perform the following actions: 1. Select Edit from the main menu bar. 2. Choose Part Type from the resulting pull-down. 3. Select Edit from the newly displayed window menu bar. 4. Choose New Record from the resulting pull-down menu. 5. Type my.rec into the name data box and press ENTER. 6. Select the Search enabled check box. 7. Choose the Done button. 12 VisionWare User’s Guide, Rev. A Using VisionWare Menu Pages Table 1-2 Typographic Conventions Used in This Manual. Appearance Representation italics Indicates new terms and other emphasized words. SMALL CAPS Indicates a physical key or button than you must press, such as the ENTER key. bold In a typing instruction, type anything that you see in this font exactly as it appears. What you type is shown in lowercase letters unless it must be typed in uppercase letters to work properly. For the V+ system to process your typing, you must conclude your entry by pressing the ENTER or RETURN key. regular monospace Used for monitor displays, code examples, nonplaceholder terms in formal syntax definitions, and case-sensitive words required for a UNIX-like setting associated with AdeptNet. Menu bold In text discussion of menu pages, this type style is used for menu items that you choose and window items that do not have initial capital letters in all principal words. Keyboard Conventions Key combinations appear in the following format: Notation Meaning KEY1+KEY2 A plus sign (+) between keys means that you must press the keys at the same time. For example, “Press CTRL+Z” means that you press CTRL and hold it down while you press Z. Selecting, Choosing, Pressing, and Performing The terms select, choose, press, and perform (as used in this manual) have different and specific meanings. Selecting This implies either marking a window item or highlighting it. For example, you may mark a check box with a check. Selecting alone does not initiate an action. You can use a combination of keyboard and pointer device techniques for selecting. Choosing This implies carrying out an action. For example, choosing a menu item may open a window or execute a command. You can also initiate an action by choosing a command button (a push button or a standard button). Often, you select an item and then choose a button to initiate the desired action. VisionWare User’s Guide, Rev. A 13 Chapter 1 - Getting Started You can use a combination of keyboard and pointer device techniques for choosing. Pressing This refers to physical keys or buttons such as those found on a controller’s keyboard or manual control pendant. For example, you press the SAVE key on a keyboard or the PROGSET button on a Manual Control Pendant. By contrast, you select or choose a button appearing in a displayed VisionWare window. Performing This refers to carrying out a sequence of steps that are defined in an AIM menu instruction line. 1.4 What Is a Resource Module VisionWare is designed to efficiently manage the information required to complete the jobs for which your automation workcell was installed. In VisionWare there are two primary types of information required to perform workcell tasks: Data This includes the vision tools that make inspections, camera definitions for the cameras being used, and other information needed for inspections. Data is stored in VisionWare databases. Logic This tells VisionWare the proper order to perform each of the individual operations required to complete a task. This also includes any required synchronization (such as waiting for a digital signal), starting other sequences at the required time, and other options that control the “when” of a job rather than the “what or how”. In VisionWare, logic is stored in sequences. For example, suppose you have a vision task that requires inspection of a hole diameter, inspection of a slot width, and then a measure of the distance between the hole and slot if the first two inspections pass. The data resources (vision and camera databases) tell VisionWare how to make the inspections. These data resources do not indicate what order the inspection are to be made in–a logic resource is required to specify the order of events. In the above example, you need the following resources: • A vision data base to store the vision tools • A camera database to store the camera calibration and definition for cameras used by the vision tools • A sequence to define the order of events You can design as many Resource Modules as you need, but you can select only one Resource Module at a time. Only the sequences associated with the currently selected module can be edited. Suppose you have designed a workcell that performs quality control on three different assemblies. The Resource Modules for the three different assemblies look like Figure 1-4. The modules use databases as follows: • Module 1 has all its own databases and does not use any global databases. • Module 2 uses the global camera and variable databases. • Module 3 uses the global vision, camera, and variable databases. 14 VisionWare User’s Guide, Rev. A What Is a Resource Module Module 1 Module 2 Sequence #1 Sequence #2 Variable DB #1 Camera #1 Vision DB #1 Vision DB #2 Sequence #3 Module 3 Sequence #4 Sequence #5 Figure 1-4 Example Resource Modules Loading and Selecting Resource Modules Resource modules can have three states: unloaded, loaded-not selected, and loadedselected. The state of a module determines which operations can be performed as shown in the following table: Not Loaded Add or delete resources Loaded, not selected Loaded, selected X Edit sequences X Select records for a sequence X X A resource module can be either unloaded or loaded. An unloaded module resides entirely on disk and uses no V+ memory. It can be edited with the module utility, but the data in the module databases cannot be accessed by AIM. A loaded module is read from disk into V + memory. The amount of memory in your system limits the number of modules that can be loaded. Once loaded, the databases into the module can be accessed by the operator interface or the various runtime tasks. Once a module is loaded, it must be “selected” or assigned to specific AIM tasks. Each task may have at most, one module assigned to it. A module can be assigned to more than one task. Once a module is assigned to a task, any references to a database of a given type refer to the module database member of that type. If the module does not contain such a database, the corresponding global database is referenced. A module is assigned to a runtime task by pressing the SELECT button on the operator’s control panel or by executing the SELECT_TASK control-sequence statement. To edit a VisionWare User’s Guide, Rev. A 15 Chapter 1 - Getting Started database within a module, you must first assign it to the operator interface by using the Module ➡ Select/Edit pull-down. When a runtime task is displayed by an operator control panel, the module assigned to that runtime task also becomes assigned to the operator interface. The name of the module currently assigned to the operator interface is shown in the top line of the window, near the right side. If no module is assigned to the operator interface, the name *Global* is shown. As for a runtime task, any reference to a database accesses the components of this module. These references include the database editing pages found under the Edit pull-down, the sequence editor, and various set up utilities. If a module is assigned to an active runtime task, it cannot be unloaded or edited with the module utility. Resource Module Directory When you first create a module, you are prompted to enter a directory name for storing the module resources. The path to this directory can be absolute, such as: c:\data\test.data or \data\proj1\ Or, the path can be relative to the AIM programs directory: data\vis_proj\ 16 VisionWare User’s Guide, Rev. A Managing Resource Modules 1.5 Managing Resource Modules Resources are created, copied, edited, loaded, and selected in the module resource utility. To access a Resource Module, perform: Module ➡ Select/Edit ➊ ➋ ➌ ➍ ➎ ➏ ➑ ➐ ➒ Figure 1-5 New Module Menu Page 1.6 Resource Module Options Refer to Figure 1-5 ➊ Shows all the defined modules components (if All is selected from item ➍) or the loaded modules (if Loaded is selected from item ➍). Double click a module name to select that module (and load the module if not already loaded). The currently selected module is shown at the top of the window (if no module is selected, *Global* is displayed). The currently selected modules is shown in blue. Loaded modules are shown in black and unloaded modules are shown in gray. ➋ ➌ Choose Select to make the highlighted module the currently selected module. A module must be selected in order to access its associated sequences from the sequence editor. Choose Global to de-select the current module. This allows you to access all of the global databases. (If, for example, you have a module selected that has a path database in its resources, you cannot access the global-path database.) VisionWare User’s Guide, Rev. A 17 Chapter 1 - Getting Started NOTE: There is no global-vision or global-location database. ➍ ➎ These radio buttons determine which module are displayed in item ➊. Choose Load to load the selected module. Choose Unload to unload the selected module. ➏ ➐ ➑ ➒ ➓ Choose Create to display a window requesting the new module name and the directory path to the module. All module components will be stored in this directory. If the directory path is left blank, the module and its components will be stored in the current directory. See the following sections (in this chapter) for details on adding components to the module. Choose Copy to create a copy of the selected module. Choose Edit to add, delete, or change characteristics of module components. Choose Delete to delete the selected module and all of its resources. Choose Done to exit the Resource Module utilities. When either a module has been first created or the Edit button is chosen, the following window will be displayed. From this window you can add the required components. This module already has one sequence. ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ Figure 1-6 Edit Module Components Menu Page ➊ ➋ 18 Select ✔ Auto to enable the auto-load feature. Modules with this option enabled load automatically when VisionWare is started. Shows all the module components, component type, disk file name, editing mode, and control flag (when appropriate). The selected component is the current component. VisionWare User’s Guide, Rev. A Resource Module Options ➌ ➍ ➎ ➏ ➐ ➑ Choose to add a new component to the module (the component resource options are shown in “Module Resources” on page 19). Choose to import a component resource that is stored in AIM database format. (Generally, you would import resources that have previously been exported – see item ➏).You may also import a file from a different module. Choose to delete the selected component. Choose to export a component to an AIM database file. Choose to edit the current component characteristics. Choose when you are done editing components. Module Resources To request a new module resource, choose Add from the Edit Module Components window to display the following window, from which you can select module resources: Figure 1-7 Select New Module Component Type The resource types are: Resource Type Definition Camera Defines the camera parameters and calibration for any cameras you will use with vision processes (see section 4.8 on page 84). Variable Defines variables names for use in statement arguments that can accept a numeric value. Refer to Section 3.5 on page 69 for more information. Vision Defines the vision processes used in inspections and robot guidance. VisionWare User’s Guide, Rev. A 19 Chapter 1 - Getting Started Selecting a module component brings up the following window: ➊ ➋ ➎ ➌ ➍ ➏ ➐ Figure 1-8 Edit Module Component ➊ ➋ ➌ ➍ ➎ ➏ Shows the name of the module to which this database will be assigned. Shows the name of the disk file into which this database will be stored. Shows the name of the resource type for this database. Enter a name for this new database. If this is a sequence, indicate whether or not to make this a control sequence. Refer to page 34 for more information about control sequences. Indicate the editing options for this database: • Disk and memory read-write means that the database can be edited and changes saved to disk. You must select this option to permanently add data to your database. • Memory read-write, disk read-only means that the database can be edited for the current session, but the changes will not be saved to disk. • Disk and memory read-only means that the database cannot be edited. Once a database has been created, the read-write options can be changed by performing: Module ➡ Select/Edit ➡ highlight module database is assigned to ➡ Edit ➡ highlight database ➡ Edit ➡ select edit option ➡ Done ➐ Choose when you have selected the desired options. Global Databases In all cases, except Location and Vision databases, there is a global database that can be used by a sequence when the sequence’s associated module does not specifically include its own copy of a database. For example, Module 2 from Figure 1-4 does not include a variable database. If a statement in the sequence associated with Module 2 requires a variable record, it comes from the global Variable database. 20 VisionWare User’s Guide, Rev. A Editing Records If a sequence needs location or vision records, that associated resource module must have a location or vision database among its resources. If the database is not in the resource module, you get a Required database not loaded error when attempting to complete statements that require location or vision records. Dual-Vision Systems and AIM Adept controllers are available with a dual-vision system option. If the second vision system is installed you can select a vision system to associate with a vision database. This selection is made when you add a vision resource to a module. If your module also includes a camera database, the vision system selected for all camera records must match the one selected for the vision database. You cannot access different vision systems from a single-vision database. You specify the vision system to access when you create the resource module component. If you want to share a global camera database from two (or more) different vision databases (which may each use a different vision system), specify the vision system on each record of the camera database and then ensure that the camera record references a particular vision database and has a matching vision system. If you make a mistake, you see warning signs and get linking errors. 1.7 Editing Records Selecting (Highlighting) MotionWare operations require you to select a menu item or a name in a scrolling list. To select a data box or an entry in a scrolling list, click once on the data box or the list item. The background of the selected item will turn a dark blue. After a data box is selected, text entered at the keyboard will be stored in the data box; existing text in the data box will be deleted. Use this procedure to use your mouse to select standard buttons, push buttons, radio buttons, and check boxes: • Press the TAB key to select successive items on a menu page. • SHIFT-TAB moves backward through the menu items. • Holding down the SHIFT key and pressing one of the cursor movement keys (key marked by ←, →, ↑, or ↓ arrows) moves through the menu items in an up/down or left/right manner. • When a standard button, radio button, push button, or check box is selected, pressing the ENTER key is the same as clicking that button. • When a standard button is selected, it turns dark blue. • A selected radio button is recessed and the outer ring is light blue. • A selected and chosen push button is recessed and the outer square is light blue. • A selected check box has a blue background. VisionWare User’s Guide, Rev. A 21 Chapter 1 - Getting Started Active/Inactive In many cases, menu items or menu page options are not active for the operation that you are currently performing. When this situation occurs, the item is inactive and appears dimmed (displayed as a light shade of gray). The Typing Cursor The typing cursor (a solid black square) indicates where keystrokes appear when entered. Characters typed at the keyboard are always entered to the left of the typing cursor. The BACKSPACE key deletes the character to the left of the cursor. The DELETE key deletes the character under the cursor. To set the typing cursor in a data box: • Click the data box once to select the data box. (Characters entered from the keyboard replace characters in the data box.) • Select a data box and click where you want to anchor the typing cursor. Characters entered from the keyboard are inserted to the right of the cursor. (Since many data boxes respond to being double clicked, this second click must be made after a short pause.) • The cursor can be moved within the data box by pressing the cursor-arrow keys. Existing text is not affected. Creating New Records To create a new record, pull down the Edit menu and choose a database such as Frame or Location. The database menu page is displayed. Press the NEW key (F2), or perform: Edit ➡ New Record Copying and Deleting Records To remove a record from the database, press the CUT key (SHIFT+F9) or perform: Edit ➡ Cut Record The currently displayed record will be cut from the database and placed in the copy buffer. To copy a record, press the COPY key (F9) or perform: Edit ➡ Copy Record Only one record is held in the copy buffer at-a-time. If a second record is cut or copied, the first record is lost. To paste or cut a record, press the PASTE key (F10) or perform: Edit ➡ Paste Record NOTE: When a copied record is pasted to a database, two records exist with the same name in the database. The new record should immediately be renamed to prevent duplicate record names. 22 VisionWare User’s Guide, Rev. A Editing Records When a sequence is run, record names are used in the linking process; duplicate record names may create problems. (An error message will be generated whenever a database has two records with the same name. One of the records should be deleted or renamed.) Selecting Different Records MotionWare provides several methods for moving between records in a database. The Seek menu item allows the following options: Option Definition Index A scrolling list of all records in the database is displayed. Select the desired record and either choose Goto or double click the desired record to go to that record. First (Home) Go to the first record in the database. Previous (Page Up) Go to the record immediately preceding the current one. Next (Page Down) Go to the next record in the database. Last (End) Go to the last record in the database. Find (Find-F7) The String window (see Figure 1-4) is displayed (a data box must be selected or an information box must be selected): When searching for a string, selecting ✔ Match any substring will cause MotionWare to find the specified text in any position (“and” would be found in “sandy”). To only find the word “and”, do not select the check box. When searching for a numeric value, enter a tolerance; any value that is within the tolerance will be found. For example, if 5 is the search string and the tolerance is 0.1, any values between 4.9 and 5.1 will be found. Choosing First searches all records in the database. Choosing Next searches from the next record to the last record in the database. The search is performed only on the selected field. VisionWare User’s Guide, Rev. A 23 Chapter 1 - Getting Started Option Definition Repeat Find (Repeat-F8) The last completed find operation is repeated (useful for locating duplicate record names). Figure 1-9 Searching for a Database Value Exiting Record Editing To exit the database editor, perform any of the following options: • Select a different item from the main menu bar. • Click the close icon in the upper left corner of the window. • Press the EXIT key.(F4) • Perform: Go ➡ Exit. Record-Editing Menu Bars and Quick Keys The record-editing menu bar is summarized in Appendix B. Quick keys can be used in lieu of menu selections; they are also summarized in Appendix B. 24 VisionWare User’s Guide, Rev. A Creating a New Vision Record 1.8 Creating a New Vision Record Before you can create vision records, there must be a selected resource module that contains a vision database. To create a new vision record: Edit ➡ Vision ➡ Edit ➡ New Record or Edit ➡ Vision ➡ F2 VisionWare has six types of records: Basic, Feature Finders, OCR, Computed Feature, General Tools, and Special Purpose records. The creation and use of the different records types is described in the following chapters and appendices. Figure 1-10 Creating a New Vision Record Only one record type can be selected (you cannot select one from each group). After you have entered a name for the new record and selected a record type, choose OK to create a new vision tool record and go to that record. To edit an existing record: Edit ➡ Vision ➡ Seek ➡ Index ➡ dbl clk record Remember, there may be several vision databases created for the various resource modules you have defined. However, you can edit only the vision records in the currently selected resource module. 1.9 Additional Record-Creation Aids In addition to the menus, VisionWare provides several other aids to creating vision records. The following table discusses additional record-creation aids. VisionWare User’s Guide, Rev. A 25 Chapter 1 - Getting Started Aid Description Double clicking Double clicking any empty data box that requires a VisionWare record displays a list of records that can be placed in the field. When the list is displayed, double click a record name to go to that record. Either choose Retrieve to place the record name in the data box or choose New to create a new record. A record name entered into a field on a menu page is referred to as a source record. The field in which the record is placed is referred to as a source field. Double clicking a data box that already contains a record name for its value takes you to that record. ! 26 This symbol (yellow on the screen) indicates that the record name you have entered does not exist, is the wrong type, or is not complete; it must be created or changed before the operation is usable. VisionWare User’s Guide, Rev. A The Vision Record Tree 1.10 The Vision Record Tree A complete vision inspection consists of several records. This strategy allows you to use the same tools in multiple inspections and to combine easily the results of several different inspections. To help you keep track of where you are in the inspection creation process, VisionWare provides a graphical tree that shows the interconnection between the records in an inspection. To display the record tree for an inspection: Module ➡ Select/Edit ➡ highlight resource module ➡ Select➡ Show ➡ Statement Tree Figure 1-11 shows an example of a vision record tree. Figure 1-11 Vision Record Tree Using the Vision Record Tree Each of the icons represents a different type of inspection record. Notice that at the top of the tree (like family trees, VisionWare trees grow upside down) is an Inspection record (represented by a magnifying glass). The other icons represent the different types of records required to accomplish the inspection specified by this inspection record. The following chapters will detail creation of inspection, camera, and picture records. The other record types will be introduced as the different types of inspections are detailed. All the different records are summarized in Appendixes D – G. VisionWare User’s Guide, Rev. A 27 Chapter 1 - Getting Started If a required record has not been defined, a question mark icon will be displayed. An inspection will not be executable if any required records are missing. Double clicking any of the icons in the tree takes you to the editing screen for that record, and you can make any desired changes. Clicking an icon once highlights that icon. Choose Snap to Top to move the highlighted record to the top of the tree. Choose Goto Root to display the top record in the tree at the top of the display. When a sub-tree is displayed (either because the tree is too large or you have moved a record other than the root to the top of the display), an arrow icon appears indicating that there are additional records in the tree. Clicking the arrow icon once displays the next higher or lower record in the tree. Choose Top Level to display the names of all the top-level records that have been defined. From this pick list: double click a record name or choose Goto to open that record; choose Goto to display the selected record as the top record in the tree display. ✼ Choose Exit to exit the record tree routine. You are not able to reselect database records until you have chosen the exit button, double clicked an icon, clicked the close icon, or made a top-level menu bar selection. Returning Values ✼ An important principle to remember about the tree structure is that each record in a tree passes information to the record above it. A camera record provides a picture record with a camera setup to use, a picture record provides a vision tool record with an image to use, a vision tool record provides the next record with some specific information about what it has found in the field of view, and so on. In this manual, we refer to this upward passing of information as returning a value. 1.11 Building and Executing Inspections There are several steps to building and running an inspection. This section summarizes the different steps and indicates the chapter sections that deal with each step. The steps are: 1. Build the Individual Inspections An individual inspection is composed of several records that tell the system which vision tools to use, where to put the tools, and how to evaluate the results. A basic inspection starts with a top-level inspection record that specifies one of several types of inspections that can be made. Chapter 4 describes building an inspection. The following chapters describe the different types of inspections that can be specified by an inspection record, and which additional records are required to implement the inspection operation. Appendixes D – G summarize the additional records used with the different types of inspections. 2. Build a Sequence of Inspections In most cases, a complete inspection of an object will involve several different inspections of the object. A complete inspection of a machined part might look at the diameters of several different holes, the alignment of the holes, the position of the holes in relation to the body of the part, etc. To perform these multiple inspections with VisionWare, you first build the individual inspections and then combine the individual inspections into an inspection sequence. Chapter 2 describes the use of the Sequence Editor to create a sequence of individual inspections. 28 VisionWare User’s Guide, Rev. A Access Levels 3. Specify the Input/Output Operations for the Sequence Chapter 12 details the input/output capabilities of VisionWare that allow you to interface VisionWare with the part delivery systems in your workcell. 4. Execute the Inspection Sequence Once the individual inspections have been built and combined into a sequence, you use the control panels to control execution of the sequence of inspections. Chapter 2 covers the Task and Master Control panels in detail. 1.12 Access Levels There are five access levels in VisionWare: Level 0 (Minimum Access) allows a user to log on to the system. Level 1 (System Operator) allows a user to run existing sequences. Level 2 (Hardware Maintenance) allows access for equipment repair. Level 3 (Manufacturing Engineer) allows creation of new sequences and vision records. Level 4 (System Customizer) allows complete access to the system, including the creation of new user accounts. The menu and menu page options that are not available to the currently logged-on level are dimmed (shown in a lighter shade of gray). When VisionWare starts, default access is level 4, which provides complete access to the system. If you are going to use the system security option, set it up before any further operations are undertaken. To change the start-up access level, perform: Setup Seek ➡ Initialization Database ➡ double click BASEINI ➡ Index ➡ double click ‘access level, initial’ In the Value data box, set the desired start-up access level. ! CAUTION: After changing this value, ensure that at least one user account with access level 3, or higher, remains in the accounts database. Otherwise, you will lock yourself out of level 3 and 4 menu items. Assigning Access Levels Your system administrator should set up initial access levels using the following procedure: 1. Create a new user account for the system administrator, and set the access level to 4. 2. Create user accounts for other system users. VisionWare User’s Guide, Rev. A 29 Chapter 1 - Getting Started Creating User Accounts Only persons with access level 4 can set up or edit user accounts. To add a user: 1. Perform Special ➡ Edit User Accounts ➡ Edit ➡ New Record. 2. Enter the user’s name in the User data box. 3. Enter the user’s password in the Password data box.1 4. Click the radio button corresponding to the access level for the user. 5. Exit by performing Go (F4). ➡ Exit, by clicking the close icon, or by pressing the EXIT key Editing User Accounts To edit a user account, perform: Special ➡ Edit User Accounts To change a user’s access level, perform: Seek ➡ Index ➡ select the user name ➡ Goto Click the new access level the user is to have. To delete a user account, perform: Seek Edit ➡ Index ➡ select the user name ➡ Goto ➡ Cut Record Logging On the System To log on as the current user: 1. Perform Utilities ➡ Set Access Level. 2. Enter your user name in the user name data box. 3. After a user name has been entered, the password data box is displayed. Enter your password in the password data box. 4. If log on is successful, the radio buttons next to the access levels you are authorized for will be selected and you can select a level to work at. 5. Exit by performing Go ➡ Exit or by pressing the EXIT key (F4). Logging Off the System To log off the system: 1. Perform Utilities 2. Select ➡ Set Access Level. Minimum access. 3. Exit by performing Go 1 ➡ Exit or by pressing the EXIT key (F4). Passwords can be up to six characters. They must begin with an alpha character and can include numeric characters, underscores, and periods. 30 VisionWare User’s Guide, Rev. A Access Levels NOTE: After a user has logged off, another login must be successfully completed before any further VisionWare operations can be completed. VisionWare User’s Guide, Rev. A 31 Sequence Creation and Execution 2 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.2 Sequences and Resource Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.3 Editing a Sequence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 2.4 What Are the Sources for Statement Arguments? . . . . . . . . . . . . . . . . . . . . 43 2.5 The Statement Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 2.6 Task Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 2.7 Debugging Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 2.8 Using AIM Tasks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.9 Master Control Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 2.10 Editing Sequence Records During Execution . . . . . . . . . . . . . . . . . . . . . . . 56 VisionWare User’s Guide, Rev. A 33 Chapter 2 - Sequence Creation and Execution 2.1 Introduction There are four primary steps to building a VisionWare workcell implementation: 1. Create a Resource Module that identifies the resources associated with a particular job. This process is described in Chapter 3. 2. Create records for all the items that are needed for the particular job. Creating these records is detailed in Chapters 4-6. 3. Create a sequence and add the statements that actually use these records to generate actions in the workcell. Creating a sequence is described in the next several sections. 4. Execute the sequence of statements. The control panels that are used to initiate, control, and debug sequences are described in sections 2.7 and 2.10. 2.2 Sequences and Resource Modules All sequences must belong to a Resource Module. The Resource Module determines which databases will be available to a sequence. Sequences will be available for editing only if they belong to the currently selected Resource Module. See Chapter 3 for details on creating and managing Resource Modules. Control Sequences One of the options available when adding a sequence to a module is to make it a control sequence. Control sequences manage other sequences and perform tasks such as loading, selecting, starting, and stopping operation sequences in the workcell. Control sequences lock out all operator input while they are being executed; and they cannot move the robot or access vision data. Consequently, you should set up control sequences so that they execute quickly. See Section 3.4 on page 67 for additional details. Creating a Sequence Sequences are created from the Module Utilities (see Chapter 3) or the sequence editor (see below). A sequence created from the Module Utilities will be assigned to the module you are currently editing. A sequence created from the sequence editor will be assigned to the currently selected module. 34 VisionWare User’s Guide, Rev. A Sequences and Resource Modules When you request a new sequence, the following window is displayed: ➋ ➊ ➍ ➌ ➎ ➏ Figure 2-1 New Sequence ➊ ➋ ➌ ➍ ➎ Shows the name of the module to which this sequence will be assigned. Shows the name of the disk file into which this sequence will be stored. Enter a name for this new sequence. Indicate whether this should be a control sequence (see page 34). Indicate the editing options for this sequence: • Disk and memory read-write means that the sequence can be edited and changes saved to disk. You must select this option when first creating a sequence. • Memory read-write, disk read-only means that the sequence can be edited for the current session but the changes will not be saved to disk. • Disk and memory read-only means that the sequence cannot be edited. Once a sequence has been created, the read-write options can be changed by performing: Module ➡ Select/Edit ➡ select module sequence is assigned to sequence ➡ Edit ➡ select edit option ➡ Done ➏ ➡ Edit ➡ select Choose when desired options have been selected. The Sequence Index Sequences can be created, deleted, or selected for editing from the Sequence Index. New sequences created from the Sequence Index will be assigned to the currently selected module. To display the Sequence Index from the main menu, perform: Edit ➡ Sequence To display the Sequence Index from the Sequence Editor menu, perform: Go ➡ Sequence Index VisionWare User’s Guide, Rev. A 35 Chapter 2 - Sequence Creation and Execution ➊ ➋ ➌ ➍ ➏ ➎ Figure 2-2 Sequence Index ➊ ➋ ➌ ➍ ➎ ➏ 36 Shows all the currently defined sequences and the module they are assigned to. A sequence is automatically loaded when its assigned module is loaded. Double-click a sequence to open the sequence editor. Loaded sequences are shown in black, unloaded sequences are dimmed, and the sequences in the selected module are blue. Choose to open the Sequence Editor and begin editing the selected sequence. Choose to create a new sequence. The window shown in Figure 2-1 is displayed. Choose to delete the selected sequence. Indicate which types of sequences should be displayed. Choose to exit the Sequence Index window. VisionWare User’s Guide, Rev. A Editing a Sequence 2.3 Editing a Sequence Before a sequence can be edited it must be created and loaded.When a new sequence is first opened in the Sequence Editor it appears as: Figure 2-3 Sequence Editor The bottom of the Sequence editor shows the module that is associated with this sequence, the name of the sequence, and the editing mode. Selecting a Statement Double click --statement-- (or perform Go ➡ Display Field Index), to display a list of available statements. Select the desired statement and choose Retrieve (or double click the desired statement). For example, if the statement MOVE had been selected, the sequence editor would look like the following: Statement Components In the above example: MOVE is the statement name. TO --location-- is a clause. --location-- is an argument. Completing a Statement Argument Double click the statement argument to display a list of available records that can be used to fulfill the statement argument. Select the desired record and either choose Retrieve or double click the argument to use that record as an argument to the statement. VisionWare User’s Guide, Rev. A 37 Chapter 2 - Sequence Creation and Execution For example, if place.loc had been selected, the sequence editor would look like: Adding a Sequence Line Sequence lines can be added either to the bottom of the sequence or above the current sequence line. (The current sequence line is the one with any argument or statement name selected.) To append a sequence line to the end of the sequence, press the Edit NEW key (F2) or perform: ➡ Append line To add a sequence line above the current statement line, press SHIFT + INSERT or perform: Edit ➡ Insert line If Insert line had been chosen, the Sequence Editor would look like: Completing Optional Statement Arguments Most statements will have both optional and required arguments. Optional arguments are not displayed until the statement line is expanded. To expand a statement, select the statement line and perform: Edit ➡ Expand (or double click the statement name) If a WAIT_FOR statement had been added to the above sequence, and then expanded, the sequence would look like the following: Optional Clauses Optional clauses are surrounded by brackets ({}). In the above example, PULSE is a nested clause (its brackets are enclosed within another set of brackets). In this case, the OUTPUT clause must be completed before the value in the PULSE clause will have any effect. Completing Constant Arguments In many cases, the argument requires a value or variable name rather than a record name. To complete this argument, select the argument and enter a value. Or double click the argument to display a list of keywords or variable records. See “What Are the Sources for Statement Arguments?” on page 43 for details on the sources for statement arguments. Double click the argument to display a list of keywords. 38 VisionWare User’s Guide, Rev. A Editing a Sequence Adding Comments to a Sequence Descriptive comment lines can be added to a sequence by first typing a semi-colon followed by a TAB. You can then enter up to 80 characters of descriptive text. A well documented sequence will be extremely helpful in debugging and updating your sequences. Removing Sequence Lines Sequence lines can be permanently removed from a sequence by selecting the line to be removed and then pressing CTRL + DELETE or performing: Edit ➡ Delete line Sequence lines can be made temporarily non-executable by disabling them. When a sequence line has been disabled, an asterisk will appear in front of the line, and the line will be ignored when the sequence is run. To disable a sequence line, select the line and then perform: Edit ➡ Disable (or double click the number next to the statement) If line 1 of the above sequence had been disabled, the sequence would look like the following: To remove the disable marker and make the statement line executable, select the disabled line and perform: Edit ➡ Disable (or double click the number next to the statement) Cutting, Copying, and Pasting Statement Lines To cut a sequence line and move it to another location in the sequence, select the line and press the CUT key (SHIFT+F9), or perform: Edit ➡ Cut Line The selected line will be removed from the sequence and the number 1 will be displayed in the lower right corner of the Sequence Editor. To paste the line to its new location, select the line below the paste location and press the PASTE key (F10), or perform: Edit ➡ Paste Line To copy a sequence line to another location in the sequence, select the line to be copied and press the COPY key (F9), or perform: Edit ➡ Copy Line The selected line is copied and the number 1 is displayed in the lower right corner of the Sequence Editor. VisionWare User’s Guide, Rev. A 39 Chapter 2 - Sequence Creation and Execution To paste the copied line, select the line below the paste location and press the PASTE key (F10), or perform: Edit ➡ Paste Line More than one line can be cut or copied at a time. Each time a line is cut or copied, it is placed in a copy buffer. The number of lines copied is shown in the lower right corner of the Sequence Editor. When Edit ➡ Paste Line is performed, the least recently copied or cut line is pasted above the current statement line. When Edit ➡ Paste All is performed, all the lines in the copy buffer are pasted above the current line. Copying Statement Lines Between Sequences Lines can also be pasted to different sequences. If you exit the sequence editor while there are still lines in the copy buffer, they will still be available for pasting the next time the editor is accessed. The lines will be available regardless of which sequence is selected for editing. Sequence Editor Special Keys The following special key assignments apply when the sequence editor is open: Special Key Purpose/Use NEW (F2) Add a new line to the end of the sequence. SAVE (SHIFT + F2) Display the Save All Modified Databases window. GOTO (F3) If --statement-- is selected, display the list of statements. If a statement argument that requires a keyword or variable is selected, display the list of keywords or variables. If an argument that requires a record name is selected and the argument has not been defined, display a list of record names; if the argument has been defined, goto the specified record. 40 VisionWare User’s Guide, Rev. A Editing a Sequence Special Key Purpose/Use RETRIEVE (SHIFT + F3) If you have opened a database editing page by double clicking a record argument (or by pressing F3), pressing RETRIEVE will return you to the sequence editor and complete the statement argument with the record you were editing. EXIT (F4) Close the sequence editor. DISPLAY (F5) If a statement argument is selected, display a list of keywords, variables, or record names. If --statement-- or a statement name is selected, display a list of available statements. UNDO (F6) Undo any editing changes made to the current field. FIND (F7) Open the find window. CHANGE (SHIFT + F7) Open the change window. REPEAT (F8) Repeat the most recent Find or Change operation. COPY (F9) Place a copy of the current statement in the copy buffer. CUT (SHIFT + F9) Remove the current statement and place it in the copy buffer. PASTE (F10) Paste the last line in the copy buffer above the current statement. PASTE ALL (SHIFT+F10) Paste all lines in the copy buffer above the current statement. EDIT (F11) Expand/contract the current statement. HOME Go to the first statement line. END Go to the last statement line. VisionWare User’s Guide, Rev. A 41 Chapter 2 - Sequence Creation and Execution Special Key Purpose/Use PG UP Go to the top line displayed in the sequence editor. PG DN Go to the last line displayed in the sequence editor. TAB Move to the next editable item in the statement. SHIFT + TAB Move to the previous editable item in statement. CTRL + DELETE Delete the current statement line. ESC Toggle the disabled statement marker. DELETE Delete the character under the typing cursor. CTRL + INS (On the numeric keypad) insert a statement line above the current line. ← Move the typing cursor left. → Move the typing cursor right. ↑ Move to the previous statement line. ↓ Move to the next statement line. Double clicking A statement name: expands/contracts the statement. A statement number: toggles the disabled marker. An undefined argument: displays the list. A defined keyword or variable: displays the list. A defined record name: opens record editing. A--statement--: displays the list of statements. 42 VisionWare User’s Guide, Rev. A What Are the Sources for Statement Arguments? Finding and Finding/Changing Statement Arguments The Find and Change options are useful for editing long sequences. To find a statement or argument name, press the FIND key (F7) or perform: Find ➡ Find setup and the first window shown in Figure 2-4 is displayed: Figure 2-4 Find and Change Windows Fill in the Enter name to find data box with the text you want to find. Click the up arrow to search from the current location to the top of the sequence. Click the down arrow to search from the current location to the bottom of the sequence. To repeat the last find operation, press the REPEAT key (F8) or perform: Find ➡ Repeat Find You can also search for statement or argument names and replace them with other key (SHIFT + F7) or perform: CHANGE Find ➡ Change Setup and the second window shown in Figure 2-4 is displayed. Fill in the Enter name to find data box with the text you want to find. Fill in the Enter replacement data box with the text to replace the found text with. Click the up arrow to search from the current location to the top of the sequence. Click the down arrow to search from the current location to the bottom of the sequence. To repeat the last find operation, press the REPEAT key (F8) or perform: Find 2.4 ➡ Repeat Change What Are the Sources for Statement Arguments? When you first bring a new statement into the sequence editor, each statement argument has a place holder identified by pairs of dashes (--argument--). These place holders let you know the legal sources for arguments to replace the place holder. The source may be a VisionWare User’s Guide, Rev. A 43 Chapter 2 - Sequence Creation and Execution database, special keywords, or values you enter directly. The following table describes the legal sources for the various placeholders. Table 2-1 Statement Argument Sources Place Holder Source --constant-- Record from the variable database specifying an integer constant. A integer value entered from the keyboard. --device-- Keyword from the list of devices. --event-- Keyword from list of pause-after keywords. --input-- Record from the variable database specifying an Input signal. Valid signal number entered from the keyboard (can be preceded by an optional “@”). --module-- Module name from list of defined modules. Module name entered from the keyboard. --opr-- Keyword from the list of arithmetic and relational operators. Legal operator entered from the keyboard. --output-- Record from the variable database specifying an Output signal. Valid output signal number entered from the keyboard (can be preceded by an optional “@”). --o_variable-- Record from the variable database that specifies an Output signal, V+ variable, or ai.ctl[] value. Valid output signal number entered from the keyboard (can be preceded by an optional “@”). --response-- Keyword from list of operator responses to paused sequence. --sequence-- Sequence from the list of sequences in the currently selected module. Sequence name entered from the keyboard. --string-- Character data entered from the keyboard. --task-- Keyword from list of task keywords. --uopr-- Keyword from the list of unary operators. Valid unary operator entered from the keyboard. --variable-- Record from the variable database. Numeric value (integer or real) entered from the keyboard. Digital signal (preceded by “@”). --vision-- Record from the vision database. --yes/no-- Keyword from “yes/no” keywords, default is “no” if omitted. 44 VisionWare User’s Guide, Rev. A The Statement Tree Avoiding Trouble With Statement Arguments When you enter a record name or value into a statement, the sequence editor checks the argument type and range, then it issues a warning if there is a problem. However, once the argument has been accepted, there are several possible changes you can make that result in error messages that show up at run time or when a sequence is linked. Some of the changes you might make that create errors are: • Changing the type of a variable record. • Deleting records used in a sequence. • Deleting or unloading databases or sequences that are referenced by a statement. • Removing digital I/O hardware that changes the valid range of I/O signal numbers. • If you want to explicitly enter a digital signal number in a --variable-- field, it must be preceded by the “@”, otherwise it is interpreted as a numeric value. For example, “IF 1001 THEN” is always true because 1001 is interpreted as a non-zero value. If you really want to refer to a digital signal, use “IF @1001 THEN”. 2.5 The Statement Tree The statement tree allows you to see the interconnection of various records that an executing statement will access. As you build VisionWare records you will notice that each record has an icon associated with it. The statement tree makes use of these icons to show the relationships among the records used by a statement. The statement tree is activated by performing: Show ➡ Statement Tree This menu option can be chosen at any time. The most recently selected sequence is shown on the statement-tree menu page. When the statement tree is first displayed, a yellow box surrounds the current record. VisionWare User’s Guide, Rev. A 45 Chapter 2 - Sequence Creation and Execution ➊ ➍ ➋ ➎ ➐ ➌ ➏ ➒ ➑ Figure 2-5 Sample Statement Tree Statement Tree Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ Shows the currently selected statement and its step number in the sequence. The selected argument indicates which argument tree is currently displayed. To display the tree for a different argument click the desired argument. Scroll through the statements in the sequence. Choose to edit the sequence. Shows the name of the sequence being displayed and the associated resource module. Choose this button to display the record tree for other sequences. Choose Exit to exit the statement tree display. Choose Go to Root to display the top argument record. (This option is meaningful only if there are more source records than are displayed at one time. Arrow buttons will indicate that there are records above or below the ones being displayed.) ➑ Choose Snap to Top to move the currently selected record to the top of the display. Choose Edit Record to open the menu editing page for the selected record. You can also edit a record by double clicking the record icon. 46 VisionWare User’s Guide, Rev. A The Statement Tree ➒ The first record shown is the actual argument to the statement. Records below the first record are source records which are records specified in the record for the next higher record in the argument tree. If a question mark appears below the icon, it means one of the following: • The statement requires another record, which was not specified. • A specified record name was not created. • A specified item was not loaded on startup. Double click any icon in the argument tree to go to the editing page for that record. Source Records Records are used either directly or indirectly by an executing sequence. The records used directly are specified as statement arguments. Records used indirectly are specified in a data box a record referenced by a statement. These records are referred to as source records. For example, a location record might have an associated reference frame. The frame record is never entered directly into a statement, but its data is accessed by a sequence based on the frame record that is directly referenced by the statement. The argument tree shows all the directly and indirectly referenced records in an argument. In Figure 2-5, the place.frame record is a source record for the sample record. VisionWare User’s Guide, Rev. A 47 Chapter 2 - Sequence Creation and Execution 2.6 Task Control Panel Once a sequence has been created, it can be selected for execution and its execution status monitored from the Task Control Panel. To display the Task Control Panel, perform: Execute ➡ Task Control Panel ➊ ➋ ➌ ➍ ➏ ➎ ➐ ➑ ➒ ➓ Figure 2-6 Task Control Panel 48 VisionWare User’s Guide, Rev. A Task Control Panel Task Control Panel Options The task control panel allows you to control the VisionWare tasks independently. See section 2.9 for details on using the Master Control Panel. ➊ ➋ ➌ ➍ ➎ This window shows the available VisionWare tasks. The selected sequence will be associated with the highlighted task. See Section 2.8 on page 54 for details on selecting tasks and associated sequences. The Task item indicates the V+ task number that the sequence will run in. Note: the options on the Task Control Panel apply only to the selected task. To view the status of other tasks, you must select that task. This area shows the current sequence, the module it is associated with and the step that is currently executing. Choose Stack to see the current status of CALL statements executed in the current task. Select ✔ Repeat to cause the currently selected sequence to loop repeatedly (the repeat option must be set for each sequence, you can have some sequences that repeat and some that do not). The Completed data box shows the number of cycles that have been completed. The Pause After options refer to places that a sequence pauses while performing debug operations: ✔ Immediate will cause an immediate pause in the sequence. ✔ Operation and ✔ Action are finer division in the execution of a statement and depend on exactly how the statement is defined. If ✔ Statement is selected, the sequence will pause after completion of each statement. If ✔ Repeat is selected and ✔ Cycle is selected, the sequence will pause after each completed cycle of the sequence. ➏ Choose Select to display a pick list of available sequences. Choose Start to begin execution of the sequence shown in item ➋ or to start a selected server task (see “Using AIM Tasks” on page 54). ✔ Walk Thru allows you to debug your sequences. It is described in section “Task Control Debug Options” on page 51. ➐ ➑ ➒ ➓ Displays messages that are generated during the debug modes (see section “Task Control Debug Options” on page 51). Click to display help for the current message. Shows the status of the currently selected sequence. Choose Edit to edit the record associated with the current error message (during debug operations). Choose Help to display help for the current error. Shows the last error that was generated by VisionWare. Click to display help for the current error. These buttons are used during debug operations and are described in “Task Control Debug Options” on page 51. Click the button label to display help for a button. VisionWare User’s Guide, Rev. A 49 Chapter 2 - Sequence Creation and Execution 2.7 Debugging Sequences Sequences may be run in debug mode from the Task Control Panel. There are two primary debug modes: walk-thru training and Pause After. Walk-thru training is primarily used to debug a single inspection; Pause After options are used to debug a sequence. When Walk-Thru training is enabled, Aim performs additional error checking and generates trace messages that describe the actions begin taken. It is useful in diagnosing problems because it may report error conditions that are normally ignored. Because Walk-Thru training mode is not as efficient as normal mode, it should be disabled for nondebugging situations when cycle time is important. When ✔ Edit All is selected, VisionWare pauses before each vision operation and allows the corresponding vision record to be edited. 50 VisionWare User’s Guide, Rev. A Debugging Sequences When a debug mode is selected, the Task Control Panel data appears similar to the following: ➊ ✔ ➋✔ ➌ ➍ ➎ ➏ ➐ Figure 2-7 Task Control Panel With Debug Options Task Control Debug Options ➊ Pause After enables you to determine when execution pauses. VisionWare User’s Guide, Rev. A 51 Chapter 2 - Sequence Creation and Execution The following table shows the status of the currently executing sequence: Selection Causes execution to pause after Immediate This option is selected Operation Each individual vision operation Action Each group of vision operations Statement The currently executing statement completes Cycle The currently executing cycle of the sequence completes (cycle refers to cycles of the main sequence and not to cycles of any sequences started with a CALL statement) A Pause-After option can be selected at any time prior to or during execution of a sequence; more than one pause point can be selected. Pauses-After Operation and Action depend on the design of each statement and, thus, do not have a rigid definition like pauses after Statement and Cycle. ➋ When ✔ Walk Thru is selected, the sequence displays if a vision operation fails. When ✔ Edit all is selected, the sequence pauses before every vision operation. ✔ Walk Thru must be selected before ✔ Edit All can be selected. ➌ ➍ ➎ This area displays information on the current statement activity. Clicking the Message panel displays the help page for any current message. This area shows the execution status of the task. The most common states are idle, running, and attention. Attention indicates that the sequence has paused for some reason. When a sequence has paused because of debug operation or error, choose Edit to open the record currently being evaluated in the sequence. You will be able to edit most (but not all) of the fields in the record. There are certain fields which must have legal values before the sequence can start, and they cannot be changed during sequence execution. If you attempt to edit one of these fields, an error message will be displayed advising you that the field cannot be edited. Choose Help to display help information associated with the current error, if any. ➏ 52 Displays the last error message generated by VisionWare. This might be an execution error or a message indicating why the sequence stopped during a debug operation. Clicking the Current Error panel displays the help page for any current message. VisionWare User’s Guide, Rev. A Debugging Sequences ➐ After a sequence has been paused, choose: Option Result Proceed Resume execution Retry Action Re-execute the action completed immediately before execution was paused Skip Action Skip the next action in the sequence Retry Statement Retry the entire statement being executed when the sequence paused Skip Statement Skip the statement being executed when the sequence paused Skip Cycle Skip the currently executing cycle of the sequence (aborts execution at the last cycle) Abort Execution Abort execution completely. NOTE: Only the appropriate options are displayed after a pause. Clicking the name of any option in this area displays help information on that option. NOTE: Fields in a vision record can be edited during run time only when the contents of the field is not needed for VisionWare’s pre-runtime operations. Thus, you may get a message indicating that you cannot edit some fields during debug operations. Activating Single-Step Execution It is often useful to execute an application one step at-a-time to discover where problems are occurring. To single step through a VisionWare sequence, select ✔ Statement in the Pause After group, to stop execution at the selected point. To resume execution or abort execution, choose one of the push buttons at the bottom of the Task Control Panel. To resume normal execution, deactivate any options selected from the Pause-After group. VisionWare User’s Guide, Rev. A 53 Chapter 2 - Sequence Creation and Execution 2.8 Using AIM Tasks AIM makes use of the V+ multitasking capability. It allows multiple programs to run concurrently to help your tasks run in the most efficient manner. AIM uses V+ tasks in three primary ways: V+ Tasks Use Front-end Tasks These tasks control the AIM environment; opening and closing windows, responding to menu choices, and managing the data bases and other operations required to run AIM. These tasks run automatically without any intervention on your part. User Tasks These tasks run sequences, and they are further divided into tasks that control a robot and tasks that do not control a robot. Server Tasks These tasks perform work required if certain Adept options are employed by your user tasks. How Do I Start A Task? Tasks are individually started and controlled. Start I/O Control tasks first, and start the vision tasks last. To start a task: 1. Select the task you want to start from the list box at the top of the Task Control Panel window. 2. Choose Select to display a list of available sequences. 3. Select the desired sequence. 4. Select ✔ Repeat if you want to execute multiple cycles of the sequence. 5. Choose Start to begin execution of the sequence. 6. Repeat the procedure for any other tasks you want to start. 2.9 Master Control Panel The Master Control Panel controls sequence execution. Each of the large buttons on the Master Control Panel will run a control sequence. You can edit these control sequences to perform whatever actions you desire. To display the Master Control Panel, perform: Execute 54 ➡ Master Control Panel VisionWare User’s Guide, Rev. A Master Control Panel ➊ ➋ ➑ ➌ ➍ ➎ ➏ ➐ Figure 2-8 Master Control Panel ➊ ➋ This area shows the current state of the entire AIM system such as idle, attention, and running. These buttons will execute the correspondingly named control sequence. You can create and edit these control sequences to perform whatever actions are desired. For example, choosing Start will execute the sequence “start”. This sequence could be edited to either start a sequence that has already been selected and loaded or load, select, and start a sequence. To use these buttons, there must be a loaded module named vwctl and a sequence in this module with the same name as the button. When a button is chosen, it will attempt to execute a sequence with the same name as the button. It expects the sequence to be in the vwctl module.1 See “Sequence Control Statements” on page 67 VisionWare User’s Guide, Rev. A 55 Chapter 2 - Sequence Creation and Execution for details on statements that can be used in control sequences. ➌ ➍ ➎ This area shows which runtime task is reporting an error (displayed in item ➏). Double clicking in this area will display the Task Control Panel. These buttons scroll through the various tasks that have paused and need attention. If the sequence has paused at an editable record, choose Edit to edit the record. Choose Help to get information on the current error message. ➏ ➐ ➑ This area shows the current error message, if any. Clicking this panel displays the help page for any current error. These buttons have the same options as when debugging a sequence, see “Debugging Sequences” on page 50. This area shows the current state of the runtime task indicated by ➌. 2.10 Editing Sequence Records During Execution The debug options can be activated or deactivated at any time prior to or during execution of a sequence. To activate the editing function for vision operations, select ✔ Walk thru and ✔ Edit all. The sequence stops at the first editable record. A message similar to: Proceed or edit: vision: sample.inspect is displayed. To edit the record, choose Edit ; VisionWare enters record editing mode with the proper record displayed. (Note: Not all fields in a record are editable during debug execution.) After you have completed editing of the record, perform Go ➡ Back from the record editing menu (or press SHIFT + F3) to return to the Task Control Panel. To execute the statement containing the edited record, choose the Proceed push button to execute the statement. To re-execute the statement, choose the Retry statement push button. These operations can be repeated until the record is properly edited. When you have completed editing of a given record, choose the Proceed push button to move to the next record in the sequence. If the sequence stops at a record you do not want to edit, choose the Proceed push button to continue execution. To return to normal sequence execution, deactivate the ✔ Walk thru and ✔ Edit All options. An executing sequence can be viewed in the sequence editor by performing: Edit ➡ Sequence The sequence displayed will be in read-only mode (read only will be indicated on the status line at the bottom of the sequence editor). You will not be able to add, delete, or change statements or statement arguments. 1 See the description of the vwini initialization databases (Table A-3 ) for details on how to change the module name associated with the Master Control Panel. 56 VisionWare User’s Guide, Rev. A VisionWare Statements 3 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 3.2 General VisionWare Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 INSPECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 INSPECT_LIST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 OCR_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 AUTO_BRIGHTNESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 PICTURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 MESSAGE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 SET_RESPONSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 3.3 Control Structure Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Using Expressions in Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Conditional and Looping Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 CALL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 RETURN Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 IF Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 END Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ELSE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 FOR Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 REPEAT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 WHILE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 EXIT_LOOP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 NEXT_LOOP Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 CASE Structure (Includes VALUE and ANY Statements) . . . . . . . . . . . 67 GOTO Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 SET Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.4 Sequence Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 LOAD Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 PAUSE_TASK Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 RESUME_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 SELECT_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 START_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 STOP_TASK Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 UNLOAD Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.5 The Variable Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 VisionWare User’s Guide, Rev. A 57 Chapter 3 - VisionWare Statements 3.1 Introduction There are several classes of VisionWare statements: • General VisionWare statements (detailed in this chapter): INSPECT INSPECT_LIST OCR_OUTPUT AUTO_BRIGHTNESS PICTURE MESSAGE SET_RESPONSE • VisionWare control structures (detailed in this chapter): CALL IF RETURN END ELSE REPEAT FOR WHILE NEXT_LOOP EXIT_LOOP SET • Digital I/O statements (detailed in Chapter 12): IO IO_LIST WAIT WAIT_FOR WAIT_UNTIL • Sequence Control Statements (detailed in this chapter): LOAD PAUSE_TASK RESUME_TASK SELECT_TASK START_TASK STOP_TASK UNLOAD 3.2 General VisionWare Statements See Chapter 2 for a description of how sequences are created and edited. See Section 2.5 for details on the source of statement arguments. INSPECT The INSPECT statement causes evaluation of up to eight inspection records. Records are evaluated until the first inspection fails, at which time execution stops and the 58 VisionWare User’s Guide, Rev. A General VisionWare Statements OK_SIGNAL is set to FALSE. If all inspections pass, then the OK_SIGNAL is set to TRUE. The syntax is: INSPECT OPERATION --vision-- {& --vision--} {& --vision--} {& --vision--} {& --vision--} {& --vision--} {& --vision--} {& --vision--}}}}}}} {OK_SIGNAL --output--} The --vision-- argument can be completed only with an Inspection record. An inspection record appears in the pick-list of available records only if ✔ TopLevel is selected in that record. The one required argument for the INSPECT statement is the first --vision-- argument (no brackets around the argument indicate it is a required argument). When this statement is executed, VisionWare will take all the necessary pictures and evaluate all the necessary records to generate the value that the inspection record is to evaluate. The success of the inspection is evaluated and (if defined) a digital output signal is set based on the success of the inspection. If ✔ Gather stats was selected in the inspection record, the values generated by the inspection are reported to the Inspection Results pages (see Chapter 11). The optional arguments ({--vision--}) also require a top level inspection record. Each of these records will be evaluated in the same manner as the required inspection record, with two exceptions. First, inspection records are evaluated left-to-right until an inspection fails. After an inspection fails, no more inspection records will be evaluated. Second, if an inspection fails, the entire statement will be considered to have failed and the digital I/O signal specified in {OK_SIGNAL--output--} will be set accordingly. INSPECT_LIST The syntax and operation of INSPECT_LIST is identical to INSPECT except that all specified inspection records are evaluated regardless of whether any inspection fails. OCR_OUTPUT The OCR_OPUTPUT statement is used in conjunction with an OCR Field record. See “OCR Field Records” on page 136 for details on creating an OCR Field record. The format for the OCR_OUTPUT statement is: OCR_OUTPUT FROM --vision-- {& --vision-- {& --vision-- {& --vision-- {& --vision-- {& --vision-- {& --vision-- {& --vision--}}}}}}} The statement will evaluate each specified vision argument and output the recognized text to a disk file or serial line. See “Logging Vision Results” on page 171 for details on opening a disk file or serial line. Unlike the INSPECT statement, the record selected to complete the --vision-- arguments for OCR_OUTPUT must be an OCR Field type record rather than an Inspection type record. ✔ TopLevel must be selected in the OCR Field record. If Full text recognition is selected, the recognized text will be output to the disk or serial line. If a verification option is selected, the expected text will be output to the serial line. AUTO_BRIGHTNESS This statement requires an inspection record that uses a window record. The specific operation in the inspection record should be average graylevel. The statement will attempt to maintain the average graylevel specified in the nominal data box by adjusting VisionWare User’s Guide, Rev. A 59 Chapter 3 - VisionWare Statements the OFFSET parameter in the picture record associated with the window record. The limits in the picture record will be used to set the OK_SIGNAL to FALSE if the average graylevel exceeds the limits. The --frequency-- argument specifies the number of cycles to wait before resetting the OFFSET. The syntax is: AUTO_BRIGHTNESS WITH --vision-- {AT_FREQUENCY --constant--} {OK_SIGNAL --OUTPUT--} PICTURE This statement simply calls for the evaluation of a picture record. This is useful and sometime necessary to force the ordering of pictures so as to allow the scheduler to set up things for overlapping picture taking. If pictures appear in a conditional situation in the sequence, then picture pre-taking is not possible. The order of the pictures in the sequence must be fixed and guaranteed. This statement simply calls for the evaluation of a picture record. This is useful and sometime necessary to force the ordering of pictures so as to allow the scheduler to set up things for overlapping picture taking. If pictures appear in a conditional situation in the sequence, then picture pre-taking is not possible. The order of the pictures in the sequence must be fixed and guaranteed. The syntax is: PICTURE --vision-✔ TopLevel must be selected in the picture record in order to appear in the pick lists of available records. MESSAGE This statement displays a message on the operator control panel. MESSAGE --variable-- {TEXT --string--} {0: --constant--} {1: --constant--} {2: --constant--} {3: --constant--} {4: --constant--} {5: --constant--} {6: --constant--} {RESPONSE --o_variable--} The MESSAGE --variable-- is a standard AIM error number (or variable record that specifies an error number), which is in the error database. The text specified in TEXT --string-- will be appended to this message and displayed on the task control panel. The --constant-- arguments correspond to the seven standard operator response buttons on the Task Control Panel. A value of 0 indicates that the corresponding button is not valid, a value of –1 indicates that the standard AIM labels should be applied to the button, and a value greater than 0 indicates the button label should be taken from the corresponding standard AIM message number in the error database. If any non-zero values are specified for these seven arguments, the sequence pauses until an operator response button is pressed and the number of the button pressed is returned in the RESPONSE variable. If all arguments are blank or 0, AIM handles errors in the normal fashion and does not wait for an operator response. SET_RESPONSE This statement allows an executing sequence to behave as if one of the operator response buttons had been pressed. The --variable-- should have a value of 0 to 6, 60 VisionWare User’s Guide, Rev. A Control Structure Statements corresponding to the 7 standard operator response buttons. If an invalid response code is received, an error is issued. The syntax is: SET_RESPONSE --variable-- 3.3 Control Structure Statements The statements in this section allow you to conditionally execute blocks of statements, loop repeatedly through blocks of statements, and start execution of other sequences. Using Expressions in Statements Several AIM statements allow expressions to be entered in their argument lists. For example, the SET statement, the IF statement, and the WHILE statement all accept expressions. AIM expressions are combinations of operators, variables, and constants. No parentheses are allowed, so the precedence of the operators determines the value of the expressions. The unary operators (“-”, “COM”, “NOT”) always have the highest precedence. Therefore, expressions like: NOT a AND b are evaluated as (NOT a) AND b. The binary operators each have their own precedence. Higher precedence means that the operations occur first. If operators have the same precedence, they are evaluated from left to right. Operators Precedence * / 10 + - 9 <> =< >= 8 == <> 7 BAND BAND_COM 6 BXOR 5 BOR BOR_COM 4 AND AND_NOT 3 XOR 2 VisionWare User’s Guide, Rev. A 61 Chapter 3 - VisionWare Statements Operators OR Precedence OR_NOT 1 For example, the expression: a > b AND c > d OR a+b < c is evaluated as: ((a > b) AND (c > d)) OR ((a+b) < c) Conditional and Looping Structures Conditional and looping structures allow you to specify under what conditions and how many times blocks of statements will execute. Conditional and looping structures may be very simple and straightforward or they can use complex arithmetic expressions and relational logic. The examples in the following sections present the most common uses of the various structures. A complete understanding of the complex ways that the structures can be used requires that you understand relational logic. (The V+ Language User’s Guide describes the basics of relational logic.) All the structures share the following common attributes: The block of statements that will be executed begins immediately after the structure statement and ends with an END statement. There must be an END statement for each control structure statement; multiple control structures cannot be ended with a single END statement. Structures may be nested within each other. The variables used in a looping statement (FOR, REPEAT) should never be changed by any statements within the loop. Also, during execution of the loop, any other programs that might have access to global variables used in the looping statement should not change those variables. In all computer systems, numbers are internally represented in binary format. This internal format may involve some rounding of the actual number since the internal representation may not exactly represent base 10 numbers. This internal representation can lead to unexpected behavior when comparing real values (such as 3.1467) since the displayed value of two numbers may be identical but their internal representation may be different. When using variables in statements that test for equality, use integer values to avoid this potential problem. CALL Statement The CALL statement allows you to call one sequence from within another sequence. When a CALL statement is encountered, the currently executing sequence (calling sequence) will suspend operation and the new sequence (called sequence) will begin. When the called sequence completes, the calling sequence will resume execution at the next statement line. Sequence calls can be nested; and a called sequence, itself, can call another sequence. The Stack button on the Task Control Panel will show you how many calls have been made and the point in the sequence that the calls were made. Only sequences in the assigned module can be executed using the CALL statement. 62 VisionWare User’s Guide, Rev. A Control Structure Statements RETURN Statement The RETURN statement causes the current sequence to stop executing as if the end of the sequence had been reached and all cycles had been completed. If this sequence was initiated by a CALL statement, the sequence which executed the CALL statement resumes execution at the statement following the CALL. If executed from the main sequence, the runtime task returns to idle state. The syntax is: RETURN IF Statement The IF statement allows you to conditionally execute a block of statements. The syntax is: IF {--uopr--} --variable-- {--opr-- --variable-{--opr-- --variable-- ... }...}}}}} To execute a block of statements if a variable has a certain value, specify the variable in the first --variable-- clause, select “==” as the first --opr--, and the required value as the second --variable--: IF x == 3 If you want to execute a block of statements based on the value of two variables, you could use one of the following statements: IF x == 3 AND y == 7 IF x == 3 OR y == 7 The first example executes the statement block if x has a value of 3 and y has a value of 7— both variables must have the indicated values. In the second example, if either variable has the indicated value, the statement block will execute. To create a conditional block that depends on the state of a digital signal, select a variable that has Input signal or Output signal selected: IF in_sig IF NOT in_sig In the first case, the statement block will execute if the signal is on. In the second case, it will execute if the signal is off. END Statement A statement block is terminated with an END statement. In the following sequence, the first statement will execute, statements 3 and 4 will execute only if x has a value of 7, and statement 6 will execute normally. 1. 2. 3. 4. 5. 6. STATEMENT one IF x == 7 STATEMENT three STATEMENT four END STATEMENT six VisionWare User’s Guide, Rev. A 63 Chapter 3 - VisionWare Statements ELSE Statement An ELSE statement is always used in conjunction with an IF statement. The ELSE statement specifies a block of statements to execute when the statements specified by the preceding IF statement are not executed. The ELSE statement can also specify conditions to control execution of statements within the ELSE block. The syntax of the ELSE statement is: ELSE {IF {--uopr--} --variable-- {--opr-- --variable-{--opr-- --variable-- ... }...}}}}} In the following example, statement 2 will execute if x has a value of 7 and statement 4 will execute if it has any other value: 1. IF x == 7 2. STATEMENT two 3. ELSE 4. STATEMENT four 5. END In the following example, statement 2 will execute if x == 7, and statement 4 will execute if x has any other value and y == 3. If both x and y do not have the specified values, neither statement will execute: 1. IF x == 7 2. STATEMENT two 3. ELSE IF y == 3 4. STATEMENT four 5. END FOR Statement The FOR statement allows you to execute a block of statements a specified number of times. FOR --o_variable-- = {--uopr--} --variable-- {--opr---variable--} TO {--uopr--} --variable-- {--opr-- --variable--} {STEP --constant--} FOR statements can become complex. Following are several examples beginning with simple FOR loops and proceeding to complicated FOR loops. The following example executes a block of code four times: FOR loop_var = 1 TO 4 In the above example, “loop_var” (which must be an AIM variable, V + variable or ai.ctl[] value in the Variable database) will increment once each time the loop is executed. If any other statements within the loop access the variable loop_var, the variable will have the value of the current cycle of the loop. You could make the FOR loop “count by twos” by including the STEP argument: FOR loop_var = 2 TO 4 STEP 2 The above example would execute twice with loop_var having the value of 2 and 4 during successive loops. 64 VisionWare User’s Guide, Rev. A Control Structure Statements You can count from a negative number by using the --uopr-- argument: FOR loop_var = –2 TO 4 STEP 2 Double clicking --uopr-- will give you the option of “-”, NOT, or COM. The “-” is the only selection that would normally be used in a FOR statement. You can also make the FOR statement count backwards by giving the STEP argument a negative value (note the relationship of the “=” and TO argument values): FOR loop_var = 4 TO -2 STEP -1 You can make the “=” and TO argument values rely on a calculation by using the --opr-- and --variable-- arguments: FOR loop_var = 4 * x TO -2 STEP -1 REPEAT Statement The REPEAT statement allows you to repeat a block of statements a given number of times. The arguments to REPEAT allow you to evaluate a complex expression when deciding how many times to repeat a block of statements. The syntax is: REPEAT {--uopr--} --variable-- {--opr-- --variable-{--opr-- --variable-- ... }...}}}} To simply repeat a block of statements a given number of times, specify that number for the first --variable--: REPEAT 4 To repeat a loop 4 times plus the value of the variable x, select “+” as --opr-- and the record x as the second --variable--: REPEAT 4 + x The block of statements included in a REPEAT loop is identified by an END statement. In the following example, statements 2 through 6 will be executed five times: 1. REPEAT 5 2. STATEMENT two 3. STATEMENT three 4. 5. END STATEMENT four WHILE Statement The WHILE control structure causes a block of statements to be indefinitely executed as long as the specified conditions are correct. The syntax for the WHILE statement is: WHILE {--uopr--} --variable-- {--opr-- --variable-{--opr-- --variable-- ... }...}}}} VisionWare User’s Guide, Rev. A 65 Chapter 3 - VisionWare Statements In the following example, statements 2 and 3 will execute only if signal in_sig1 is on or signal in_sig2 is off when statement 1 is encountered, and they will continue to execute as long as in_sig1 is on or in_sig2 is off: 1. WHILE in_sig1 OR_NOT in_sig2 2. STATEMENT two 3. STATEMENT three 4. END EXIT_LOOP Statement An EXIT_LOOP statement causes a REPEAT, FOR or WHILE loop to terminate and sequence execution to continue at the next statement following the END statement that closes the REPEAT or WHILE loop. The syntax for an EXIT_LOOP statement is: EXIT_LOOP {--constant--} This optional argument specifies the number of loops to exit. If an EXIT_LOOP is within a REPEAT loop that is nested within a WHILE loop, specifying 2 for the --constant-argument will result in terminating the execution of both loops. An EXIT_LOOP usually contains IF/END statements, which identify a condition that dictates when a loop should be exited early. In the following example, a REPEAT loop is started that will normally execute 10 times. Halfway through the loop, variable x is checked. If it has a value of 7, the repeat loop is exited and the sequence resumes execution at statement 8: 1. REPEAT 10 2. STATEMENT two 3. IF x == 7 4. EXIT_LOOP 5. END 6. STATEMENT six 7. END 8. STATEMENT eight NEXT_LOOP Statement The NEXT_LOOP statement is similar to the EXIT_LOOP statement, however, execution of the looping block is not canceled completely; only the current iteration of the loop is canceled. In the following example, if y is less then 10 when statement 4 is reached, the sequence will resume execution at statement 1: 1. REPEAT 10 2. STATEMENT two 3. IF y < 10 4. NEXT_LOOP 5. END 6. STATEMENT six 7. END 8. STATEMENT eight 66 VisionWare User’s Guide, Rev. A Sequence Control Statements CASE Structure (Includes VALUE and ANY Statements) The CASE structure is similar to the IF...THEN...ELSE statement except that it can conditionally execute any of several different blocks of code based on the value of a variable. A CASE structure is actually built from the CASE, VALUE, ANY, and END statements. In the following example, if the variable code has a value of 1, STATEMENT one will execute. If it has a value of 2, STATEMENT two will execute. If it has any other value, STATEMENT three will execute. 1. CASE code OF 2. VALUE 1: 3. STATEMENT one 4. VALUE 2: 5. STATEMENT two 6. ANY 7. STATEMENT three 8. END GOTO Statement The GOTO statement allows you to jump to any other labeled step in a sequence. You create a step label by typing any 15-character label on a line displaying the --statement-- place holder. The label must begin with a character and must not include any spaces. It can contain mixed alpha and numeric characters. the label must be terminated with a colon “:”. In the following example, if the variable check has a value of 7, a GOTO will be executed and execution will jump to line 15 of the sequence: 15. steplabel: . . . 20. IF check == 7 21. GOTO steplabel 22. END 23. SET Statement The SET statement allows you to assign a new value to a variable. The syntax is: SET --o_variable-- = {--uopr--} --variable-{--opr-- --variable-- {--opr-- --variable-{--opr-- --variable--{--opr-- --variable-- {--opr-- --variable-}}}}} The following example would result in var1 having the value of var2 + var3 - 12: SET var1 = var2 + var3 - 12 3.4 Sequence Control Statements The following statements allow you to control execution of your sequences. One of the primary uses of these statements is to load and execute all the sequences that are required for a particular operation. This allows users to start-up a complicated workcell by simply choosing a single button. VisionWare User’s Guide, Rev. A 67 Chapter 3 - VisionWare Statements Examples of control sequences are provided in the module vwctl. These sequences are associated with the buttons on the Master Control Panel. The sequences in vwctl give you examples of how to create control sequences that can be edited so that the buttons perform your custom operations. NOTE: You do not have to use these examples sequences to use the Master Control Panel buttons. Sequences with the same names can be created in your own modules. When that module is loaded, the buttons on the Master Control Panel will execute the corresponding sequence. For example, create a module named new, which contains the control sequence named proceed. Edit the record CONTROL SEQUENCE MODULE in the vwini initialization database and change it to new. Choosing Proceed on the Master Control Panel runs the sequence named proceed from the module named new. 1 LOAD Statement This statement loads a resource module and all its components. The syntax is: LOAD MODULE module PAUSE_TASK Statement The PAUSE_TASK statement performs the same operations as the Immediate, Operation, Action, Statement, and Cycle check boxes on the control panels. The syntax is: PAUSE_TASK --task-- {AFTER --event--} Double click --task-- to select a task name. (These are the same names that appear in the scrolling window on the Task Control Panel). For an immediate pause, leave the --event-- argument blank. To select other pauses, double click --event-- and the remaining pause options are displayed. Pauses after Operation and Action depend on the particular statement that is executing. RESUME_TASK Statement This statement restarts a task that has been paused with a PAUSE_TASK. It is equivalent to choosing the proceed/retry buttons on the control panels. The syntax is: RESUME_TASK --task-- {RESPONSE --response--} Double click --task-- to select a task name. (These are the same names as appear in the scrolling window on the Task Control Panel). To select proceed/retry options, double click --response-- and the options will be displayed. If --response-- is left blank, the response is the same as from the Proceed button. 1 You can also edit the definitions of the various buttons to specify which module you want to use for the control sequences (see the AIM Customizer’s Reference Guide). 68 VisionWare User’s Guide, Rev. A The Variable Database SELECT_TASK Statement The SELECT_TASK statement performs the same function as the Select button on the Task Control Panel. A sequence is assigned to a task for execution. If the task is not found, no error is reported. The syntax is: SELECT_TASK --task-- {MODULE --module--} {SEQUENCE --string--} Double click --task-- to select a task name. (These are the same names as appear in the scrolling window on the Task Control Panel). If --module-- is not specified, the module currently assigned to the task is used. If a module is specified, it must be loaded. START_TASK Statement The START_TASK statement begins execution of a task. If the task is not found, no error is reported. The syntax is: START_TASK --task-- STOP_TASK Statement The STOP_TASK statement stops the specified task. The syntax is: STOP_TASK --task-- {AFTER --event--} Double click --task-- to select a task name. (These are the same names as appear in the scrolling window on the Task Control Panel). For an immediate stop, leave the --event--argument blank. To select other pauses, double click --event-- and the remaining pause options are displayed. As from the control panel, pauses after Operation and Action depend on the particular statement that is executing. UNLOAD Statement The UNLOAD statement removes a loaded module from memory. If you attempt to unload a module that is assigned to some task, a warning message is displayed and the module is not unloaded. The syntax is: UNLOAD MODULE --module-- 3.5 The Variable Database Many AIM statements can use values from the variable database to complete their arguments. For example, the number of cycles that a REPEAT statement executes can be determined by a variable. There is a global variable database or there can be a variable database in the currently selected resource module. VisionWare User’s Guide, Rev. A 69 Chapter 3 - VisionWare Statements To access the variable database, perform: Edit ➡ Variables The following (or similar) screen is displayed: ➊ ➋ ➌ ➍ ➎ Figure 3-1 Variable Database Refer to Figure 3-1. ➊ ➋ ➌ Indicate if this record should belong to a group. This option is for convenience in sorting variables in the various pick lists (variables are sorted first by Group and then by record name). It does not affect the behavior of the variable. Enter a description of the variable, what it does, when it is changed, etc. For constants and input/output signals, enter the value. This value cannot be changed except by editing it from the variable record. For variables and ai.ctl[] values, displays the current value of this variable. Question marks indicate that the variable has not been defined. ➍ Select Integer constant to define a constant value that can only have an integer value, e.g., 112. Real constant to define a constant value that can only have an real value, e.g, Select 12.635. In this case, the real value is typed into the name field ➊. Input signal to define an input signal. This value must represent a valid, Select installed digital input signal, e.g., 1003. Output signal to define an output signal. This value must represent a valid, Select installed digital output signal, e.g., 7. AIM variable to define a real variable that can be changed by an executing Select AIM sequence. 70 VisionWare User’s Guide, Rev. A The Variable Database Select V+ variable to define a real variable that can be changed by an executing V+ program. ai.ctl[] value to define a real variable that accesses the special AIM control Select values. See the AIM Customizer’s Reference Guide. ➎ This area defines which sequences will have access to the variable (known as variable scope). If the record being edited is in the global variable database, this area will only Global option. This variable can be accessed by all sequences found in display the resource modules that do not contain variable databases. If the record being accessed is in a variable database which is part of a resource to a module, the variable can be: Local to module Variable accessible by all sequences in the module. Local to sequence Variable accessible only by a specific sequence. VisionWare User’s Guide, Rev. A 71 Building Inspections 4 4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 4.2 Inspection Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 4.3 Inspection Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Pass/Fail Criteria for Numeric Values. . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Pass/Fail Criteria for Boolean Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.4 Picture Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.5 Picture Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 4.6 Camera Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.7 Camera Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 4.8 Calibrating a Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 4.9 Camera Calibration Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Method 1: Adept Calibration Sheet. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Method 2: Square of Know Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . 86 Method 3: Circle of Known Radius . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Method 4: Solid Bar of Known Width . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Method 5: Specify mm/pixel Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Calibration Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 VisionWare User’s Guide, Rev. A 73 Chapter 4 - Building Inspections 4.1 Introduction A complete inspection operation is made up of several records. Each record gives the toplevel inspection a specific piece of information needed to generate the pass-fail conditions for the inspection. The minimum number of records required for an inspection operation is four. These four records are: Inspection This is the top-level record for the inspection. It tells the system what type of inspection is being made and specifies the pass/fail limits for the inspection. The name of this record is the name you will use in the INSPECT statement when a sequence of inspection operations is created. Vision Tool This record specifies vision tools that will do the work required by the top-level inspection record. There may be several vision tool records for a single inspection. Picture This record specifies parameters that control the contrast levels when a picture is taken. These values can be set automatically when you create this record. Every vision tool record references a picture record. Camera This record specifies the physical camera to use when a picture is taken. The record also contains calibration information that relates the vision image to real-world coordinates. Each picture record references a camera record. When you run a sequence, the vision records that make up each inspection operation takes the required pictures, places the necessary vision tools, and reports the results to the top-level inspection record. The top-level inspection record calculates the success of the inspection and report the results. Chapter 11 describes the Inspection Results menu page. The inspection results page summarizes the results from the different inspections performed during sequence execution. Section 1.3 provides an overview of the menu page features that are common to all vision records. Some important principles to bear in mind while creating records are: • A record can be used by more than one inspection. For example, a circle finder record might be used both to check the diameter of the circle and to provide the starting point for a measurement. Picture records in particular are often shared by many vision tool records. • Name records carefully. Relate the records to what they physically do. Name point finders that locate the corners of an object, to “Up_left_cor”, instead of “Pt1”. • As you build an inspection operation, remember that in many cases, entries in the data boxes of the current record will themselves be the names of other vision records. (These records are referred to as source records.) If you enter the name of a nonexistent record in a source field, VisionWare will display a pop-up window indicating that the record does not exist and ask you if you want to create a new record. • The camera and picture records for the currently displayed image become defaults for any new vision tool records. 74 VisionWare User’s Guide, Rev. A Introduction • As you build inspections, the data records that you create will become very valuable and should be backed up. See “The Backup and Restore Utility” on page 215 for details on backing up the data generated as you build inspections. • To edit an existing vision record: Edit ➡ Vision ➡ Seek ➡ Index ➡ double click record • All the vision record types available to VisionWare are described in Appendixes D–G. VisionWare User’s Guide, Rev. A 75 Chapter 4 - Building Inspections 4.2 Inspection Records Figure 4-1 shows a top-level inspection record. Its name will be the one you use when building inspection sequences. This record receives the results generated by the other records associated with this inspection record, evaluates the success of the inspection, and reports the results. To create a new inspection record: ➡ Vision ➡ Edit ➡ New Record ➡ enter record name · ➡ OK Edit ➋ ➊ ✔ ➌ ➍ ➎ ➐ ➏ ➑ ➒ ➓ Figure 4-1 Inspection Record 76 VisionWare User’s Guide, Rev. A Inspection Inspection Record Options 4.3 ➊ ➋ ➌ ➍ Inspection Record Options Shows the name of the record you are editing, and the date and time it was last altered. The record name can be changed at any time, but any sequences that use the old record name can no longer find the record. Select this option if you want this record to appear in the list of inspections available when Top Level is chosen in the vision tree window. Selecting this option also makes this record available when completing statement arguments during sequence editing. Select the type of inspection you want to make. The inspection types and specific operations are described in the next three chapters, and are summarized in . After an operation is selected, data box(es) for the required records are displayed in this area. Choose this button to display the available operations (based on the selection from item ➌ and the vision tool record selected). The different operations that appear in this group are described in the following chapters. If ✔ Error if the Result is FAIL is selected and the inspection result is “fail”, the system will return an error during sequence execution. If ✔ Error if a source "not found" is selected and a source record fails to find a feature, the system will return an error during sequence execution. If these items are not selected, no error is reported in these situations. If an INSPECT_LIST or INSPECT statement encounters an error, sequence execution will halt. ➎ ➏ ➐ ➑ ➒ ➓ After you select an inspection type, and a specific operation for that type of inspection, you must create several other records to actually perform the inspection. The value generated by these inspections is displayed in the Value information box. The result of the inspection is shown in the Result information box. The pass/fail criteria for inspections that return numeric values are set by choosing Limits (item ➐). See “Pass/Fail Criteria for Boolean Values” on page 79 for details on setting pass/fail criteria for inspections that return Boolean (true/false) results. In the Nominal data box, enter the ideal value this inspection should have. The Deviation information box shows the difference between this ideal value and the one reported in the Value data box (item ➎). Choose this button to set the minimum, maximum, and warning limits for the inspection (see “Pass/Fail Criteria for Numeric Values” on page 77). Select this option to specify a digital output signal that is set based on the success of the inspection. Digital I/O is covered in Chapter 12. Select this option and the results are reported to the Inspection Results page when a sequence containing this top-level inspection is run ( ✔ Gather stats must be selected on the inspection results page). The number entered into Bin size is used in the statistical calculations when vision results are displayed (see ). Select the desired data logging for this inspection (). Pass/Fail Criteria for Numeric Values To set the minimum, maximum, and warning limits for inspection results returning numeric values, choose Limits . The following pop-up menu page is displayed: VisionWare User’s Guide, Rev. A 77 Chapter 4 - Building Inspections ➊ ➋ ➌ ➍ ➎ Figure 4-2 Inspection Limits and Results ➊ ➋ 78 Enter the pass/fail criteria for this inspection: Criteria Meaning Maximum limit If the value returned exceeds this value, the inspection will fail. High warning limit If the value returned exceeds this value, a high warning will be recorded and the high warning output signal will be set. Nominal value Enter the ideal value for this inspection. The returned value will be compared with this value and the difference will be reported as the deviation (on the main inspection page). Low warning limit If the value returned is below this value, a low warning will be recorded and the low warning output signal will be set. Minimum limits If the value returned is below this value, the inspection will fail. Enter the warning output signals for this inspection: VisionWare User’s Guide, Rev. A Inspection Record Options Signal Meaning High warning This signal is asserted (set to the indicated condition) when the high warning limit is exceeded, otherwise it is de-asserted. Pass/fail (specified on the main inspection page) This signal is asserted when the inspection passes. It is de-asserted when the inspection fails. Low warning This signal is asserted when the low warning limit is exceeded, otherwise it is de-asserted. The high and low warning may use the same signal number, in which cas either limit asserts the signal. ➌ ➍ ➎ Choose this button to execute a test run of this inspection. The inspection is executed repeatedly until Stop is chosen. Inspection statistics are gathered and reported in the Latest Test Run group (item ➍). This group shows the statistical results from the most recent test run of the inspection. Choose Done to return to the main inspection record menu page. Pass/Fail Criteria for Boolean Values If an inspection operation that returns a boolean result is selected, the Results group of the inspection record changes to: Figure 4-3 Pass/Fail Criteria for Boolean Inspections In the Expected value data box, enter the result (true or false) that indicates the inspection has passed. In many cases, you will find that FALSE is the desired result for passing an inspection. For example, you might use a finder tool to look for flaws on a part. If no flaw is found, the tool will return a false result indicating that no flaws were found and, therefore, the inspection should pass. Other items in this group are the same as inspections returning a numeric result. VisionWare User’s Guide, Rev. A 79 Chapter 4 - Building Inspections 4.4 Picture Records Picture records specify the contrast parameters and I/O conditions used when taking a picture. All vision tool records require a picture record. To create a new picture record: Edit ➡ Vision ➡ OK ➡ Edit ➡ New Record ➡ enter picture record name ➡ ➋ ➊ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure 4-4 Picture Record 80 VisionWare User’s Guide, Rev. A Picture Picture Record Options 4.5 ➊ ➋ ➌ ➍ ➎ Picture Record Options Shows the name of the record you are editing, and the date and time it was created or last altered. The record name can be changed, but any vision tool records that use the old name can no longer find the record. Select this item if you want this record to appear in the list of records available when Top Level is chosen in the vision tree window. Selecting this item also makes this record available when completing statement arguments during sequence editing. This option is useful only if you plan to use the PICTURE statement in your sequence. Select a camera record to be associated with this picture record. The camera record specifies the camera settings and calibration that will be used when an image is acquired. Calibration information from this camera is displayed at the bottom of the window. Choose this button to start repetitive image acquisition. This option takes into account the selections in the Modes of Operation group, allowing you to test any I/O options. Select Wait for I/O signal if (during sequence execution) you want new image acquisition to wait until a specified digital signal is set to the correct state. A data box will be displayed requesting a digital input or soft signal number. Digital I/O is described in Chapter 12. Select Wait for external trigger if image-acquisition hardware should wait for an external hardware trigger. External triggers must be configured using the controller software configuration utility CONFIG_C. See the Instructions for Adept Utility Programs. External triggers eliminate the slight delay that might occur with normal digital I/O. ➏ Select ✔ Output I/O signal if you want a digital signal set after a picture is taken.1 The Motion items are used only by motion systems. Refer to the MotionWare User’s Guide for details. ➐ ➑ ➒ ➓ 1 Select this option if you want the image-acquisition hardware to generate a strobe signal whenever a new image is acquired. The strobe signal will be sent to the camera specified in option ➌. You may use the strobe signal to latch belt or robot encoders in a motion system, or to trigger a strobe light. Choose this button to display a graph of the graylevel value distribution. A graph will be displayed showing the frequency of each graylevel value in the current image. Choose Auto-set to automatically set the gain and offset parameters. Use the slide bars to fine-tune the parameters. The actual parameter values are shown in the data box next to the parameter name. Gain and offset are explained in Chapter 13. Choose Auto-set to automatically set the binary threshold. The actual parameter values are shown in the data box next to the parameter name. Use the slide bars to fine tune the parameters. Threshold and 2nd threshold are explained in Chapter 13. This signal is set as soon as the picture is taken: it does not wait for image processing to complete. VisionWare User’s Guide, Rev. A 81 Chapter 4 - Building Inspections 4.6 Camera Records Camera records specify the physical camera to use, the camera model, various other camera characteristics, and the camera calibration data (camera calibration is actually performed using a camera calibration record from the vision database). All picture records require a camera record. To create a new camera record: Edit ➡ Camera ➡ Edit ➡ New Record ➡ Enter record name ➡ OK ➊ ➋ ➌ ➍ ➎ ➐ ➏ ➑ ➒ ➓ Figure 4-5 Camera Record 4.7 ➊ 82 Camera Record Options If you have a dual-vision system, this record must be associated with one of the vision systems, select vision system 1 or 2. Choose Live Video to display current camera output in the vision window. If the camera is a member of a module, you can VisionWare User’s Guide, Rev. A Camera Record Options select only the vision system that matches the vision database and vision system in the module-edit utility. Choose Snap a Picture to acquire a new image. ➋ ➌ Specify the physical camera to use and the camera model that describes the physical camera. Choose Select to display a list of defined camera models. If your camera is not in the list of standard cameras, you can define new camera models in the “visini” initialization database. Specify the resolution to use. The half-rez option uses every other line of camera data. For many operations this provides ample resolution and provides significant speed increases. If your application requires maximum speed, consider using the half-rez option. Note: all vision tools in a single sequence must use the same resolution option. If your camera supports a shutter mode, specify the type of shuttering required. Synchronous shuttering will occur at the beginning of the video scan, regardless of when the strobe signal is received. This option maximizes picture quality. Asynchronous shuttering will occur as soon as the signal is received. This option minimizes latency from strobe signal to image acquisition. Note: your camera must support this feature. ➍ ➎ ➏ ➐ ➑ ➒ ➓ These options are available when a robot related camera is specified. They indicated which motion device and conveyor to use with this camera and, for arm mounted cameras, the link on which the camera is mounted. This option allows you to use the perspective distortion correction option. If cameras are not mounted with their imaging surface parallel to the surface being viewed, the image will display perspective distortion. This option defines a transformation that corrects for this distortion. Note: for arm mounted cameras, the camera will sweep a surface area. This area must be equidistant from the camera in order to use perspective correction. This area shows the basic camera calibration that relates the distances in the field-ofview to camera pixels. Choose to display the matrix that defines the correction for perspective distortion. If this camera is associated with a motion device, this area shows the transformation that relates the robot coordinate system with the field-of-view. If this camera is associated with a motion device, the system must know whether the camera points up or down with relation to the Z-axis of the motion device world coordinate system. These buttons allow you to import/export calibration files in the format used by the Adept Advanced Calibration program. VisionWare User’s Guide, Rev. A 83 Chapter 4 - Building Inspections 4.8 Calibrating a Camera In order to calibrate a camera you must first create a picture and camera record that define the camera and image parameters you want to use for calibration. VisionWare includes a pre-defined global camera database that contains definitions for standard camera calibrations. It also includes a resource module named vcalvw that contains sample vision calibration records that reference the global camera database. You can use these standard databases in several different ways: 1. Load and select resource module vcalvw and use it to perform your camera calibrations and store the data in the global camera database. Omit the camera database from your custom resource modules so that you access the global one. 2. Import the global camera database (named VCAMVW.DB) and the sample vision database (named VCALVW.VI) into your custom resource module. The camera calibration affects only that module. 3. Copy and Paste individual records from the global camera database and the vcalvw vision database to your custom databases. To better understand how camera calibration works, or to define your own calibrations from the beginning, read the sections that follow. You create a camera calibration record by performing: Edit ➡ Vision ➡ Edit ➡ New Record ➡ enter calib record name ➡ Calibration Record Types ➡ dbl clk “camera-only Calibration” ➡ OK 84 VisionWare User’s Guide, Rev. A Camera Calibration Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ Figure 4-6 Camera Calibration Record 4.9 Camera Calibration Options There are two types of camera calibration, stand-alone and robot related. In stand-alone calibration the camera is mounted at a fixed location and is used to make inspections only, it does not provide guidance for a robot. The calibration options for stand-alone calibration are covered in the following sections. Robot related calibration, which provides for robot guidance as well as inspection, is covered in the MotionWare User’s Guide. ✼ Before beginning camera calibration, make sure the camera is permanently mounted. Whenever the camera-to-object distance is changed or the lens is refocused, the camera needs to be recalibrated. VisionWare User’s Guide, Rev. A 85 Chapter 4 - Building Inspections ➊ ➋ Shows the name of the record you are editing and the date and time it was created or last altered. It also shows the vision system selected in the camera record. This area shows the camera and picture records associate with this calibration record. Choose Goto to display the associated record. ➌ ➍ ➎ ➏ From this area, select the calibration method you want to use. The different calibration methods are described in the following sections. This area will change depending on the calibration method selected. This area shows the basic camera options selected in the camera record. Choose Set Cal to Default to return the calibration to the default 1 pixel per millimeter values. Choose Undo Last Calib to return the calibration to the previous values. Choose Calibrate to begin the calibration process. ➐ This area shows the calibration results. Method 1: Adept Calibration Sheet This calibration option requires the calibration target provided by Adept, a series of nested squares.1 The steps are: 1. Create a camera record that defines the camera you want to calibrate. Be sure to select ✔ Use perspective correction if you want perspective correction calculated during calibration. 2. Create a picture record that uses the camera record created in step 1 as its source record. 3. Create a camera calibration record that use the picture record created in step 2 as its source record. 4. Select Adept Calibration Sheet (nested squares). 5. Move the calibration tool until it is just larger than the largest square that can be completely seen in the window. 6. Select a light or dark object color depending on whether you want to use white or black squares. 7. Select the edge strength used for the locating the edges of the square (you can normally use the default unless the system tells you that is cannot find the edges). 8. Choose Calibrate . 9. If you selected perspective calibration, the perspective result is displayed. Method 2: Square of Know Dimensions To calibrate a camera you must have a square of known dimensions. The square must be smaller than the field of view. Make sure the square is truly square, all four sides are the 1 This target is specially made to produce uniform, precision results. Copies of this target do not provide accurate results. 86 VisionWare User’s Guide, Rev. A Camera Calibration Options exact same size, and they meet at 90° angles. Camera calibration will be only as accurate as your calibration square (particularly for small fields of view). To calibrate a camera: 1. Complete steps 1 - 3 as in “Method 1: Adept Calibration Sheet”. 2. Select Square of known dimensions. 3. A calibration tool will be displayed in the vision window. Center your calibration square in the calibration tool. Use the drag handles on the calibration tool to size the tool until it just encompasses your calibration square. 4. Enter the size of the square. 5. Select a light or dark object color depending on the color of your square. 6. Select the edge strength used for the locating the edges of the square (you can normally use the default unless the system tells you that is cannot find the edges). 7. Choose Calibrate . Four line finders will be placed around the calibration square and the vision window should look like Figure 4-7. (If you get a message indicating the edges of the calibration square could not be found, resize the calibration tool until it more closely fits the calibration square.) 8. If you selected perspective calibration, the perspective results is displayed. Figure 4-7 Camera Calibration Method 3: Circle of Known Radius This calibration is identical to method 2, except you use a circle of known dimensions. Make sure that this circle is truly round (equal radii at all points). VisionWare User’s Guide, Rev. A 87 Chapter 4 - Building Inspections Method 4: Solid Bar of Known Width This calibration is similar to method 2 except you use a bar of known length. This calibration option does not supply sufficient information to perform perspective calibration. Method 5: Specify mm/pixel Ratio This method assumes that you have derived the mm/pixel ratio and need only enter that value. Entered the known mm/pixel ration in the Known dimension data box and choose Calibrate . The moving point shows the X and Y location of the dot in the vision window. The point is in pixels. Moving the dot around can help you verify the calibration you entered. Calibration Hints Make sure the camera is permanently fixed before you begin calibration. Whenever the camera-to-object distance changes, the camera has to be recalibrated. If pictures are being taken at different camera-to-object distances, a camera record must be created for each camera-to-object distance. After you complete calibration, the camera focus should not be changed because it might invalidate the calibration. Prototypes, templates, and OCR font records are dependent on a specific camera calibration. If the calibration changes, the models may no longer be accurate. Prototype finder, OCR Field, and Correlation Window records must use the same camera record as their referenced model record. For example, if OCR Field record ocr.ver uses the OCR font record font_1, both records must use the same camera record. (Use the same picture record to ensure the camera record is correct.) Camera calibration must be completed before the vision tools that make distance measurements can return accurate absolute measurements. If you change your camera calibration, you may need to reposition your vision tools. 88 VisionWare User’s Guide, Rev. A Record Classes 5.1 5.2 5.3 5.4 5 Why Are Record Classes Important? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 What are the Record Classes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Records That Return Cartesian Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Records in the Test-a-Value Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 VisionWare User’s Guide, Rev. A 89 Chapter 5 - Record Classes 5.1 Why Are Record Classes Important? The class that a record type belongs to determines where it can be used in VisionWare operations. For example, the inspection operation that measures the distance between two points requires two point class records. The tables in this chapter summarize what records belong to each class and what results the record returns that make it a member of a particular class. 5.2 What are the Record Classes? Many vision record types return Cartesian or geometric values based on what they find in the field of view. Depending on which values the record returns, the record type belongs to one or more of the following record classes: • Point Class • Line Class • Vision Frame Class • Circle Class • Test-a-Value Class Records can belong to multiple classes. For example, an arc ruler belongs to the point, frame, and test-a-value classes. 90 VisionWare User’s Guide, Rev. A Records That Return Cartesian Results 5.3 Records That Return Cartesian Results Table 5-1 Records Returning Point Values (Point-Class Records) Record Type Point Returned Point Finder The first point found Linear and Arc Rulers The edge detected (selectable from the ruler record) Computed Points The point computed Computed Circle or Arc Center of the computed feature Arc/circle Finder The center of the found arc/circle Computed Frame The origin of the computed frame Blob Finder The centroid of the found blob Prototype Finder The centroid of the found prototype Frame Pattern The origin of the frame Correlation Window The center of the area matching the correlation template Conditional Frame The origin of the frame Line finder The nearest point on the found line to the search line Table 5-2 Records Returning Line Values (Line-Class Records) Record Type Line Returned Line Finder The found line Computed Line The line computed Computed Frame The X axis of the frame Blob Finder A line through the centroid of the blob (The orientation is selected in the finder record.) Prototype Finder The X axis of the frame created when the prototype was trained Frame Pattern The frame X axis (see Chapter 10) Conditional Frame The frame X axis Arc ruler The line through the center and the Nth point VisionWare User’s Guide, Rev. A 91 Chapter 5 - Record Classes Table 5-3 Records Returning Circle Values (Circle-Class Records) Record Type Circle Returned Arc/circle Finder The found circle Computed Circle The computed circle Table 5-4 Records Returning Vision Frame Values (Vision-Frame Class Records) Record Type Frame Returned Computed Frame The computed frame Blob Finder Origin at blob centroid. Orientation varies depending on selections made from the Orientation group in the blob finder record Prototype Finder Based on frame of trained prototype Arc Ruler Origin at a detected edge (selectable in ruler record). X axis goes from arc center through first edge found. Linear Ruler Origin at a detected edge (selectable in ruler record). Orientation is the same as the ruler tool. Frame Pattern Current instance of frame (see Chapter 10) Point Finder Origin at the found point. Orientation is the same as the point finder reference frame. Computed Point Origin at the computed point. Orientation is the same as the computed point reference frame. Arc/circle Finder Origin at the center of found arc. Orientation is the same as the arc finder reference frame. Computed Circle Origin at the center of computed circle. Orientation is zero. Correlation Window Origin at the center of the matched area. Orientation is zero. Conditional Frame The source frame plus offsets 92 VisionWare User’s Guide, Rev. A Records in the Test-a-Value Class 5.4 Records in the Test-a-Value Class The following record types return testable results. See Appendix F for details on the values that are returned by each record type. Table 5-5 Test-a-Value Class Records Record Type Inspection Computed Line Ruler Arc Ruler Window Point Finder Line Finder Circle Finder Blob Finder OCR Field Prototype Finder Value Combination Correlation Window Conditional Frame VisionWare User’s Guide, Rev. A 93 Measurements 6 6.1 What Types of Measurements Can Be Made? . . . . . . . . . . . . . . . . . . . . . . . 96 6.2 Measuring the Distance Between Two Points . . . . . . . . . . . . . . . . . . . . . . . 97 Tutorial: Measuring a Point-to-Point Distance . . . . . . . . . . . . . . . . . . . . 98 Create the Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Add an Inspect Statement to a Sequence . . . . . . . . . . . . . . . . . . . . . . 100 6.3 Measuring the Distance From a Point to a Line . . . . . . . . . . . . . . . . . . . . . 101 Tutorial: Editing an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . 102 Modify the Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.4 Measuring the Angle Between Two Lines . . . . . . . . . . . . . . . . . . . . . . . . . 103 6.5 Measuring Circle’s Radius or Diameter . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 VisionWare User’s Guide, Rev. A 95 Chapter 6 - Measurements 6.1 What Types of Measurements Can Be Made? This chapter covers the details of making distance measurements. As with any individual inspection, the first record required is an inspection record. The types of measurements you can specify in the inspection record and the minimum additional records each type needs are: POINT-POINT distance This measurement returns the distance between two points. The inspection record requires two additional point class records. POINT-LINE distance This measurement returns the shortest (perpendicular) distance between a point and a line. The top-level inspection record requires two additional vision tool records, one point class record and one line class record. LINE-LINE angle This measurement returns the angle between two lines. The inspection record requires two additional line class records. CIRCLE radius or diameter This measurement returns the diameter or radius of a circle or circular arc. The inspection record requires one additional circle class record. ✼ The records outlined above may not be the only vision tool records needed for each type of inspection. There may be several additional records in the tree. For example, one of the records that returns a point for a point-to-point measurement may require two line finder records to calculate the point. When you begin to use frame relative vision tools (Chapter 9), the inspection trees can get very involved. ✼ Measurements depend on accurate camera calibration. The values returned are accurate only if the cameras used in the inspection are properly calibrated. 96 VisionWare User’s Guide, Rev. A Measuring the Distance Between Two Points 6.2 Measuring the Distance Between Two Points The POINT-POINT distance operation measures the distance between two points. The vision tool records that return points (point class records) are listed in Table 5-1. The steps to measure the distance between two points are as follows: 1. Create a new top-level inspection record: a. Module ➡ Select/Edit ➡ highlight resource module Select ➡ Edit ➡ Vision (main menu bar) Edit ➡ New Record (Vision record menu bar) b. Enter a record name in the Name data box, select A new inspection record is displayed. 2. Select 3. Choose perform: ➡ Inspection, and choose OK . Measure from the Inspection Type group. Select new operation. From the pop-up window that is displayed, POINT-POINT distance ➡ OK . 4. Double click the POINT 1 name data box to display an index of appropriate records. Highlight an existing record or click a tool in the Vision window, and choose Retrieve to use the existing record; or choose New to create a new record. 5. Double click the POINT 2 name data box to display an index of appropriate records. Highlight an existing record or click a tool in the Vision window, and choose Retrieve to use the existing record; or choose New to create a new record that returns a point value. 6. Enter the pass-fail criteria: a. In the Nominal data box, enter the ideal value of the distance being measured. b. Choose Limits . c. Enter the upper acceptable limit of the distance (maximum limit). d. Enter the lower acceptable limit of the distance (minimum limit). Optional: e. Select ✔ Pass-fail I/O signal if you want to specify a digital output signal to be set based on the success of the inspection. A data box is displayed into which you enter a digital output signal number (see Chapter 12). f. Select ✔ Gather stats if you want the results of this inspection reported to the Inspection Results menu page. The number entered into Bin size is used in the statistical calculations when a sequence is run. Chapter 11 describes the use of this option. g. Select the desired data-logging item. h. Choose Limits and enter high and low warning limits, along with any associated I/O signals (see Chapter 12). VisionWare User’s Guide, Rev. A 97 Chapter 6 - Measurements Tutorial: Measuring a Point-to-Point Distance Let’s measure the distance between the center of the circular hole and the centroid of the polygon shaped hole in the sample object. A copy of the sample object is reproduced at the back of the manual. Remove (or copy) the sample object and place it in the field of view. Make sure the vision system is turned on, VisionWare is loaded and running, and you have calibrated a camera (see “Calibrating a Camera” on page 84). The records we will be using for this inspection are: A new top-level inspection record An existing arc finder tool record (to locate the center of the circle) An existing blob finder record (to locate the centroid of the polygon hole) The existing camera and picture records Create the Inspection 1. Load and select the tutorial resource module: Module ➡ Select/Edit ➡ highlight “vwtutor” ➡ Select (main menu bar) 2. Enter the Vision editing mode: Edit ➡ Vision (main menu bar) 3. Choose a live grayscale display: Image ➡ Live Grayscale(vision window menu bar) Place a copy of the sample object in the field of view. 4. Create a new inspection record: Edit ➡ New Record (vision record editing menu bar) Enter new.pt2pt in the name data box, select the new inspection record is displayed: Inspection, and choose OK . When Select TopLevel. Select Choose Select Measure. Select new operation. POINT-POINT distance and choose OK . 5. Edit the sample circle finder record: Double click the POINT 1 name data box. From the pick list that is displayed, highlight (click once) sample.arc.fdr and choose Retrieve . Double click sample.arc.fdr in the POINT 1 name data box. The arc finder tool record is displayed.1 Use the center drag handle to locate the finder tool over the center of the circular hole in the sample object. 1 If a pop-up warning window is displayed asking you if it is “Okay to snap the shape params to within valid limits”, choose OK . 98 VisionWare User’s Guide, Rev. A Measuring the Distance Between Two Points Use the drag handle on the outer radius (dark blue) to size the outer radius until it is entirely within the sample object (see Figure 6-1). (If the tool cannot be made small enough, use the drag handle of the green guide line to make the tool smaller.) Use the drag handle on the guide line (green) to size the inner radius (light blue) until it is just smaller than the circular hole. Choose Setup Parameters . Select Light inside from the Edge Direction group, group, and Inside from the Closest to group. Both from the Find Arc’s Choose Done . 6. Perform Image ➡ New Picture to acquire a new image. The circular hole should be outlined in red. If it is not, check the arc finder tool settings. If the hole is still not outlined, double click the Picture data box to go to the picture record. Choose the Auto-set buttons in the grayscale and binary groups. Perform Go ➡ Back to return to the arc finder tool. The Results group at the bottom of the arc finder tool screen should now show the data calculated by the arc finder. 7. Return to the top-level inspection record: Go ➡ Back 8. Edit the second point record: Double click the POINT 2 name data box. From the pick list that is displayed, highlight sample.blob.fdr and choose Retrieve . Double click sample.blob.fdr in the POINT 2 name data box. The finder tool record will be displayed. Click the center drag handle of the finder tool and drag it over the middle of the polygon shaped hole in the sample object. Use the drag handles to orient the blob finder so it looks like Figure 6-1. Select Light object. 9. Return to the inspection record: Seek ➡ Index ➡ dbl clk “new.pt2pt” The calculated distance between the sample object’s polygon and circular holes will now be displayed in the Value information box. 10. Complete the inspection record: Enter 19 in the Nominal data box. Choose Limits . Enter 21 in the Maximum limit data box. Enter 17 in the Minimum limit data box. VisionWare User’s Guide, Rev. A 99 Chapter 6 - Measurements Blob Finder Arc finder: Outer radius Guide line (green) Inner radius Point 1 Figure 6-1 POINT-POINT Distance Tools Add an Inspect Statement to a Sequence 1. Open the sequence editor (A sequence must have already been created. See Chapter 2): Module Edit ➡ Select/Edit ➡ highlight vision module ➡ Select ➡ ➡ Sequence ➡ highlight “sequence_1” ➡ Select (main menu bar) 2. Add a new statement: Edit ➡ Append line (Sequence editor’s menu bar) Double click --statement--. Highlight Inspect and choose Retrieve . Double click --vision--. Highlight new.pt2pt and choose Retrieve . 3. Disable any existing statement lines: Highlight the line ➡ Edit ➡ Disable 4. Execute the sequence: Execute ➡ Task Control Panel (main menu bar) Click task name. Select ➡ highlight “sequence_1” ➡ Select Click ✔ Repeat. Choose Start . 5. Display the vision results: Show 100 ➡ Vision Results VisionWare User’s Guide, Rev. A Measuring the Distance From a Point to a Line 6.3 Measuring the Distance From a Point to a Line The POINT-LINE distance operation measures the distance between a point and a line. The distance measured is the shortest distance between the point and the line (perpendicular distance). The vision tool records that return points and lines are shown in Table 5-1 and Table 5-2. The steps to measure the distance between a point and a line are: 1. Create a new top-level inspection record: a. Module ➡ Select/Edit ➡ highlight resource module Edit ➡ Vision (main menu bar) Edit ➡ New Record (vision record’s menu bar) b. Enter a record name in the Name data box, select A new inspection record is displayed. 2. Select ➡ Select ➡ Inspection, and choose OK . Measure from the Inspection type group. 3. Choose Select new operation. From the pop-up window that is displayed, select POINT-LINE distance, and choose OK . 4. Double click the POINT name data box to display an index of appropriate records. Highlight an existing record or click the desired tool on the Vision window, and choose Retrieve to use the existing record; or choose New to create a new point class record. 5. Double click the LINE name data box to display an index of appropriate records. Highlight an existing record or click the desired tool on the Vision window, and choose Retrieve to use the existing record; or choose New to create a new record that returns a line. 6. Enter the pass-fail criteria: a. In the Nominal data box, enter the ideal value of the distance being measured. b. Choose Limits . c. Enter the upper acceptable limit of the distance (maximum limit). d. Enter the lower acceptable limit of the distance (minimum limit). Optional: e. Select ✔ Pass-fail I/O signal if you want to specify a digital output signal to be set based on the success of the inspection. A data box is displayed into which you enter a digital output signal number (see Chapter 12). f. Select ✔ Gather stats if you want the results of this inspection reported to the Inspection Results menu page. The number entered into Bin size is used in the statistical calculations when a sequence is run. Chapter 11 describes the use of this option. g. Select the desired data-logging option. h. Choose Limits and enter high and low warning limits, along with any associated I/O signals (see Chapter 12). VisionWare User’s Guide, Rev. A 101 Chapter 6 - Measurements Tutorial: Editing an Inspection Record For this tutorial we will modify the inspection originally created to measure a point-topoint distance (you must have completed the tutorial from the previous section). The modified inspection will measure a point-to-line distance. The distance measured will be between the center of the arc at the top of the object and a line running along one edge of the object. Modify the Inspection 1. Enter data editing mode: Module ➡ Select/Edit ➡ highlight “vwtutor” Edit ➡ Vision (main menu bar) ➡ Select ➡ (main menu bar) 2. Select a live grayscale display: Image ➡ Live Grayscale Place a copy of the sample object in the field of view. 3. Modify the inspection record: Seek ➡ Index ➡ double click “new.pt2pt” (vision record’s menu bar) Highlight the Name data box and type in the new name, new.pt2ln. Select new operation. Choose Select POINT-LINE distance . Choose OK . 4. Modify the Point Record: Double click sample.arc.fdr. When the sample.arc.fdr record appears, choose Setup Parameters and select Circular arc. Drag the arc finder tool until the apex of the green guide line is near the apex of the object (see Figure 6-2). Use the three drag handles on the green guide line to widen the tool arc until the green guide line approximates the object’s radius. Select Dark inside and choose Done . 5. Return to the top-level record: Go ➡ Back 6. Replace the blob finder record with a line finder record: Highlight the LINE name data box. Go ➡ Select Highlight sample.ln.fdr1 and choose Retrieve . 7. Modify the line finder record: Double click sample.ln.fdr1 to go to the line finder record.1 Using the drag handles, position the line finder as shown in Figure 6-2. 102 VisionWare User’s Guide, Rev. A Measuring the Angle Between Two Lines 8. Return to the top-level record: Tree ➡ Top of current tree ➡ double click “new.pt2ln” icon 9. Enter the pass-fail criteria: a. Enter 24 in the Nominal data box. Choose Limits . b. Enter 26 in the Maximum limit data box. c. Enter 23 in the Minimum limit data box. Existing Line Finder Modified Arc Finder Figure 6-2 POINT-LINE Distance Tools 6.4 Measuring the Angle Between Two Lines The LINE-LINE angle operation measures the angle between two lines. The vision tool records that return lines are shown in Table 5-2. The steps to measure the angle between two lines are: 1. Create a new inspection record: a. Module ➡ Select/Edit ➡ highlight resource module Edit ➡ Vision (main menu bar) Edit ➡ New Record (vision record’s menu bar) b. Enter a record name in the Name data box, select A new inspection record is displayed. 2. Select ➡ Select ➡ Inspection, and choose OK . Measure from the Inspection Type group. 3. Choose Select new operation. From the pop-up window that is displayed, select LINE-LINE angle and choose OK . 1 If a pop-up warning window is displayed asking you if it is “Okay to snap the shape params to within valid limits”, choose OK . VisionWare User’s Guide, Rev. A 103 Chapter 6 - Measurements 4. Double click the LINE 1 name data box and an index of appropriate records will be displayed. Highlight an existing record or click the desired tool on the Vision window, and choose Retrieve to use the existing record; or choose New to create a new record that returns a line. 5. Double click the LINE 1 name data box and an index of appropriate records will be displayed. Highlight an existing record or click the desired tool on the Vision window, and choose Retrieve to use the existing record; or choose New to create a new record that returns a line. 6. Specify the pass-fail criteria: a. In the Nominal data box, enter the ideal value of the distance being measured. b. Choose Limits . c. Enter the upper acceptable limit of the angle (maximum limit). d. Enter the lower acceptable limit of the angle (minimum limit). Optional: e. Select ✔ Pass-fail I/O signal if you want to specify a digital output signal to be set based on the success of the inspection. A data box will be displayed into which you enter a digital output signal number (see Chapter 12). f. Select ✔ Gather stats if you want the results of this inspection reported to the Inspection Results menu page. The number entered into Bin size is used in the statistical calculations when a sequence is run. Chapter 11 describes the use of this option. g. Select the desired data-logging option. h. Choose Limits and enter high and low warning limits, along with any associated I/O signals (see Chapter 12). 6.5 Measuring Circle’s Radius or Diameter The CIRCLE radius and CIRCLE diameter operations measure the radius or diameter of a circle. The record types that return circles (circle-class records) are: • Arc/circle finder • Computed circle To measure a circle’s radius or diameter: 1. Create a new inspection record: a. Module ➡ Select/Edit ➡ highlight resource module Edit ➡ Vision ➡ Edit ➡ New Record b. Enter a record name in the Name data box, select A new inspection record is displayed. 2. Select ➡ Select ➡ Inspection, and choose OK . Measure from the Inspection type group. 3. Choose Select new operation. From the pop-up window that is displayed, select CIRCLE diameter and choose OK . CIRCLE radius or 4. Double click CIRCLE name to display an index of appropriate records. Highlight an existing record or click the desired tool on the Vision window, and choose Retrieve 104 VisionWare User’s Guide, Rev. A Measuring Circle’s Radius or Diameter to use the existing record; or choose New to create a new record that returns a circle. 5. Specify the pass-fail criteria: a. In the Nominal data box, enter the ideal value of the distance being measured. b. Choose Limits . c. Enter the upper acceptable limit of the distance (maximum limit). d. Enter the lower acceptable limit of the distance (minimum limit). Optional: e. Select ✔ Pass-fail I/O signal if you want to specify a digital output signal to be set based on the success of the inspection. A data box will be displayed into which you enter a digital output signal number (see Chapter 12). f. Select ✔ Gather stats if you want the results of this inspection reported to the Inspection Results menu page. The number entered into Bin size is used in the statistical calculations when a sequence is run. Chapter 11 describes the use of this option. g. .Select the desired data-logging option. h. Choose Limits and enter high and low warning limits, along with any associated I/O signals (see Chapter 12). VisionWare User’s Guide, Rev. A 105 Testing a Value 7 7.1 Which Values Can Be Tested? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 7.2 Creating a Test-a-Value Inspection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 7.3 Testing Results From Rulers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Create a Ruler Record:. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 7.4 Testing Results From Finder Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Tutorial: Testing the Orientation of a Blob . . . . . . . . . . . . . . . . . . . . . . 112 Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Create a Blob Finder Record: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 7.5 Testing Window Stats: Graylevel Statistics. . . . . . . . . . . . . . . . . . . . . . . . . 113 Picture Records and Graylevel Statistics . . . . . . . . . . . . . . . . . . . . . . . 114 Tutorial: Calculating an Average Graylevel . . . . . . . . . . . . . . . . . . . . . 115 Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Edit the Sample Window Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Edit the Picture Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 7.6 Testing Window Stats: Pixel Counts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 How Does VisionWare Know Which Pixels to Count? . . . . . . . . . . . . . 117 Picture Records and Pixel Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Window Records and Pixel Count Inspections . . . . . . . . . . . . . . . . . . . 118 Pixel Count Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 VisionWare User’s Guide, Rev. A 107 Chapter 7 - Testing a Value 7.1 Which Values Can Be Tested? Table 7-1 lists the values that can be tested with the test-a-value inspection type. The inspection record will test these values to see if they fall within the range of values specified in the Minimum limit and Maximum limit data boxes in the Inspection Limits pop-up window. The window-stats, blob-stats, and OCR-results inspection types are a subset of the test-a-value inspection type. Any inspection that can be made in window stats, blob stats, or OCR results can be made from a test-a-value inspection type. Prototype finder, OCR field, and Correlation window results are covered in Chapter 8. Table 7-1 List of Values That Can Be Tested Record Type Testable Values Linear Rulers Search area clipped by field of view? Number of edges found Distance from first to last edge Distance from ruler start to first edge Arc Rulers Was the search area clipped by field of view? Number of edges found Angle from first to last edge Angle from ruler start to first edge Point Finders Success or failure of the finder tool Search area clipped by field of view? Line Finders Success or failure of the finder tool % of edges found along the line % of edges filtered Angle of the found line Search area clipped by field of view? Maximum pixel error of fit line overall Maximum pixel error of fit line on dark side Maximum pixel error of fit line on light side Arc\circle Finders Success or failure of the finder tool % of edges found along the arc % of points filtered Arc radius Search area clipped by field of view? Maximum pixel error of fit arc overall Maximum pixel error of fit arc on dark side Maximum pixel error of fit arc on light side Blob Finders Success or failure of the finder tool Number of holes in the found blob Area of all holes Blob area Total area Perimeter Radius of minor or major ellipse axis Blob angle Prototype Finders Success or failure of the finder tool Percentage of prototype model verified 108 VisionWare User’s Guide, Rev. A Which Values Can Be Tested? Table 7-1 List of Values That Can Be Tested (Continued) Record Type Testable Values Window Search area clipped by field of view? White pixel count Black pixel count Edge pixel count Minimum graylevel value Maximum graylevel value Average graylevel value Standard deviation of graylevel values Total number of pixels within window Value Combination See Chapter 10 Inspection Record The inspected value Deviation of the value from the nominal Pass/fail condition High warning indicator Low warning indicator Correlation Window The match coefficient Positive correlation indicator OCR Fields Number of characters found Average score of characters found Minimum score of characters found Was each character the first choice? Was each character the first or second choice? Conditional Frame Angle of frame line Computed line Angle of computed line VisionWare User’s Guide, Rev. A 109 Chapter 7 - Testing a Value 7.2 Creating a Test-a-Value Inspection The steps to create an inspection to test a value are: 1. Create a new top-level inspection record: Module ➡ Select/Edit ➡ highlight “vwtutor” Edit ➡ Vision ➡ Edit ➡ New Record Enter a name in the Name data box, select ➡ Select Inspection, and choose OK . 2. When the new inspection record is displayed, select Inspection Type group. Test a value from the The Select new value to test button is inactive until a tool record is entered into the Operator name data box. 3. Specify a record: Double click the Operator name data box and retrieve an existing record, or create a new test-a-value class record (return to the inspection record when complete). 4. Select the value you want to test: Choose Select new value to test to display the values from the selected record that are available for testing (see Table 7-1). Select the desired value and choose OK . 5. Set the pass-fail values for the inspection: Enter the ideal value the tested value should have in the Nominal data box. Choose Limits and enter the acceptable range of values in the Minimum limit and Maximum limit data boxes. 7.3 Testing Results From Rulers Linear and arc ruler tools look for intensity transitions. Graylevel rulers search for transitions based on the magnitude of graylevel changes between neighboring pixels. If the change exceeds the value set for edge strength, an edge is detected. Binary rulers search for transitions based on a transition from black to white pixels. See “Grayscale vs. Binary Processing” on page 184 for details on the different modes of image processing. See “Linear Ruler Records” on page 270 for details on linear rulers and “Arc Ruler Records” on page 274 for details on arc rulers. Tutorial: Test the Number of Points Found by a Ruler In this tutorial we will create a new inspection record and a new ruler record. The inspections record will test the number of transitions (edges) found by the ruler record. Create an Inspection Record 1. Load the tutorial resource module: Module ➡ Select/Edit ➡ highlight “vwtutor” ➡ Select 2. Enter data editing mode: Edit 110 ➡ Vision VisionWare User’s Guide, Rev. A Testing Results From Rulers 3. Select a live grayscale display: Image ➡ Live Grayscale Place a copy of the sample object in the field of view. 4. Create a new inspection record: Edit ➡ New Record ➡ enter “new.ruler.insp” ➡ When the new inspection record is displayed, select Inspection Type group. Inspection ➡ OK Test a Value from the Create a Ruler Record: 5. Double click the Operator name data box. A pick list of available tool records is displayed. Choose New and from the pop-up window that is displayed: enter “new.ruler” ➡ dbl clk Ruler ➡ OK ➡ dbl clk “new.ruler” 6. When the new ruler record is displayed, edit the ruler tool: Use the center drag handle to move the tool between the two holes in the sample object. Use the size drag handles to make the ruler slightly larger than the width of the sample object. Use the rotate drag handle to align the ruler tool with the two holes in the sample object (Table 7-1). Complete the Inspection Record 7. Return to the inspection record: Go ➡ Back 8. When the inspection record is re-displayed, select a value to test: Choose Select new value to tes t. Highlight Number of edges found and choose OK . 9. Select ✔ Gather stats. 10. Enter the pass-fail criteria: a. Enter 6 in the Nominal data box. b. Choose Limits . Enter 6 in the Maximum limit data box. Enter 6 in the Minimum limit data box. 11. Check the results: a. Choose Test run inspection. b. View the results in the Latest Test Run group. c. Choose Done . VisionWare User’s Guide, Rev. A 111 Chapter 7 - Testing a Value Ruler Tool Figure 7-1 Test a Value Example 7.4 Testing Results From Finder Tools Finder tools locate features in the field-of-view. Finder tools return values indicating how accurately a feature was found and where that feature is located. Line finders, point finders, and arc/circle finders can search for features in either the binary or the grayscale image. Blob finders and prototype finders search for features based on the binary image. See “Grayscale vs. Binary Processing” on page 184 for details on the different modes of image processing. See Appendix G for details on creating finder tools. Tutorial: Testing the Orientation of a Blob In this tutorial we will create an inspection record and a blob finder record. Blob finders return information about bounded regions (contiguous areas of black or white pixels) in the field-of-view. One item of information returned is the orientation of the blob. The inspection record will test the orientation value returned by the blob. Create an Inspection Record 1. Load the tutorial resource module: Module ➡ Select/Edit ➡ highlight “vwtutor” ➡ Select 2. Enter data editing mode: Edit ➡ Vision 3. Select a live grayscale display: Image ➡ Live Grayscale Place a copy of the sample object in the field of view. 4. Create a new inspection record: Edit ➡ New Record ➡ enter “new.blob.insp” ➡ When the new inspection record is displayed, select Inspection Type group. 112 Inspection ➡ OK Test a Value from the VisionWare User’s Guide, Rev. A Testing Window Stats: Graylevel Statistics Create a Blob Finder Record: 5. Double click the Operator name data box. A pick list of available tool records is displayed. Choose New and from the pop-up window that is displayed: enter “new.blob.fdr” ➡ dbl clk Blob Finder ➡ OK ➡ dbl clk “new.blob.fdr” 6. When the new blob finder record is displayed, edit it: Use the center drag handle to move the tool over the center of the sample object. Use the size drag handles to make the blob finder larger than the sample object. 7. Select Select Dark object. Best fit ellipse. Complete the Inspection Record 8. Return to the inspection record: Go ➡ Back 9. When the inspection record is re-displayed, select a value to test: Choose Select Select new value to test. Angle of blob and choose OK . 10. Select ✔ Gather stats. 11. Enter the pass-fail criteria: a. Enter 0 in the Nominal data box. b. Choose Limits . Enter 2 in the Maximum limit data box. Enter –2 in the Minimum limit data box. 12. Check the results: a. Choose Test run inspection. b. View the results in the Latest Test Run group. c. Choose Done . 7.5 Testing Window Stats: Graylevel Statistics When the vision system acquires an image, a matrix of approximately 512 x 484 cells is filled with values. The value in each cell (or pixel1) is a number between 0 and 127 that represents the light intensity registered from a corresponding point in the field of view. These values are known as graylevel values. The vision system uses these values to create images. Figure 7-2 - Sample Vision Matrix shows an example of a small section of pixels. The lower values represent darker areas of the field of view. The higher values represent brighter areas of the field of view. 1 Short for “picture element.” VisionWare User’s Guide, Rev. A 113 Chapter 7 - Testing a Value 88 82 84 88 85 83 80 93 102 88 80 78 80 80 78 73 94 100 85 79 80 78 77 74 65 91 99 38 35 40 35 39 74 77 70 65 20 25 23 28 37 69 64 60 57 22 26 22 28 40 65 64 59 34 24 28 24 30 37 60 58 56 66 21 22 23 27 38 60 67 65 67 23 22 22 25 38 59 64 67 66 Figure 7-2 Sample Vision Matrix You can instruct VisionWare to calculate the following graylevel statistics: The average graylevel value The maximum graylevel value The minimum graylevel value The standard deviation of the graylevel values In many cases, graylevel statistics can be used to inspect an object, or an object feature. For example, if you were inspecting an all-white feature for surface flaws, the graylevel values for the feature should have the following characteristics: • The average graylevel should be near the upper limit of the range. • The average, minimum, and maximum graylevel values should be very close. • The standard deviation should be very low. Picture Records and Graylevel Statistics An inspection record that measures graylevel statistics requires you to specify a window vision tool. One class of information that window vision tools return is graylevel statistics. The statistics are calculated from within a specified search area or window. The values returned by a window tool are influenced by two settings made in the picture record that is associated with the window record. The two settings are gain and offset. The graylevel values that are placed in the vision matrix are not the absolute values registered from the field of view, but are first amplified by the value of gain, and then offset by the value of offset.1 These two parameters allow you to compensate for varying scene brightness and contrast. If your field of view is dimly lit, all the graylevel values might be bunched up near the lowest value, and all the scene features would be indistinguishable. This is similar to underexposing a piece of photographic film.2 Offset allows you to alter the starting intensity for the first graylevel value. This means that the lowest graylevel value in a 1 Actually, the incoming video signal is affected by these parameters. The final values placed in each pixel will be scaled to be between 1 and 127. 2 Offset cannot compensate for an overly dark or bright scene. Adjust the camera aperture for optimum contrast before setting offset and gain. 114 VisionWare User’s Guide, Rev. A Testing Window Stats: Graylevel Statistics bright scene with a high offset value represents a higher absolute intensity level than does the first value in a dark scene with a low offset value. Similarly, a scene might have a fairly even contrast, in which case the difference between the highest graylevel value and the lowest graylevel value would be small. This would tend to make the scene features difficult to distinguish. Gain is used to spread out the range of values in a scene of limited contrast, thus making the scene features easier to distinguish. Both Offset and Gain can be automatically set from within the picture record associated with the window record (see Section D.5). Tutorial: Calculating an Average Graylevel In this tutorial we create a top-level inspection record that measures the average graylevel value, and edit the sample vision tool that returns graylevel values. Create an Inspection Record 1. Load the tutorial resource module: Module ➡ Select/Edit ➡ highlight “vwtutor” ➡ Select 2. Enter data editing mode: Edit ➡ Vision 3. Select a live grayscale display: Image ➡ Live Grayscale Place a copy of the sample object in the field-of-view and orient it as shown in Figure 7-3. 4. Create a new inspection record: Edit ➡ New Record ➡ enter “new.grylvl.insp” ➡ From the inspection record that is displayed, select Inspection ➡ OK Window stats. Edit the Sample Window Record 1. Retrieve the sample window record: Double click the Operator name data box. An index of available window tools will be displayed, and the graphics for those tools will be shown in the vision window. Double click sample.window. 2. Edit the window tool: Double click sample.window in the WINDOW name data box to go to that record. (Allow VisionWare to scale the tool if necessary.) When the sample window record is displayed: Select Round from the shape group. Use the center drag handle to center the window over the hole in the sample object. VisionWare User’s Guide, Rev. A 115 Chapter 7 - Testing a Value Use the size drag handle on the perimeter of the window to size the tool until it is the same size as the circular hole. Select ✔ Average graylevel Edit the Picture Record 1. Go to the picture record: Double click the PICTURE name data box. 2. Set the contrast parameters: Choose Auto-set in the grayscale group. 3. Set the binary threshold: Choose Auto-set in the binary group. Complete the Inspection Record 1. Return to the inspection record: Go ➡ Tree ➡ Go to Root ➡ dbl clk the “new.grylvl.insp” icon 2. Select an operation: Choose Select Select a new value to test. Average graylevel and choose OK . 3. Select ✔ Gather stats. 4. Enter the pass-fail criteria: a. Choose Limits . b. Enter the ideal average graylevel value in the Nominal value data box. The level depends on the lighting conditions and the setting of gain and offset. Acceptable graylevel values must be determined empirically from known samples of acceptable parts. c. Choose Test run inspection and execute a sufficient number of inspections to provide a reliable average graylevel value. Enter this new value in the Nominal value data box. d. Enter the upper acceptable limit of the graylevel value in the Maximum limit data box. e. Enter the lower acceptable limit of the graylevel value in the Minimum limit data box. Check the results 1. Acquire a new image: Image ➡ New Picture 2. View the results in the Result and Dev information boxes. 116 VisionWare User’s Guide, Rev. A Testing Window Stats: Pixel Counts Window Tool Figure 7-3 Window Tools 7.6 Testing Window Stats: Pixel Counts A pixel is the smallest unit of measurement the system can return to you. If you knew how many pixels were in a given region, you would have a very accurate measurement of that region’s size. Similarly, if you knew the number of pixels surrounding a feature, you would have an accurate measurement of that feature’s perimeter. How Does VisionWare Know Which Pixels to Count? Pixel counts are constrained in two ways. First, pixels are always counted within the confines of a window tool. Second, pixel counts can be made of only the dark pixels, the light pixels, or the edge pixels within that window. Edge pixels occur in areas where neighboring pixels go from light to dark or vice versa (i.e., edges). When the vision system acquires an image, a matrix of approximately 512 x 484 cells is filled with values. The value in each cell (or pixel) is a number between 0 and 127 that represents the light intensity registered from a corresponding point in the field of view. These values are known as graylevel values. When light or dark pixels are counted, the graylevel value in each pixel is compared with the threshold value. If the value is below the threshold value, the pixel is considered dark. If the value is above the threshold value, the pixel is considered white. The resulting image is a binary image–the pixels are either black or white. When edge pixels are counted, the difference between neighboring pixels is compared to the edge strength threshold value. If the difference exceeds edge strength threshold, the pixels are considered part of an edge and are counted. In images with high contrast (most areas are either dark or light), pixel counting provides a way of determining areas or perimeters, and checking for surface flaws. Picture Records and Pixel Values Pixel counts are made by window tools. Each window tool record requires an associated picture record. The picture record specifies the threshold value to be used when deciding which pixels are white and which ones are dark. (In the case of dynamic pixel counts, the threshold values can be superseded by settings in the window tool record.) VisionWare User’s Guide, Rev. A 117 Chapter 7 - Testing a Value Window Records and Pixel Count Inspections You will not be able to select a specific operation until the WINDOW name data box has been filled in with a window record, and that window record has specified one of the following modes of operation: Count white/black pixels Count edge pixels Dynamic white/black pixel count Pixel Count Operations Once the WINDOW name data box in the inspection record has a valid entry, the specific operations that are available are highlighted and you can select the desired operation. The White pixels operation will count all the white pixels within the window and return that count. The threshold value used to separate white from black pixels is specified in the picture record used to acquire the image. The Black pixels operation counts all the dark pixels within the window and returns that count. The Edge pixels operation counts all the pixels along edges found in the image. An edge is detected when the difference in intensity from one pixel to the next exceeds the value specified for the edge strength threshold in the window tool record. The Dynamic white pixels operation counts all the white pixels based on the threshold values specified in the window record rather than the picture record. The Dynamic black pixels operation counts all the black pixels based on the threshold values specified in the window record rather than the picture record. The difference between counting white/black pixels and dynamic white/black pixels is that dynamic pixel counts allow you to specify threshold values other than the ones specified in the picture record. 118 VisionWare User’s Guide, Rev. A Vision Model Processing 8 8.1 Prototype Model Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 8.2 Creating Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Editing Prototypes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Prototype Training Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Prototype Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 8.3 Prototype Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 8.4 Prototype Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 8.5 Image Correlation Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 8.6 Correlation Template Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 8.7 Correlation Windows. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 8.8 Correlation Window Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 8.9 OCR Font Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 8.10 Creating a Font . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 8.11 OCR Field Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 8.12 OCR Field Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 OCR Field Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 VisionWare User’s Guide, Rev. A 119 Chapter 8 - Vision Model Processing 8.1 Prototype Model Records The prototype process has two major steps, training and recognition: The first step, training, involves creating an idealized vision model of the object you want to recognize. This model is stored in a Prototype Model Record. The second step, recognition, involves instructing the vision system to see if any objects in the field of view match the model. A Prototype Finder Record performs this operation. Figure 8-1 shows a prototype model record. Figure 8-3 shows a prototype finder record. ➋ ➊ ➌ ➍ ➎ ➏ ➐ ➒ ➑ Figure 8-1 Prototype Model Record 8.2 Creating Prototypes The steps to create a prototype are (the numbers in black circles refer to the corresponding numbers in Figure 8-1): ✼ 1. Create the picture and camera records that will be used when training and recognizing this prototype (item ➌). Changing camera settings or calibration after you train a prototype invalidates the prototype. 2. Create a prototype model record: Module ➡ Select/Edit ➡ highlight resource module Edit ➡ Vision ➡ Edit ➡ New Record 120 ➡ Select ➡ VisionWare User’s Guide, Rev. A Creating Prototypes When the new record window is displayed, enter a name for the prototype, select Prototype (model) from the Special Purpose group and choose OK . 3. When the prototype model record is displayed, indicate whether the prototype is a light or dark object (item ❹). 4. Indicate the minimum and maximum areas the system should consider when training a prototype model (item ➎). If many regions appear in the field of view, this option allows you to ignore the regions that should not be considered part of the prototype model. The regions that will be considered part of the prototype can be seen by choosing Show Regions . The bounded regions with areas within the limits set by item ➎ are outlined in the vision window. 5. Use the drag handles to move the prototype window over the object to be trained and choose Train . 6. Edit the prototype. (Editing is detailed in the next section.) 7. When you have completed editing of an example: Done ➡ Use Example 8. A dialogue box is presented showing the default verify percentage (75%). Click the percentage to change it. Choose OK to accept the percentage displayed in the dialogue box. 9. A dialogue box is presented showing the available effort levels. The suggested effort level is highlighted. Choose OK to accept the suggested effort level.1 10. Select New example from the New Example menu and follow steps 5 through 9 to train at least five additional examples of the prototype. Orient the part differently during each training session. After training each additional example: a. Select a corner in the new example (pick well-defined features). b. Select the corresponding corner in the existing prototype. c. Choose Done when enough corners have been selected. d. The system attempts to fit the new example to the existing prototype. If the match is successful, choose Yes when prompted for verification. If the match is unsuccessful, you have to select different features to match or abandon the example. 11. When you have finished training all examples, perform Done ➡ Done (from the vision window), and VisionWare creates a prototype model. This step requires some amount of calculation and cogitation, so relax and fill your coffee cup. 12. When training is complete, choose Show Prototype to show the prototype model that has been created. The Prototype Group data box contains the virtual camera number associated with this prototype. By default it contains the number that was allocated to the picture record. Prototypes within a single virtual camera are processed and recognized as group. If you want to keep certain prototypes separate from other ones, assign them a different group number. 1 When VisionWare actually begins recognizing prototypes, you can fine-tune verify percentage and effort level to minimize processing time and maximize accurate prototype matching. VisionWare User’s Guide, Rev. A 121 Chapter 8 - Vision Model Processing Editing Prototypes A graphic representation of the prototype object showing arcs in purple, lines in yellow, and corners as white dots will be presented. During prototype editing, you edit the boundaries fit by the system so they match your object as closely and simply as possible. The most common editing tasks you will perform are: • Removing extra corners • Turning arcs into lines • Deleting features that are unimportant or are part of the background Figure 8-2 shows the prototype training window and its functional groups of features. The process of editing a prototype using the training window is described following Figure 8-2. 122 VisionWare User’s Guide, Rev. A Creating Prototypes Preview Window Editing Operation Data Box TRAINING Current op. DELETE CORNER Edit Buttons Location Box Op Prev Zoom Buttons 1x 2x 3x 4x Edge Next Region Prev/Next Zoom Edge/Region Select Buttons Message Window Edge Type Edge Length Region Area # of Edges Edge/Region Information Data Boxes Figure 8-2 Prototype Editing Operations Preview Window This window shows a reduced view of the vision window. When the 1x radio button is selected, the preview window and the vision window shows the same view. When a 2x or VisionWare User’s Guide, Rev. A 123 Chapter 8 - Vision Model Processing greater button is selected, the objects in the vision window are magnified and a location box appears in the preview window showing the area of the vision window you are working on. You can move to a different area of the vision window by clicking this location box and dragging it to a new area. Zoom Buttons These buttons allow you to work with different levels of magnification of the prototype object. The area you have zoomed to is shown in the Preview window. Message Window This box displays information and error messages during the prototype training process. Edit Buttons There are two methods of editing a prototype, clicking directly the object’s features with the mouse or using the mouse to choose the edit buttons. The main difference between the two methods is that data reported in the edge/region information windows is only available when using the edit buttons. The editing operation that will be performed (using either method) is selected from the Operation menu in the Prototype window. The current operation is shown in the Current op data box. When you edit with the mouse, the current operation will be performed on the line, arc, or corner nearest the mouse click. When you edit with the edit buttons: The first time you choose the Next or Prev button, an “X” appears on one of the lines or arcs of the prototype. If you choose the Op button, the operation indicated by the Editing Operation window is performed. If the Edge radio button is selected, the next time you choose the Prev or Next buttons, the “X” will move to the next or previous line or arc in the region. Choosing the Op button performs the current operation. If the Region radio button is selected, the next time you choose the Prev or Next button, the “X” will move to the next or previous region in the vision window. Choosing the Op button performs the current operation. Editing Operation Window This window shows the editing operation that are performed using the edit buttons or by choosing the prototype. The edit operation is chosen from the Operation menu in the Prototype window. The editing tasks performed by each option are: Delete Corner Deletes the corner nearest to a mouse click or the next corner in sequence when the Op button is chosen. Restore Corner Restores a corner deleted with a delete corner operation. Arc <=> Line Converts a line to an arc, or an arc to a line. Delete Region Deletes the region nearest to the mouse click or the region currently selected when Op is chosen. (Can be performed only on the first prototype example.) 124 VisionWare User’s Guide, Rev. A Creating Prototypes Delete Edge Deletes the edge currently selected when Op is chosen, or the edge nearest the mouse click. (Can be performed only on the first prototype example.) Create Corner Places a corner at the mouse click or, when the Op button is chosen, on the currently selected line or arc. (Can be performed only on the first prototype example.) The most recent editing operation can be undone by performing: Undo ➡ Last Op Edge/Region Information Windows When you are editing using the edit buttons, these windows show: • Edge type (line or arc) • Region area in pixels • Edge length (distance in pixels from one corner to the next) • Number of edges in the region (holes are not included in this count) This data is not displayed if you are editing by clicking directly on the prototype image. Edge/Region Select Buttons These buttons work in conjunction with the edit buttons. When the Edge button is selected, choosing the Prev or Next buttons chooses the next or previous edge in a region. When the Region button is selected, choosing the Prev or Next buttons chooses the next or previous region within the field of view. Prototype Training Hints After you have completed prototype training, you can still train additional examples of a part or change the prototype parameters (described later in this chapter). Simply open the prototype model record and choose Train to train additional instances. When you train the first example, make the prototype as simple as possible. When you train additional examples, do as little editing as possible. Prototype Parameters Each prototype has several prototype parameters associated with it. These parameters can be set during any training session for that prototype. The parameters are: Verify Percent This parameter sets the percentage of total boundary length (including holes) that must be common to both the prototype model and the current region before recognition is successful. This parameter can be used to control: • The number of objects incorrectly recognized as matching a prototype • The number of objects matching a prototype that are not recognized VisionWare User’s Guide, Rev. A 125 Chapter 8 - Vision Model Processing Effort Level Effort level affects recognition accuracy and processing speed. Recognizing prototypes with few distinguishing features, as well as recognizing prototypes among multiple overlapping objects, will require higher effort levels and more processing time. Min/Max Area Changing the setting for minimum area will allow you to ignore small, non-critical features of an object. Changing the setting of maximum area will allow you to isolate an area within a large object, or ignore large, non-critical areas within the field of view. Limit Position These parameters allow you to constrain the location and rotation variance an object can have from the prototype model and still be recognized. Edge Weights In some cases, accuracy of prototype recognition can be improved by weighting an object’s edges. Important features of an object can be given a high weight, and unimportant features can be given a low weight. Edge weights work in conjunction with verify percentage to determine how closely an object must match the prototype model for successful recognition. 126 VisionWare User’s Guide, Rev. A Creating Prototypes VisionWare User’s Guide, Rev. A 127 Chapter 8 - Vision Model Processing 8.3 Prototype Finder Records In the previous section we learned how to create prototype model records. This section will show you how to use prototype finder records to recognize those objects. To create a prototype finder record: Module ➡ Select/Edit ➡ highlight resource module ➡ Select Edit ➡ Vision Prototype Finder (from the Edit ➡ New Record ➡ enter record name ➡ ‘Special Purpose’ group) ➡ OK ➍ ➎ ➋ ➌ ➊ ➏ ➐ ➑ ➒ ➓ ❋ ✠ Figure 8-3 Prototype Finder Record 128 VisionWare User’s Guide, Rev. A Prototype Finder Record Options 8.4 ➊ ➋ ➌ ➍ ➎ ➏ ➐ Prototype Finder Record Options Shows the name of the prototype finder record and the date it was created. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record also shows up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a prototype finder record.) Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Enter the name of a picture record to be associated with this prototype finder record. This picture record must use one of the virtual cameras that were assigned when the prototype model was created. Select the prototype model this record is to find. Select ✔ Repeat to make this a repeat record (see Chapter 10). Choose Show Rpt to show all found prototypes. In the Max proto-instances to find data box, indicate the maximum number of prototypes the system should attempt to find (–1 indicates that all regions should be searched for prototype matches). This option can reduce processing time in complicated scenes. Max execution time controls the time a finder will spend looking for a prototype match. See the description of V.MAX.TIME in the Vision Reference Guide for details on how this option affects prototype matching. ➑ Choose Blob Ordering to select the order in which prototypes are found. Select ✔ No clipped protos and the system will recognize only prototypes that are entirely within the prototype finder search area (the angle of the tool search area must be 0, 90, 180, or 270 for this option to be available). ➒ ➓ ❋ Shows the absolute coordinates of the finder search area. The search area can be changed by entering values directly into these data boxes or by using the drag handles on the finder tool. Select ✔ Relative to to make the tool relative to a vision frame. A data box is displayed requiring a source record that returns a frame value. Choose Show Prototype to display an outline of the prototype model defined by item ➎. Choose Show Recognition to display the outline of the prototype model over the regions that were recognized as matching the prototype. ✠ The Found item indicates whether or not a prototype match was successfully made. The % verified item indicates the percentage of total boundary length (including holes) that was common to both the prototype model and the image regions. The Centroid X, Y item indicates the centroid of the found prototype. The Angle item indicates the difference between the orientation of the prototype model and the orientation of the found prototype. VisionWare User’s Guide, Rev. A 129 Chapter 8 - Vision Model Processing 8.5 Image Correlation Template An image correlation template records the graylevel values within the template search area. A Correlation Window is used to match image areas to the trained template. Image correlation is normalized so that additive or multiplicative differences between the template and the match areas are accounted for. To create a correlation template: Module ➡ Select/Edit ➡ highlight resource module ➡ Select ➡ Edit ➡ Vision Correlation Template ➡ OK Edit ➡ New Record ➡ enter record name ➡ ➊ ➋ ➌ ➎ ➍ ➏ ➐ ➑ Figure 8-4 Correlation Template Record 130 VisionWare User’s Guide, Rev. A Correlation Template Options 8.6 ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ Correlation Template Options Shows the name of the correlation template record and the date it was created or last altered. Select a picture record to use when training this correlation template. Correlation templates are automatically numbered by VisionWare. This information shows the number of this template record. Size the template search area so it encompasses the image area you want to train and then choose Train . Choose Show to outline the image area trained as a correlation template. Select to allow hierarchical searching. This method of searching can produce significant improvement in the speed of correlation matching. See the Correlation Window description for details. This area shows the location of the image template. This area shows the size of the image template. The speed of finding a correlation template match within a correlation window is relative to the size of the image template and the size of the match search area. Large templates or large search areas will consume considerable processing time. Choose Opti-size to increase your template to the next largest size that is optimal for the correlation algorithm. Normally you should choose this button only once. Repeatedly choosing it makes your template much larger than necessary and slows down this tool. VisionWare User’s Guide, Rev. A 131 Chapter 8 - Vision Model Processing 8.7 Correlation Windows A correlation window defines a search area within which matches to a correlation template are to be made. To create a correlation window: Module ➡ Select/Edit ➡ highlight resource module ➡ Select ➡ Edit ➡ Vision Correlation Window ➡ OK Edit ➡ New Record ➡ enter record name ➡ ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure 8-5 Correlation Window 132 VisionWare User’s Guide, Rev. A Correlation Window Options 8.8 ➊ ➋ Correlation Window Options Shows the name of the correlation window record and the date it was created or last altered. Select Top level to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record also shows up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a correlation window record.) Select Show at runtime to have this tool’s graphics displayed during sequence execution (runtime graphics must be turned on; Show ➡ Run Time Graphics) ➌ Select a picture record to use during template matching (does not have to be the same picture record used when the template was trained, but the same camera should be used). Select the correlation template record to use for the matching operation. ➍ Select Match only, no search area to restrict template matching to an area the same size as the correlation template. Select Allow search area to allow template matching in an area larger than the template. ➎ ➏ Choose Show template to show the template location within the field-of-view. This group shows the location and size of the correlation window. Select ✔ Relative to to make this tool relative to a frame class tool. Choose Snap tool to template exactly to force the correlation window to exactly match the template location and dimensions. ➐ ➑ ➒ ➓ Specify the hierarchical search options. In this type of search, a rough search is made in the search area and areas are identified that might contain a match. Finer searches are then made only in these areas. This process is repeated the number of times specified in Max depth. The accept and reject level indicate a score for determining which areas to search again at the next higher level. Maximum search time indicates how long to search before completing the search or declaring failure. This area shows the results of the search. The match coefficient indicates the percent of pixels in the match area that correspond to pixels in the template. These items show the center of the matching area. This area shows the size of the correlation window. VisionWare User’s Guide, Rev. A 133 Chapter 8 - Vision Model Processing 8.9 OCR Font Records Optical character recognition (OCR) is a prototype process that is limited to character recognition. An OCR Field record will attempt to recognize a string of characters from a trained OCR Font record. To create a font record: Module ➡ Select/Edit ➡ highlight resource module ➡ Select ➡ Edit OCR Font ➡ OK Edit ➡ New Record ➡ enter record name ➡ ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure 8-6 OCR Font Record 134 VisionWare User’s Guide, Rev. A ➡ Vision Creating a Font 8.10 Creating a Font The steps to creating a font are (the numbers in black circles refer to the corresponding numbers in Figure 8-6): 1. Create a new OCR Font record. 2. Enter any characters that may be encountered during verification in the Characters in font data box (item ➋). Click the Characters in font box to be able to enter (or delete) characters one at a time. Click the character sets in item ➌ to add an entire set of characters to item ➋. 3. Indicate whether the characters to be trained are white or black characters (item ➍). Choose Show Regions to display the regions in the field of view that will be considered part of the font (not active until the font height has been measured). 4. Enter the minimum area (in pixels) a bounded area must have to be considered in the font creation process (item ➎). This area should be set so that disjoint areas of characters (such as the dot on an i) are not considered. 5. Enter the name of the picture record to use during the training sessions (item ➐). 6. Place a sample of the font characters to be trained in the field of view. Choose Measure it (item ➏). The font tool search area will be displayed in the vision window. Drag and size the search area until it exactly encompasses the largest letter in the sample character set. Choose Done . 7. If the character is properly outlined, choose Yes . Otherwise, choose No and repeat step 6. 8. Resize the font search area to encompass all characters to be trained and choose Train (item ➑). Follow the directions displayed in the vision window. ( Train is not active until font height has been measured.) 9. When all characters have been trained, choose Plan to create the font prototype (item ➓). Plan is not active until font height has been measured and the font has been trained.) 10. Choose Show (item ➒) to display the trained font and its characteristics (not active until font height has been measured). Once a font has been trained, OCR Field records can be created to verify or recognize instances of text contained in the font. VisionWare User’s Guide, Rev. A 135 Chapter 8 - Vision Model Processing 8.11 OCR Field Records The OCR field record verifies whether a specified string of text has been located in the search area of the field-of-view, or recognizes the text within the search area. To create an OCR Field record: Module ➡ Select/Edit ➡ highlight resource module ➡ Select Edit ➡ New Record ➡ enter record name ➡ OCR Field ➡ OK ➋ ➌ ➊ ➍ ➎ ➐ ➑ ➏ ➒ ➓ ❋ ✠ ◆ Figure 8-7 OCR Field Record 136 VisionWare User’s Guide, Rev. A ➡ Edit ➡ Vision OCR Field Options 8.12 OCR Field Options ➊ ➋ ➌ ➍ ➎ ➏ Shows the name of the OCR Field record and the date it was created or last altered. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. If Full text recognition is selected, this option must be selected to make this record available to the OCR_OUTPUT statement. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. In the Picture name data box, enter the picture record to be used when text recognition or verification is attempted. The picture record must use the same camera record as the font record used. In the Font name data box, enter the name of the font (OCR Font record) that contains the anticipated characters. Choose Tool Loc to view the absolute coordinates of the OCR Field search area, or to make the search area frame relative. The search area can be sized with the drag handles, or by entering the absolute coordinates in the pop-up window displayed after this button is chosen. ➐ Select ✔ Relative to to make the tool relative to a vision frame. A data box is displayed requiring a source record that returns a frame value. ➑ If ✔ Relative to is selected, select ✔ Force absolute angle of zero to force the reference-frame angle to be ignored and assumed to be zero. ➒ If Verify against expected chars is selected, successive regions in the OCR search area are compared to the corresponding characters in the expected text (item ➓). If Verify against all chars is selected, each region in the OCR search area is compared with every character in the font. This option requires more processing time. If Full text recognition is selected, all characters recognized within the search area are returned along with the average and minimum recognition score. See the OCR_OUTPUT statement in Chapter 3 for details on full text recognition. ➓ ❋ Specify the characters you expect to find in the field of view (not used with full text recognition). Choose Train to train the font (this button is not active until a font name is entered). Choose Show Font to see the status of the font. ✠ ◆ Max execution time (secs) allows you to limit the amount of time the tool spends verifying or recognizing characters. Max blob area (in pixels) allows you to limit character recognition to bounded regions that are smaller than the specified area. The results returned for each type of operation are described on the next page. VisionWare User’s Guide, Rev. A 137 OCR Field Results The following results are returned for each type of OCR field operation: Verify against expected chars Number of characters found indicates how many characters were found (not how many were verified). Average score of characters found indicates the accuracy of the average character match between the expected text and the found text. Min score of chars found indicates the accuracy of the worst character match. Verify against all chars Each char was 1st choice indicates whether each character from item ➓ was matched to an identical character in the font. Each was 1st or 2nd choice indicates whether each character from item ➓ was matched to an identical character or next closest character from the font. Number of characters found indicates how many characters were found (not how many were verified). Average score of characters found indicates the accuracy of the average character match between the expected text and the found text. Min score of chars found indicates the accuracy of the worst character match. Full text recognition Number of characters found indicates how many characters were found (not how many were verified). Average score of characters found indicates the accuracy of the average character match of the found text. Min score of chars found indicates the accuracy of the worst character match. Text recognized displays the characters that were recognized within the tool search area. This text can be output to a serial line or disk file during sequence execution using the statement OCR_OUTPUT. See “Logging Vision Results” on page 171 for details on opening a data logging file or serial line. See Chapter 3 for details on the OCR_OUTPUT statement. A complete OCR inspection often involves two inspections: an inspection testing whether characters were found or verified, and an inspection to measure the accuracy with which the characters were found or verified. Frame Relative Records 9 9.1 9.2 9.3 9.4 9.5 Why Use Frame Relative Records? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 What Is a Vision Frame? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Vision Frame Class Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Vision Frames Generated by Vision Tools . . . . . . . . . . . . . . . . . . . . . . . . . 140 Computed Vision Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 Fixed Frame and Null Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Frame Origin, a Point on the X axis, and a Point in the Positive Y Direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Frame Origin and a Point on the Positive X Axis . . . . . . . . . . . . . . . . . 145 Line and a Point in the Positive Y Direction . . . . . . . . . . . . . . . . . . . . . 146 A Line for the X Axis, and a Line Through the Origin . . . . . . . . . . . . . . 147 9.6 Making Vision Tools Relative to a Vision Frame. . . . . . . . . . . . . . . . . . . . . 147 Tutorial: Creating a Vision Frame Relative Arc Finder . . . . . . . . . . . . . 148 A. Create an Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 B. Create an Arc Finder Record . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 C. Create a Computed Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 D. Complete the Arc Finder Record . . . . . . . . . . . . . . . . . . . . . . . . 150 E. Complete the Inspection Record . . . . . . . . . . . . . . . . . . . . . . . . 150 Vision Frame Relative Inspection Tree. . . . . . . . . . . . . . . . . . . . . . . . . 151 VisionWare User’s Guide, Rev. A 139 Chapter 9 - Frame Relative Records 9.1 Why Use Frame Relative Records? In many cases the objects you are inspecting will be presented to the camera at a random location and orientation, making it difficult or impossible to place the vision tools accurately. Making the location of vision tools relative to a frame allows you to easily make inspections of parts that are not always in the same location or orientation in the field of view. To place frame relative vision tools, you must first create a frame that is unique to the object you are inspecting. 9.2 What Is a Vision Frame? When you create a vision tool, that tool’s location and orientation are stored in the vision tool record. When a sequence using that tool is executed, the tool’s location and orientation are retrieved from the database, and the tool is placed on the screen. By default, the location and orientation values are relative to the camera coordinate frame. This frame is a Cartesian frame with the frame origin (X = 0, Y = 0) at the lower left corner of the vision window. The X and Y values for the tool location are interpreted as offsets from this point, and the tool angle is interpreted with respect to the bottom of the vision window (the X axis). VisionWare is not limited to using the camera coordinate frame to place tools. A frame can be created by simply specifying a location in the camera coordinate frame, and an angle for the new frame with respect to the camera coordinate frame. The new frame has its origin (X = 0, Y = 0) at the specified point. The new frame’s X axis runs at the specified angle with respect to the camera coordinate frame’s X axis. This type of frame is referred to as a vision frame. Vision frames can be chained– a vision frame can be relative to another vision frame, rather than to the camera coordinate frame. When vision frames are chained, the rotation and offsets of a vision frame are relative to the vision frame immediately below it in the tree. 9.3 Vision Frame Class Records Several vision records return vision frame results. These records belong to the vision frame class; their characteristics are described in Table 5-4. Section 9.4 details using the frame results from frame class vision tools. Vision frames can also be created by locating different features of an object that uniquely identify the object’s location and orientation. Section 9.5 details creating computed vision frames. One method of creating a vision frame is not necessarily better than another, but in different situations you will find some methods more practical than others. 9.4 Vision Frames Generated by Vision Tools This section presents several examples of using vision tools to create vision frames. The first example checks the angle of a key way in a pulley. An arc finder is used to locate the center of the pulley. An arc ruler is then placed relative to the center located by the arc finder. Figure 9-1 shows the setup of this inspection. Notice that the pulley must still fall within the arc finder, and the key way is limited to about 300° of rotation. 140 VisionWare User’s Guide, Rev. A Vision Frames Generated by Vision Tools An arc finder locates the center of the pulley. The center point is used as the origin of a new vision frame. An arc ruler is placed relative to the new vision frame. Whenever the vision frame center moves (based on the center found by the arc finder), the arc ruler will move with it. Figure 9-1 Vision Frame Relative Arc Ruler The orientation of a vision frame returned by an arc finder is considered to be parallel to its frame and the resulting vision frame has the same rotation. This type of frame is translational only. Other vision tools produce frames with a rotation that depends on what the vision tool finds. This type of vision frame is a full vision frame. In the next example, the orientation of the vision frame is critical, and a vision tool returning a frame having a unique orientation is used. In this example, a prototype finder is used to create a vision frame. Individual linear rulers are then used to measure the distance from the edge of the calculator to the individual keys. The center and orientation of the prototype are determined during prototype training (see Chapter 8). The resulting frame is shown in Figure 9-2. VisionWare User’s Guide, Rev. A 141 Chapter 9 - Frame Relative Records Prototype Finder Linear rulers are placed relative to the new vision frame. Whenever the vision frame moves, the linear rulers will move with it. Figure 9-2 Vision Frame Relative Linear Rulers 9.5 Computed Vision Frames There are several ways of creating a computed vision frame, most of which rely on using vision tools to identify object features. There are two special frames that do not require any other vision tool records: fixed frames and null frames. The frames that can be computed based on object features are: • Frame origin, a point on the X axis, and a point in the positive Y direction • Frame origin and a point on the positive X axis 142 VisionWare User’s Guide, Rev. A Computed Vision Frames • A line and a point in the positive Y direction • A line for the X axis, and a line through the origin To create a computed vision frame record: Module ➡ Select/Edit ➡ highlight resource module Edit ➡ Vision ➡ Edit ➡ New Record ➡ Select When the new record pop-up window is displayed, enter a name for the new record, select Frame and choose OK . When the new computed frame record is displayed, select a computed frame method (see below). After a computed frame method has been selected (other than null or fixed), data boxes will appear that require source records for the vision tools that will be used to compute the frame. When all the source records have been entered, the vision frame will be displayed in the vision window. If the yellow warning sign appears next to any of the source records, check to make sure the records have been defined and that their source records have been properly defined. If all records are properly defined, the warning sign indicates that a tool (usually a finder tool) has failed to return the required data and the computed frame record does not have sufficient information to create a vision frame. Fixed Frame and Null Frame To create a fixed frame, you specify a point that forms the frame origin, and a rotation for that frame. The location of the fixed frame can be set by entering values in the location data boxes, or by using the mouse to drag and rotate the frame to a new location.Use a fixed frame when you intend to use a computed vision frame later, but have not yet defined the source records. A fixed frame can be changed to a computed frame at any time. (A fixed frame can be relative to another vision frame.) To create a null frame, simply select Null frame in the computed frame record. A frame identical to the camera coordinate frame will be created. Null frames are useful when you have a group of vision tools that you are going to later re-position as a group. Create the tools relative to a null frame and then change the null frame to the desired frame type. All the tools will now be relative to the new vision frame location. Frame Origin, a Point on the X axis, and a Point in the Positive Y Direction This method of creating a vision frame involves locating a point to serve as the origin of the computed frame, locating another point on the X axis (positive or negative), and locating a point anywhere in the positive Y direction. Figure 9-3 shows a computed frame being created for the sample object. The frame’s origin is created by a point finder that locates the tail of the object. The X axis point is located by an arc finder that locates the circular hole in the object. The resulting computed frame goes through the tail of the object and the middle of the circular hole. The point in the positive Y direction is created by a blob finder that locates the polygon shaped hole in the sample object. The frame resulting from the tools shown in Figure 9-3 has the positive Y axis pointing down. VisionWare User’s Guide, Rev. A 143 Chapter 9 - Frame Relative Records Notice that the sample object is not free to enter the field of view in any location or orientation. Its movement and rotation must be such that all the points being looked for fall within the vision tool search areas. Arc finder: Locates point on X axis +X Point finder: Locates frame origin +Y Figure 9-3 Computed Frame, Three Point Method 144 VisionWare User’s Guide, Rev. A Blob Finder: Locates point in positive Y direction Computed Vision Frames Frame Origin and a Point on the Positive X Axis The next method creates a frame from a point specifying the frame origin and a point on the positive X axis. Figure 9-4 shows two line finders being used to create a computed point at the tail of the object to serve as the frame origin. A point finder locates the edge of the object to serve as the positive X axis point. Line Finder 2 Computed Point: Frame origin Line Finder 1 +X Point Finder: Point on positive X axis +Y Figure 9-4 Computed Frame, Two Point Method NOTE: To make the examples as clear as possible, none of the vision tools overlap each other. However, this need not be the case. Vision tools can overlap each other and will still work properly. VisionWare User’s Guide, Rev. A 145 Chapter 9 - Frame Relative Records Line and a Point in the Positive Y Direction The next method of creating a frame involves specifying a line to use for the X axis of the computed frame, and specifying a point in the positive Y direction relative to that line. Figure 9-5 shows a computed frame being created from the line returned by a line finder and the centroid of a found blob. This frame’s X axis will follow the left edge of the object and the Y axis will go through the centroid of the object. Blob Finder: Locates the centroid of the object +Y Centroid of object Line Finder: Locates an edge of the object +X Figure 9-5 Computed Frame, Point and Line Method 146 VisionWare User’s Guide, Rev. A Making Vision Tools Relative to a Vision Frame A Line for the X Axis, and a Line Through the Origin This method uses two lines to compute a frame. This first line identifies the X axis, and the second line identifies the origin point on that axis (but not the Y axis line). Blob Finder: Identifies line through origin point (minimum radius) +Y +X Line Finder: Locates an edge of the object Figure 9-6 Computed Frame, Two Line Method 9.6 Making Vision Tools Relative to a Vision Frame To make a vision tool relative to a vision frame: 1. From the vision tool record, select ✔ Relative (usually in the Tool Loc pop-up window). 2. Enter a computed frame record name in the data box that is displayed. 3. Position the vision tool in its proper location relative to the displayed computed frame. 4. Whenever the computed frame moves (based on new image data), now the vision tool also moves. VisionWare User’s Guide, Rev. A 147 Chapter 9 - Frame Relative Records NOTE: If you select a vision frame that causes a vision tool to be placed out of the vision window and then attempt to edit that tool, VisionWare asks you if it is okay to reset the tool location values so they are within the vision window. If you accept this option, the tool is relocated to the center of the window. When you have finished editing the tool, you may have to relocate it so that it is placed in the correct location relative to the vision frame. NOTE: Fixed frames can themselves be relative to other vision frames. Tutorial: Creating a Vision Frame Relative Arc Finder In this tutorial we will create the vision frame shown in Figure 9-4. This frame will be used as a vision frame for an arc finder tool that measures the radius of the circular hole in the sample object. A. Create an Inspection Record Create a new inspection record: a. Module ➡ Select/Edit Edit ➡ Vision ➡ highlight “vwtutor” ➡ Select b. Press the NEW key (F2), and when the new record window is displayed: c. Enter “new.rel.rec” ➡ Inspection ➡ OK When the new inspection record is displayed, select Measure as the inspection type. - Choose Select new operation, and from the displayed pop-up window, select Circle radius, and choose OK . B. Create an Arc Finder Record 1. Create a new record: a. Double click the CIRCLE name data box. b. When the select circle window is displayed, choose New . (If no circle class records have been defined, this step is skipped.) A new window appears titled Specify New Record Name and Type. c. When the new circle window is displayed, type new.rel.crc.fdr in the Name data box, select Circle Finde r, and choose OK . Double click new.rel.crc.fdr in the Circle name field of the Inspection window. 2. When the new arc finder record is displayed, select the correct modes of operation: a. Select Full circle(Shape group). b. Select Inside of arc is: Light. c. Select Find arc’s: Both. d. Select Closest to: Inside. 3. Make the arc finder a frame relative tool: a. Choose Tool Loc . 148 VisionWare User’s Guide, Rev. A Making Vision Tools Relative to a Vision Frame b. From the displayed pop-up window, select ✔ Relative. c. A data box will appear after ✔ Relative to. Double click this data box. d. When the select frame window is displayed, choose New . C. Create a Computed Frame 1. When the new frame record window is displayed: enter “new.vis.frm” ➡ dbl clk Computed Frame ➡ OK ➡ dbl clk “new.vis.frm” a. When the frame record is displayed, select Origin, POINT on +X axis. 2. Create a record for the origin point: a. Double click the Origin POINT data box. b. Choose New . A new point record window is displayed. c. Enter new.comp.pt in the Record Name data box. d. Double click Computed Point and choose OK . e. Double click new.comp.pt. When the computed point record is displayed, select LINE-LINE intersection. 3. Create the first line finder tool (two line finders will be used to compute a point used as the frame origin): a. Double click the LINE 1 data box and when the Select Line window is displayed, choose New . A window appears titled Specify New Record Name and Type. b. In this window type new.ln.fdr1 in the Name data box, double click Line Finder, and choose OK . c. Double click new.ln.fdr1. Size and position the line finder tool as shown in Figure 9-4. d. Return to the computed point record: e. Go ➡ Back 4. Create the second line finder: a. Double click the LINE 2 data box and when the select line window is displayed, choose New . b. When the new line record window is displayed, enter new.ln.fdr2 in the Name data box, select Line finder, and choose OK . c. Double click new.ln.fdr2. Size and position the line finder tool as shown in Figure 9-4. 5. Return to the computed frame record: Go ➡ Tree ➡ Go to root ➡ dbl clk the ‘new.vis.frm’ icon 6. Create the X axis point record: a. Double click the PT on + X axis data box and when the Select Point pop-up window is displayed, choose New . b. Enter new.pt.fdr in the Name data box, double click Point Finder, and choose OK . VisionWare User’s Guide, Rev. A 149 Chapter 9 - Frame Relative Records c. Double click new.pt.fdr. Size the tool as shown in Figure 9-4. D. Complete the Arc Finder Record 1. Return to the arc finder record: Go ➡ Tree ➡ Go to root ➡ double click ‘new.rel.crc.fdr’ icon 2. Edit the arc finder tool: a. Use the center drag handle to move the tool over the center of the round hole in the sample object. b. Use the size drag handles to make the inner radius (light blue) of the window tool slightly larger than the round hole in the sample object. E. Complete the Inspection Record 1. Return to the inspection record: Go ➡ Tree ➡ Go to root ➡ double click ‘new.rel.rec’ icon 2. Enter the pass-fail criteria: a. Enter 5.25 in the Nominal data box. b. Select ✔ Gather stats. c. Choose Limits . d. Enter 5.5 in the Maximum limit data box. e. Enter 5 in the Minimum limit data box. 3. Check the results: a. Choose Test run inspection. b. View the results in the Latest Test Run group. 150 VisionWare User’s Guide, Rev. A Making Vision Tools Relative to a Vision Frame Vision Frame Relative Inspection Tree Figure 9-7 shows the vision record tree resulting from the preceding tutorial. Figure 9-7 Vision Frame Relative Inspection Tree VisionWare User’s Guide, Rev. A 151 Repeating and Combining Operations 10 10.1 Looping in VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Repeat Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Value Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 10.2 Examples Using Combination-Repeat Pairs. . . . . . . . . . . . . . . . . . . . . . . 155 Example 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Example 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Additional Observations of Interest . . . . . . . . . . . . . . . . . . . . . . . . 161 Restrictions on Combination-Repeat Loops . . . . . . . . . . . . . . . . . . . . . 163 VisionWare User’s Guide, Rev. A 153 Chapter 10 - Repeating and Combining Operations 10.1 Looping in VisionWare In many cases, you may want to repeat the same vision operation, or group of operations, at several different locations. This is referred to as looping; VisionWare allows a limited form of looping. In looping, a specified subsection of a vision tree is repeated multiple times. Two records are required to define the subtree that is repeatedly executed. The first record is a combination record. This record defines the top of the subtree. The second record must be a repeat record (Table 9.2). This record defines the bottom of the subtree. At minimum, all looping inspections require these two records, called combination-repeat pairs. Repeat Records Repeat records are records that can produce more than one instance of a particular result. For example, a blob finder record normally returns information about a single blob. You might use blob finder results to inspect one of the blob’s features, or use the blob’s position as a reference frame for other vision tools. However, if there are multiple blobs in the field of view, you might want to inspect all blobs and calculate the average or standard deviation of a feature (perhaps the blob areas), or use the positions of the blobs as reference frames for another vision tool. These multiple operations can be performed by selecting the ✔ Repeat option in the blob finder record and then pairing the blob finder record with a combination record. The records listed in Table 10-1 can be used as repeat records. Repeat records do not compute results all at once, but one at a time as requested by the value combination record. For a blob finder, this avoids having to store all the statistics for each blob when only one (area, perhaps) is collected. Table 10-1 Repeat Class Records Record Type Repeat Values Returned Blob Finder Frame value for each blob found Blob found indicator Angle of found blob Radius of the major axis ellipse Radius of the minor axis ellipse Blob area Blob hole area Total area Number of hole Perimeter of blob Prototype Finder Frame value for each prototype found Prototype found indicator Percent of prototype verified Angle of prototype frame Frame Pattern A pattern of frames Arc Ruler A frame based on the X,Y value of each edge detected. Linear Ruler A frame based on the X,Y value of each edge detected 154 VisionWare User’s Guide, Rev. A Examples Using Combination-Repeat Pairs Combination Records Combination records work with repeat records to produce multiple results, one result for each time the repeat record is repeated. These results are combined and made available for use by other records. A combination record requires one source record that defines the top of the repeat tree. The repeat tree must have at least one unique repeat record in it; this record defines the bottom of the repeat tree for this combination record. (A unique repeat record is one that is not part of a nested combination-repeat pair.) When the combination record executes, it re-evaluates the repeat tree once for each repeatable instance of its repeat record. ! CAUTION: In VisionWare, a repeat record may be used by only one combination record in a single execution cycle of a sequence. Otherwise, the evaluation order of the repeated record is disrupted and your results may be invalid. Value Combination Records The only combination type record is a value combination record. See Section D.6 for details on editing a value combination record. Value combination records combine real or boolean values. The repeat tree record in the value combination record must be from the test-a-value class (Table 5-5). You select the value to combine from a pop-up window displayed from the value combination record. When real values are collected, the average, minimum, maximum, and standard deviation of the values collected are computed. When boolean values are collected, the total true, the total false, the logical AND, and the logical OR of the values collected is computed. Since value combination records are members of the test-a-value class, any results they generate are available to other vision records. 10.2 Examples Using Combination-Repeat Pairs Vision trees using combination and repeat records can get quite complicated, as nesting of combination-repeat pairs is allowed. Nesting can go as deep as memory constraints allow. To help you get a handle on combination-repeat strategies, we present three increasingly complex examples. The first case uses a blob finder record and a value combination record to return the average area of all blobs found within the tool search area. The second example uses a frame pattern record, an arc ruler record, and a value combination record to inspect the angular spacing of gear teeth. In this case, the arc ruler is relative to a frame pattern record. The value combination record executes multiple instances of the frame pattern record (and the arc ruler since it is relative to the frame pattern). Each time the frame pattern record generates a new frame, another instance of the arc ruler is generated. Since each instance of the frame pattern record creates a reference frame in a new location, the arc rulers are all placed and evaluated at different locations. The results of the multiple instances of the arc ruler are collected by the value combination record. The third example uses two frame pattern records, a ruler record, and two value combination records to inspect the leads on a Surface Mount Device (SMD). This example uses nested combination records. The ruler record calculates the width of a single lead. The ruler record is relative to a frame pattern record that provides reference frames for all leads on one side of an SMD. The first value combination record executes the multiple VisionWare User’s Guide, Rev. A 155 Chapter 10 - Repeating and Combining Operations instances of the frame pattern record so the ruler is placed and evaluated at all the leads on one side of the SMD. This frame pattern record is relative to the second frame pattern record, which provides reference frames for the four sides of the SMD. The second value combination record executes the multiple instances of the frame pattern record at the four sides of the SMD (thereby repeating the first frame pattern record on all four sides [thereby repeating the ruler at all six leads on all four sides]). Let’s look at each example in detail. The examples should give you a good idea of how to use combination-repeat pairs. Pay close attention to how the tree is structured for combination-repeat pairs. Understanding the tree structure is critical to using combination and repeat records. (Note: When displayed in the vision window, the names of repeat records are green in the vision record tree.) Example 1 Since blob finder records are both in the test-a-value class and can be repeat records, we can create a simple combination-repeat inspection using a value combination record and blob finder record. The blob finder is used to isolate and compute the area of multiple blobs. The value combination record uses the blob finder as both its top-of-tree (Repeat tree) and bottom-of-tree (Using each of) record. Blob area is selected as the value to collect. The value combination record repeatedly executes the blob finder, each time storing the blob area. When all repeat instances are exhausted, it computes the average, minimum, maximum, and standard deviation of the blob areas. A top-level inspection record is then used to evaluate one of the returned results. The record tree for this inspection looks like: 156 VisionWare User’s Guide, Rev. A Examples Using Combination-Repeat Pairs Figure 10-1 Combination Inspection Tree (Example 1) The records in the tree in Figure 10-1 have the following characteristics: The top_level_inspect record specifies a test-a-value inspection type. The value to test selected is Average value. The pass/fail criterion is based on the average area of all blobs found. The value_combination record specifies that the blob area be averaged. The blob finder record has the ✔ Repeat option selected. Example 2 In the second example, a circular frame pattern is used to generate multiple instances of an arc ruler to measure the average angular spacing of gear teeth. The vision tool layout is shown in Figure 9-2. VisionWare User’s Guide, Rev. A 157 Chapter 10 - Repeating and Combining Operations Frame pattern record Arc ruler First frame generated Figure 10-2 Combination Inspection (Example 2) In the above example, the arc ruler has been declared to be relative to a circular frame pattern. The frame pattern record generates seven reference frames, one for each gear tooth. The value combination record executes the seven frames and (since the arc ruler is relative to this frame) the resulting seven repetitions of the arc ruler. The angular measurements are averaged by the value combination record and returned to the Inspection record. The tree for this inspection is shown in Figure 10-3. Notice that the frame pattern record is not directly below the value combination record in the tree. When the inspection is evaluated, the value combination record searches down the repeat tree for the first unused repeat record. When a repeat record is found, that repeat tree is repeated the required number of times and the results collected by the value combination record. In this example, seven frames were specified in the frame pattern record. If the value combination record had specified that a maximum of five values be collected, after five instances of the arc ruler had successfully returned results, the repeat tree would not be repeated again. 158 VisionWare User’s Guide, Rev. A Examples Using Combination-Repeat Pairs Figure 10-3 Combination Record Tree (Example 2) The records in this tree have the following characteristics: • The top_level_inspect record specifies a test-a-value inspection type and the average value as the value to test. • The value_combination record specifies arc_ruler as the repeat tree record. Since arc_ruler is not a repeat record, the frame_pattern record is the Using each of record. • This repeat record cannot be used to repeat another vision tool within the same execution cycle of a VisionWare sequence. (If another vision tool must be placed at the same locations, make a copy of the frame_pattern record to use with that tool.) • The value_combination record specifies that the value to collect is the angle between the first and the last edge found by the arc_ruler. • The arc_ruler is declared to be relative to the frame_pattern record. Example 3 In this example we create a linear ruler to measure the width of a lead on a surface mount device. This record is declared to be relative to a frame pattern record that repeats six times, once for each lead on one side of the SMD. This frame pattern record is declared to be relative to another frame pattern record that repeats four times, once for each side of the SMD. The net result is the ruler that is repeated 24 times (6 times a side multiplied by 4 sides). VisionWare User’s Guide, Rev. A 159 Chapter 10 - Repeating and Combining Operations 1. A linear ruler is created to measure one lead. Ruler tool 2. The ruler is made relative to a Frame Pattern record returning a frame for each lead. Frame pattern record 1 3. The first Frame Pattern record is made relative to a second Frame Pattern record returning a frame for each side of the SMD. Frame pattern record 2 Figure 10-4 Combination Record (Example 3) The tree for this example is shown in Figure 10-5. Note how the value combination records combine with the frame pattern records. The inner nested combination record finds the first repeat record below it in the tree and pairs up with that record. When the second value combination record goes looking for a repeat record, the first one it finds is used, so it moves to the next frame pattern record and pairs up with that record. 160 VisionWare User’s Guide, Rev. A Examples Using Combination-Repeat Pairs Figure 10-5 Combination Record Tree (Example 3) The records in the tree in Figure 10-5 have the following characteristics: • The value top_level_inspect is receiving is the average of the values returned from the four repetitions of frame_pattern_2 executed by value_combination_2. Each of these repetitions returns the average of the six repetitions of frame_pattern_1’ executed by value_combination_1. • The Repeat tree record for value_combination_2 is value_combination_1, and the Using each of record is frame_pattern_2. • The Repeat tree record for value_combination_1 is the ruler_record, and the Using each of record in frame_pattern_1. Once you understand how the tree is evaluated by the pairing of combination and repeat records, these complicated inspections are easily built. • The ruler record does not have the ✔ Repeat option selected. Additional Observations of Interest If you wanted to add records that would allow you to inspect an entire pallet of SMDs at once: 1. Create a new combination record and select value_combination_2 as its Repeat tree record. 2. Create a new frame pattern record that creates a rectangular grid of frames that corresponds to the number of rows and columns of SMDs on the pallet. VisionWare User’s Guide, Rev. A 161 Chapter 10 - Repeating and Combining Operations 3. Declare frame_pattern_3 to be relative to this new frame pattern record. The ruler_record will be repeated twenty-four times for each SMD in the pallet. This inspection only looks at lead width. To test lead spacing, a nearly identical inspection tree can be built to measure the average spacing. If you are measuring items that are not regularly spaced like SMD leads, a linear ruler can be used in place of frame_pattern_1. The ruler record then requires that the ✔ Repeat option is selected. The ruler record would then return the point values for each edge found. These point values would be used as origins for multiple reference frames for another linear ruler that actually performs the measurement (similar to the arc ruler in example 2). If the initial placement of the item being inspected is not known precisely, the bottommost repeat record in the tree can be made relative to a frame class record that properly positions the repeat records. Remember, by the time a result gets back to the top-level inspection record, only one value is being evaluated. You can look only at the selected statistical or boolean result, not each individual value. If you placed an Inspection record between the value combination and linear ruler record, I/O signals could be set based on each measurement, and individual results could be reported to the vision results page and logged with the data logger. A sample tree for this inspection strategy would look like: Figure 10-6 Repeat Tree With Multiple Inspection Records 162 VisionWare User’s Guide, Rev. A Examples Using Combination-Repeat Pairs Restrictions on Combination-Repeat Loops For combination-repeat loops that use Prototype Finders or Blob Finders as their repeat record, the following restriction exists: There cannot be any other Prototype Finders or Blob Finders in the subtree under the combination record that do not also appear under the repeat record’s subtree. In Figure 10-7, trees 1-3 are invalid trees and 4-6 are valid trees. Invalid combination-repeat trees 1. 2. VC 3. VC VC VC BP1 BP2 BP2 BP1 BP1 BP2 Valid combination-repeat trees 4. 5. VC 6. VC VC BP1 BP1 BP2 BP2 BP2 BP2 BP2 BP1 BP2 BP1 Blob/Prototype Finders VC Value Combination Other Vision Rec Repeat Record Figure 10-7 Valid and Invalid Combination-Repeat Trees VisionWare User’s Guide, Rev. A 163 Viewing and Recording Vision Results 11 11.1 Viewing Vision Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Displaying Tool Graphics During Sequence Execution . . . . . . . . . . . . 166 11.2 Displaying Vision Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Recent History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 11.3 Inspection Results Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 11.4 Inspection Results Page Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 11.5 Charts of Inspection Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 11.6 inspection Chart Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 Inspection Charts for Boolean Inspections . . . . . . . . . . . . . . . . . . . . . . 171 11.7 Logging Vision Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 The Form of the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 The Output File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 The Shifted Process Capability Index. . . . . . . . . . . . . . . . . . . . . . . . . . 173 VisionWare User’s Guide, Rev. A 165 Chapter 11 - Viewing and Recording Vision Results 11.1 Viewing Vision Graphics Vision graphics are divided into two groups. The first group includes graphics that represent the tool. These graphics show the tool’s size and orientation. The second group includes graphics that represent the results generated by the tool. These graphics include point, line, circle, and frame results, the results of measurements, and the success of finder tools. Both groups of graphics are displayed whenever you are editing a vision tool. (In the case of a tool returning multiple results, you must choose a Show button to see all results.) Displaying Tool Graphics During Sequence Execution During execution, you can choose which graphics to display. To toggle the display of vision tool graphics, perform: Show ➡ Runtime Graphics1 If the vision window is not displayed, select: adept ➡ Vision Tool graphics are displayed only for those records where the ✔ Show at runtime option was selected. To see the graphical results of inspections (as well as the tool graphics), select ✔ Walk Thru. All vision graphics will be displayed regardless of the setting of the ✔ Show at runtime option in the individual vision records. Execution is slower when any graphics are displayed. 1 To have runtime graphics display disabled at startup: Setup ➡ Initialization Data ➡dbl clk ‘visini.db’ Seek ➡ Index ➡ dbl clk ‘vision display mode, default’ Select 166 Off. VisionWare User’s Guide, Rev. A Displaying Vision Results 11.2 Displaying Vision Results The accumulated statistics for an executing sequence (or the most recently executed sequence) can be displayed by selecting: Show ➡ Vision Results The menu page shown in Figure 11-1 is displayed. The scrolling window on this page shows all inspection records used in the current sequence and the percentage of those inspections that have passed. Recent History The Statistics Summary section of the inspection results page summarizes the recent history of the selected inspection. By default, recent history is 50 bins of inspections. The number of bins in recent history can be changed by: Setup Seek ➡ Initialization Data ➡dbl clk ‘visini.db’ ➡ Index ➡ dbl clk ‘stats, number of bins’ In the Value data box, enter the number of bins that should be included in recent history. (This change will not take place until VisionWare has been restarted.) The recent history number also determines the number of points plotted on the inspection charts. Setting recent history too high makes the charts difficult to read. The number of bins in an inspection is set in the inspection record. By default, bin size can range from 1 to 10 for numeric results and 1 to 10,000 for boolean results. The default bin limits can be changed by: Setup Seek ➡ Initialization Data ➡dbl clk ‘visini.db’ ➡ Index ➡ dbl clk ‘stats, max bin size, real (or boolean)’ In the Value data box, enter the maximum number of inspections that can be placed in a bin. (This change will not take place until VisionWare has been restarted.) VisionWare User’s Guide, Rev. A 167 Chapter 11 - Viewing and Recording Vision Results 11.3 Inspection Results Page This menu page displays the statistics gathered for all top-level inspection records in a sequence that have the ✔ Gather stats option selected. ➊ ➌ ➋ ➍ ➎ ➏ ➐ ➑ ➒ Figure 11-1 Inspection Results Page 11.4 Inspection Results Page Options ➊ ➋ This area shows the inspection records that were used in the most recently executed (or executing) sequence (provided the ✔ Gather stats option was selected in those records). The current inspection is the highlighted inspection. Click an inspection to make it the current inspection. The statistics summary is for the current (highlighted) inspection. ➊ Choose to 0. All to reset the recent history statistics of all inspections listed in item Choose Current to reset the recent history statistics for the highlighted inspection. ➌ Choose Update % passed to force an update of item ➊. The other statistics are updated at regular intervals. 168 VisionWare User’s Guide, Rev. A Inspection Results Page Options ➍ ➎ ➏ ➐ ✔ Accum. stats must be selected to accumulate inspection statistics. If this option is deselected, statistics accumulation will stop. Shows the name of the inspection and the specific operation that is being summarized. Shows the results of the most recent inspection. (Deviation is not shown for boolean inspections.) Shows the recent history for the selected inspection. If All bins is selected, recent history is for all bins in recent history (see “Recent History” on page 167). If Last full bin is selected, the history summary is for the last full bin. The bin size is set in the inspection record (see section D.1). (For boolean inspections, only passed, failed, and total are shown.) Choose Chart to display statistical histograms for the highlighted inspection. The results of the selected inspection are charted (see the next section). ➑ ➒ Shows the inspection criteria defined in the inspection record (see “Pass/Fail Criteria for Numeric Values” on page 77). (For boolean inspections, only nominal is shown.) Shows the number of inspections that passed, the number that failed, and the total number of inspections considered in the recent history calculations. VisionWare User’s Guide, Rev. A 169 Chapter 11 - Viewing and Recording Vision Results 11.5 Charts of Inspection Results When the Chart button is chosen from the Inspection Results window, the following screen is displayed: ➊ ➋ ➌ ➏ ➍ ➎ Figure 11-2 Charts of Inspection Results 11.6 inspection Chart Options ➊ ➋ ➌ ➍ ➎ 170 This graph reports the average inspection value. Each node represents the average o one bin of inspections. The number of inspections in a bin is specified in the Bin size data box in the inspection record for the inspection being charted. The axes change depending on the inspection and the values returned from that inspection. If ✔ Auto-scale is selected, the Y axis of the X chart will automatically be scaled to fit the data. If it is not selected, the Y axis scaling will be based on the minimum and maximum limits specified for the inspection unless a result exceeds the limits, then the axis will be scaled to show all results. This chart represents the maximum deviation of the values reported in a bin. The units change depending on the inspection and the values returned from that inspection. The X axis represents the total number of inspections considered as recent history. The range of values change depending on the value entered into the Bin size data box in the inspection record for the inspection being charted. Shows the inspection being charted and the specific operation being performed by that inspection. Select the reference lines you want displayed on the charts: VisionWare User’s Guide, Rev. A Logging Vision Results Running average is the average of all inspections charted. Upper/lower control limits represent approximately 3 standard deviations from the average. Nominal value is the nominal value specified in the inspection record (numeric values only). Pass/fail limits shows the minimum and maximum limits specified in the inspection record (numeric values only). Warning limits shows the high and low warning limits specified in the inspection record (numeric values only). ➏ Choose this button to close the Inspection Results window. Inspection Charts for Boolean Inspections When boolean inspections are charted, a single chart is displayed showing the percent of inspections passed per bin. 11.7 Logging Vision Results The VisionWare data logger allows you to record the results of an inspection to a disk file, or to output the results to one of the user serial lines on the controller. (See the controller user’s guide for details on connecting to the user serial lines.) There are three steps to using the data logger: 1. For each inspection record that requires data logging: a. On the inspection record, select one item from: - Log all results - Log warnings and failures only - Log failures only - Log nothing b. In the Label for data item in file data box, enter a label to be placed in front of each result line that is logged (optional). 2. Enable logging of results: a. Perform I/O ➡ Log Results. b. Select ✔ Log vision results. c. Specify a serial line or file name to which to output the results. If a number from 1 to 5 is entered, the results will be passed to a serial line. Lines 1 to 3 correspond to the three serial lines on the SIO board, and lines 4 and 5 correspond to the two serial lines on the system processor that is running AIM. Any other entry is considered a file name (and must conform to disk file name conventions). If an extension is not specified, .LOG is added as the default extension. d. Choose Done . If a serial line was specified, that serial line is now attached and ready for output. If a file name was specified, that file is now open on the default disk and ready to be written to. VisionWare User’s Guide, Rev. A 171 Chapter 11 - Viewing and Recording Vision Results e. Set the update interval (in seconds) at which accumulated statistics will be written. The following values have special meaning: –1 Results are written only when the system buffers are full. 0 Results are written at the end of each cycle of a sequence. NOTE: Results cannot be written any more often than once every cycle. If your sequence takes three seconds to complete and you have entered two seconds as the update time, results will be updated only every three seconds. Writing results slows sequence execution significantly. • Execute a sequence. The results from any inspection records with the ✔ Log vision results option selected are output to the file or serial line. Results logging can be enabled1 at startup by: Setup Seek ➡ Initialization Data ➡dbl clk ‘visini.db’ ➡ Index ➡ dbl clk ‘results log enable’ Select On. (This change will not take place until VisionWare has been restarted.) The Form of the Results The results output has the following form: label, pass/fail indicator, returned value CR/LF label the label entered at the inspection record pass/fail indicator 0 indicates the inspection failed. 1 indicates the inspection passed. 2 indicates inspection passed but exceeded high warning. 3 indicates inspection passed but exceeded low warning. returned value the real or boolean value returned by the inspection CR/LFeach line is terminated with a carriage return/line feed In addition to the information for each completed inspection, the following information is also output: Date and time stamped lines indicating that logging has been enabled or disabled. These lines always begin with a dollar sign ($). An indication that the results summary on the results page has been zeroed. This line has the form: $ZERO label (This line is also placed in the output if a change was made to the result’s section that would affect statistics gathering.) 1 The default log file name and update interval can also be set. 172 VisionWare User’s Guide, Rev. A Logging Vision Results The Output File When results logging is started, the system looks for a file on the default drive that matches the file name entered. If a matching file is found, that file is opened and appended to. If a file is not found, a new file is opened. The output file name can be changed during sequence execution. When a new file name is entered, the existing file is closed, the new file is opened or created, and data logging flows uninterrupted to the new file. The programs for generating logging results can be modified to suit your needs. The programs are in the file QCLOG.V2. The Shifted Process Capability Index The Cpk value (Capability Index adjusted for a shift of k) is computed as follows: (1) Cpk = MIN((avg - min),(max - avg))/(3σ) where min and max are the low and high ends of the tolerance specification and avg and σ are the mean and standard deviation for the data set, respectively. The meaning could be expressed as “the distance (in units of 3σ) that the average is from the nearest tolerance limit.” An alternate way to compute Cpk is as follows: (2) Cpk = (1-k) Cp where: k = ABS(D-m)/(T/2) Cp = T/6σ (the unshifted Capability Index) σ = standard deviation T = tolerance or spec width (MAX-MIN) m = mean of samples D = design nominal Formula 2 assumes that the design nominal is at the center of the tolerance range. This formula is identical to formula 1 only when the design nominal is centered in the tolerance range (i.e., at (MAX+MIN)/2). Formula 2, however, loses meaning and may actually be misleading, when the nominal is not centered in the tolerance. Cpk is used to determine how “safe” your process is, that is, how unlikely it is to exceed tolerances. Formula 1 (used by VisionWare) returns meaningful results for non-centered as well as centered nominal values. When using a non-centered nominal, the objective of achieving a C p > 2 and a Cpk > 1.5 for a 6σ process can be evaluated reliably only when using a Cpk that is based on the distance from the limits, such as the formula used by VisionWare. If you have been using formula 2 with non-centered specifications, your results may be different from the ones returned by VisionWare. VisionWare User’s Guide, Rev. A 173 Using Digital I/O 12 12.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 12.2 Installing Digital I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 Displaying the State of Digital I/O Signals . . . . . . . . . . . . . . . . . . . . . . 176 12.3 Digital I/O Signal Numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Soft Signals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Special Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Negative Signal Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 12.4 Using Digital I/O With Vision Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 12.5 Using Digital I/O Statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 WAIT_FOR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 WAIT_UNTIL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 IO Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 IO_LIST Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 VisionWare User’s Guide, Rev. A 175 Chapter 12 - Using Digital I/O 12.1 Introduction Digital I/O provides you with a way of communicating with other devices in your workcell. Digital input allows your sequence to suspend or resume execution based on feedback from a switching device in the workcell. The state of digital input signals can be controlled by almost any type of switching device. Closing a microswitch when an object is in the correct location is a common use of digital input. Digital output allows a sequence to signal devices in the workcell to begin or suspend operation. Digital output acts as a switch to open or close the current being supplied to the device. (Digital output switches the current: it does not provide it.) Common uses of digital output are controlling conveyor motors or part feeders and activating warning lights or sound devices. 12.2 Installing Digital I/O Before a sequence can use the digital I/O capabilities, the following steps must be taken: • Install the devices that generate or receive digital signals in the workcell. • Install the physical digital I/O equipment in your controller. This installation is covered in the controller user’s guide that came with your controller. Your controller may not be equipped to use all available digital signals. To see which digital I/O signals are installed in your system: adept ➡ Monitor ➡ enter IO The status of all digital I/O signals will be displayed. The digit “1” indicates that the signal is installed and is on. The digit “0” indicates that the signal is off. The character “–” indicates that the signal is not installed. To terminate the digital I/O display, hold down the CONTROL key and type c. Displaying the State of Digital I/O Signals The states of digital I/O signals can be set and/or viewed by performing: I/O 176 ➡ Digital Signals VisionWare User’s Guide, Rev. A Digital I/O Signal Numbering Figure 12-1 Digital I/O Control This display shows only the signals that are installed in your controller. The input, output, and soft digital signal ranges are displayed. Either use the slide bar to select the desired digital signal or enter the desired signal value into the data box next to the slide bar. Click the On or Off button to set the desired state of output or soft signals. The digital signal remains in this state until a sequence or program instruction changes the signal. If a signal has not been installed, you cannot select the signal number. 12.3 Digital I/O Signal Numbering Digital input signals are differentiated from digital output signals by the range of numbers that each falls within; each range is limited to a maximum of 512 signals. Digital input signals must be in the range from 1001 to 1512, and digital output signals must be in the range from 1 to 512.1 Soft Signals There is an additional range of I/O signals from 2001 to 2512 that can be used with VisionWare. This range of signals, referred to as soft signals, are set by the system software and do not require hardware support. Soft signals are always available for use (although the range from 2005 to 2032 are reserved for use by Adept software). Soft signals can be used anywhere input or output signals are specified. Special Signals The range (3000-3008) performs special functions for Adept robots. See your robot user’s guide for details on use of any of these special signals. 1 Signals 9 - 31 and 1013 - 1031 are not available. VisionWare User’s Guide, Rev. A 177 Chapter 12 - Using Digital I/O Negative Signal Numbers When digital signals are set, they are set to a given state (not changed from the existing state). When VisionWare is instructed to set a positive output signal number, that signal is turned on. If the signal is already on, its state is not changed. When VisionWare is instructed to set a negative output signal number, that signal is turned off. If the signal is already off, its state is not changed. Similarly, if VisionWare is instructed to wait for a positive input signal, it will suspend execution until the signal is on. If the signal is already on, execution will not be affected. If VisionWare is instructed to wait for a negative input signal, it will wait until the signal is turned off. If the signal is already off, execution is not affected. 12.4 Using Digital I/O With Vision Records Digital output and soft signals can be set from an inspection record. In the Results group of an inspection record is the check box ✔ Pass-fail I/O signal. Select this option to display a data box into which you enter a digital output or soft signal number. Output signal numbers must be in the 1 to 512 range, and the signal must have been configured as an output signal. When this inspection is executed, the digital signal is set depending on whether the inspection passes or fails. If the inspection passes, the signal is set to the indicated state. If the inspection fails, the signal is set to the opposite state. (If a negative signal is entered, a failed inspection turns the signal on.). Digital output and soft signals can be set from the picture record. In the Modes of Operation group, select ✔ Output I/O signal to set the specified signal after each image acquisition by the picture record. Digital input signals can be monitored from a picture record. In the Modes of Operation group, select Wait for I/O signal and a data box will be displayed into which you enter a digital input number. When this record is called on to acquire a new picture, sequence execution will be suspended until the signal is turned on. If the signal is already on, execution will not be affected. An external trigger is a special input signal that eliminates the slight delay possible with the normal input signals. Your hardware must support, and be configured for, the external trigger. See the controller user’s guide and the CONFIG_C utility. 12.5 Using Digital I/O Statements There are four statements that control digital I/O signals, WAIT_FOR, WAIT_UNTIL, IO_LIST and IO. WAIT_FOR Statement The WAIT_FOR statement has one required and two optional arguments. The required argument is a constant that requires a digital signal. When a WAIT_FOR statement is encountered in a sequence, the sequence will suspend until the specified signal achieves the correct state. The syntax for WAIT_FOR is: WAIT_FOR --input-- {OUTPUT --output-- {PULSE --constant--}} 178 VisionWare User’s Guide, Rev. A Using Digital I/O Statements If the statement: WAIT_FOR dev_ready is encountered in a sequence, the sequence will suspend until digital signal specified in the variable database record dev_ready is turned off (if the signal is already off, the sequence will not wait).1 The optional arguments to the WAIT_FOR statement allow you to specify a digital output signal to set and duration for output signal pulse. If the statement: WAIT_FOR dev_ready {OUTPUT dev_run {PULSE 10}} is encountered in a sequence, the sequence suspends until the digital signal specified in dev_ready is turned on. When this digital signal is on, execution resumes and the digital output signal specified in the variable database record dev_run is turned on for 0.1 seconds. (The constant replacing the PULSE argument is multiplied by 0.01 seconds to indicate the total duration of the signal change.) If a pulse argument is not entered, the specified digital output signal remains on. If either the digital input or output signals are already at the indicated state, their state is not changed. WAIT_UNTIL Statement The syntax for WAIT_UNTIL is: WAIT_UNTIL {--uopr--} --variable-- {--opr-- --variable-{--opr-- --variable-- {opr-- --variable-- {--opr-- --variable-{--opr-- --variable--}}}}} {TIMEOUT --constant--} WAIT_UNTIL is similar to WAIT_FOR, however, it allows more complicated conditions to be evaluated. The statement has one required argument, a digital signal number or record from the variable database that specifies a digital signal number (--variable--). If only this argument is specified, sequence execution will halt until the signal is correctly set. The required --variable-- can be preceded with a keyword from the list of unary operators (this operation is applied after all clauses in the statement have been evaluated). NOT is the most commonly used unary operator. The optional --variable-- arguments also take a digital signal number or record from the variable database that specifies a digital signal number. Each signal can be preceded with a keyword from the list of operators. AND and OR are the most commonly used operators. The final option argument in this statement is a TIMEOUT value. This value sets the maximum time (in 0.01 seconds units) that the sequence will pause waiting for the correct states of the specified digital I/O signals. IO Statement The IO statement has one required and two optional arguments. The required argument is a constant that requires a digital output signal number. When an IO statement is 1 In all cases where a digital signal is expected, a minus (–) can precede the signal number or variable name. This inverts the sense of the signal. Thus “WAIT_FOR -1003” waits until signal 1003 is low. VisionWare User’s Guide, Rev. A 179 Chapter 12 - Using Digital I/O encountered in a sequence, the specified digital output signal will be set to the specified state. The syntax for IO is: IO {WAIT_FOR --input--} OUTPUT --output-{PULSE --constant--} If the statement: IO OUTPUT test.sig is encountered in a sequence, the digital output signal specified in the variable test.sig is turned on. The optional arguments to the IO statement allow you to wait for an input signal before signaling the output signal and specify a duration for the state change of the output signal. If the statement: IO {WAIT_FOR -1012} OUTPUT -20 {PULSE 5} is encountered, execution suspends until the digital input signal 1012 is turned off. When signal 1012 is turned off, digital output signal 20 is turned off for 0.05 seconds. Execution resumes at the next statement. IO_LIST Statement This statement allows you to set up to 12 output signals at the same time. The syntax is: IO_LIST --output-- {--output-- {...}}}}}}}}}} 180 VisionWare User’s Guide, Rev. A Vision Basics 13 13.1 Pixel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Computer Image Analysis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.2 Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 13.3 Grayscale vs. Binary Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 Contrast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 13.4 Camera Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 13.5 Blobs and Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Holes in Blobs or Prototypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 13.6 Lighting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 13.7 Lighting Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Diffuse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Back . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Directional. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Structured . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 Strobe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 13.8 Filtering and Special Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Polarizing Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Color Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Infrared Filters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 VisionWare User’s Guide, Rev. A 181 Chapter 13 - Vision Basics 13.1 Pixel The basic unit of a vision image is a pixel (picture element). It is the smallest unit of information a vision system can return to you. The number of pixels the system can process determines the system’s resolution and affects the computer processing time needed to analyze an image. A pixel can be thought of as a single cell in a matrix that the camera overlays on the field of view (FOV). The value that is placed in a cell (pixel) is a shade of gray that represents the intensity of the light reflected from the corresponding area in the field of view. This ability to analyze an image based on intensity values is referred to as grayscale vision. Figure 13-1 shows how a 22 x 16 pixel camera sees the sample object. (The dashed lines are shown for reference; they are not actually “seen” by the system.) Figure 13-1 A Grayscale Image In addition to grayscale processing, VisionWare can process image data in binary mode. In binary mode, all the cells with a value above a certain value are seen as white and those below that value are seen as black. Figure 13-2 shows how the sample object is seen in binary mode. Figure 13-2 A Binary Image 182 VisionWare User’s Guide, Rev. A Resolution Computer Image Analysis The computer system uses the information extracted from the matrix of pixels to perform vision tasks. The rulers, windows, and other tools VisionWare provides you with look at the matrix and return information about object size, relative location, feature recognition, and object identification. 13.2 Resolution The camera representation of our hypothetical 22 x 16 camera shows very poor resolution due to the low density of pixels. VisionWare uses an array of approximately 512 x 484 pixels. In addition to the number of pixels in the camera array, the lens focal length combined with the distance of an object from the camera has the greatest effect on the final resolution of whatever you are viewing. Figure 13-3 shows the relationship between focal length and viewing distance. In general, the best resolution comes when the object of interest fills as much of the field of view as possible while still being in focus. An important concept that is illustrated by Figure 13-3 is the relationship between a pixel and the physical size of an object. A pixel always has a relative relationship to the size of an object. It has an absolute relationship only when you fix your viewing distance and lens focal length, and then calibrate the vision system. The calibration process establishes an absolute relationship between a pixel and the actual dimensions of the field of view. VisionWare User’s Guide, Rev. A 183 Chapter 13 - Vision Basics Vision System Representation Field of View A A A f=75mm f=25mm f=75mm A Figure 13-3 Resolution Factors A A 13.3 Grayscale vs. Binary Processing Depending on the tool and tool operation you select from the tool record, VisionWare processes either in binary mode or grayscale mode. The processing mode is selected by VisionWare and, in most cases, you do not have to be concerned with which type of processing is taking place. In many cases, however, you have to set threshold values for binary processing or the edge strength value for grayscale processing. This discussion gives you an idea of how to set those values. Figure 13-4 shows a magnified section of the array of pixels that might be returned by a camera. In each pixel of the matrix is the grayscale value the camera has registered from the field of view. 184 VisionWare User’s Guide, Rev. A Grayscale vs. Binary Processing 88 82 84 88 85 83 80 93 102 88 80 78 80 80 78 73 94 100 85 79 80 78 77 74 65 91 99 38 35 40 35 39 74 77 70 65 20 25 23 28 37 69 64 60 57 22 26 22 28 40 65 64 59 34 24 28 24 30 37 60 58 56 66 21 22 23 27 38 60 67 65 67 23 22 22 25 38 59 64 67 66 Figure 13-4 Sample Vision Matrix When the software processes image data in binary mode, each value in the matrix is compared with the threshold value. All the pixels with a value above the threshold value are considered white and all the pixels below this value are considered black. In binary mode, edges of objects within the field of view are found by looking for a change from a white section of pixels to a dark section of pixels. Figure 13-5 shows how the system would process the data from Figure 13-1 into a binary image if the threshold were set to 34. The overall threshold can be set automatically from within any picture record. There are several tools that allow you to set a binary threshold specifically for that tool. These tools create a new thresholded image within the area of the tool and perform their work based on this new data. 88 82 84 88 85 83 80 93 102 88 80 78 80 80 78 73 94 100 85 79 80 78 77 74 65 91 99 38 35 40 35 39 74 77 70 65 20 25 23 28 37 69 64 60 57 22 26 22 28 40 65 64 59 61 24 28 24 30 37 60 58 56 66 21 22 23 27 38 60 67 65 67 23 22 22 25 38 59 64 67 66 Figure 13-5 Binary Representation of Sample Matrix There are actually two threshold values that can be used together to isolate a range of intensity values. When 2nd threshold is given a value other than 0, all pixels between 2nd threshold and threshold are white. Figure 13-6 shows the sample array with the threshold set to 34 and 2nd threshold set to 89. VisionWare User’s Guide, Rev. A 185 Chapter 13 - Vision Basics 88 82 84 88 85 83 80 93 102 88 80 78 80 80 78 73 94 100 85 79 80 78 77 74 65 91 99 38 35 40 35 39 74 77 70 65 20 25 23 28 37 69 64 60 57 22 26 22 28 40 65 64 59 61 24 28 24 30 37 60 58 56 66 21 22 23 27 38 60 67 65 67 23 22 22 25 38 59 64 67 66 Figure 13-6 Setting Both Binary Thresholds When the software processes the data from Figure 13-1 in grayscale mode, it looks at a three-by-three section of pixels and compares the difference in intensity values found in the neighboring pixels to the value of edge strength. If the difference found exceeds edge strength, the system considers the three-by-three area to be part of an edge. Figure 13-6 shows the edge the system finds in the data from the array in Figure 13-7 if the edge strength is set to 20. (This illustration is somewhat idealized to help illustrate the point.) 88 82 84 88 85 83 80 93 102 88 80 78 80 80 78 73 94 100 85 79 80 78 77 74 65 91 99 38 35 40 35 39 74 77 70 65 20 25 23 28 37 69 64 60 57 22 26 22 28 40 65 64 59 61 24 28 24 30 37 60 58 56 66 21 22 23 27 38 60 67 65 67 23 22 22 25 38 59 64 67 66 Figure 13-7 Grayscale Representation of Sample Matrix The algorithm that VisionWare uses when looking at the three-by-three neighborhood of pixels allows edges to be located with sub-pixel accuracy. Thus, grayscale processing is generally more accurate than binary processing. Contrast There are two settings that allow you to control the level of contrast in an image. The sensors in the camera report an absolute intensity value. A camera operating in a low light environment returns values in a limited range at the low end of possible values (0-127) and the image would be very dark (similar to under-exposing a piece of photographic film). If a given value were added to all the pixels, the absolute brightness of the image would increase, making it easier to work with. Offset is the VisionWare parameter that performs this function. If the value of offset is set too high, all the intensity values are bunched up around the high end of the scale and the image are washed out (similar to overexposing a piece of photographic film). Offset and gain should be adjusted after the camera aperture has been set for maximum contrast. 186 VisionWare User’s Guide, Rev. A Camera Calibration Similarly, if all the objects in the field of view reflect light of a uniform intensity, the values returned are in a very narrow range. If the intensity values were multiplied by a given value, the relative differences between intensity values would increase and edges would be easier to detect. Gain is the VisionWare parameter that performs this function. Using offset and gain together allows you to maximize the brightness and contrast within an image. The binary threshold values are calculated after the effects of offset and gain have been included in the image, so the difference between light and dark areas of the image is maximized and the binary image is most useful. Gain and offset can be set automatically from any picture record. 13.4 Camera Calibration Camera calibration is the process of relating the image size of the camera to the actual size of the field of view. Three primary pieces of information are established when camera calibration is run: 1. The number of pixels needed to see a millimeter of distance in the field of view. This relationship is used by any tools that make distance measurements. It is also used by vision guided motion devices. 2. The ratio of the height of a pixel to its width. ✼ Some important points to remember about camera calibration: • The millimeter-to-pixel ratio is different for different camera-to-object distances. If you are making distance measurements of objects that are different distances from the camera, you have to create a calibration data set (virtual camera) for each distance. • When you change the focus of a camera lens, the amount of the viewing area in the field of view changes. This means that the millimeter-to-pixel ratio changes, and camera calibration created before the lens was refocused are not valid. The camera must be recalibrated. 13.5 Blobs and Prototypes When VisionWare examines the matrix of pixels returned by the camera, it looks for bounded regions. A bounded region is any contiguous section of pixels that is the opposite color from the background (and is within the minimum and maximum pixel limits). When a blob finder tool locates such a region, it reports that a Blob has been found and returns the information it discovered about the blob. If prototypes have been trained, a prototype tool record compares the vision model with any blobs and report any matches found. Holes in Blobs or Prototypes Any area within a blob or prototype that has the same intensity as the background is considered a hole. If you have light objects on a dark background, any dark areas within the blob or prototype are considered holes. VisionWare calculates the number of holes and the area of those holes. VisionWare User’s Guide, Rev. A 187 Chapter 13 - Vision Basics 13.6 Lighting Table 13-1 Types of Lighting Type Advantages Disadvantages Incandescent Inexpensive, can be cycled Short life (for AC lamps), heat Fluorescent Efficient, cool Cannot be cycled, flickers TungstenHalogen High output Heat, can’t be cycled Gas Strobes High power, freezes motion Expensive, poor CCD sensitivity IR Laser Good CCD sensitivity Highly divergent, federally regulated He-Ne Laser Highly collimated, infinite depth of field Fragile, expensive, bulky IR & Laser Diodes Not regulated Low power, highly divergent 188 VisionWare User’s Guide, Rev. A Lighting Strategies 13.7 Lighting Strategies Diffuse Light is reflected from a shiny surface at the opposite angle from which it struck the surface. If most of the light that is reflected from a surface comes from the same angle, the surface has sharp shadows and a great deal of surface glare. Diffuse lighting illuminates a surface with light that strikes the surface from as many different angles as possible, thus minimizing shadows, reflections, and the need for critically placed light sources. Fluorescent lighting is the most diffuse of the lighting types listed in Table 13-1. Diffuser plates and reflecting panels produce a more diffuse light. True diffuse lighting requires a parabolic shaped reflector. Applications with high-contrast, complicated objects, spherical objects, shiny objects, or objects that require multiple inspections of interior features are candidates for diffuse lighting. Back In backlighting, the light source (usually a diffuse source) is placed behind the object to be inspected. Backlighting effectively lights objects whose silhouettes are the critical feature. This is particularly effective if the objects are shiny or have highly variable surfaces. Directional Incandescent floods, ring lights, and fiber lights mounted above or to the side of an object provide directional lighting. This lighting is the simplest to install, but effective vision operations depend on this type of light source remaining constant. If the light source dims, the object appear different to the camera. If the angle changes, shadows may be added that are interpreted as features of the object. This type of lighting is most effective with simple objects or objects where specific, highly identifiable features are being inspected. Shiny surfaces or objects with variable surface brightness are difficult to inspect with this type of lighting. Structured In one type of structured lighting, a highly collimated light source is applied to the object. Lasers are sources of collimated light. This type of lighting allows the vision system to perceive three-dimensional features, such as depth changes in the surface plane or holes in the object. Shiny surfaces are not amenable to structured lighting. Strobe Strobe lighting is required when the speed of moving objects exceeds one pixel every 17 milliseconds. Strobes cast harsh shadows, but can be diffused (see above). VisionWare User’s Guide, Rev. A 189 Chapter 13 - Vision Basics 13.8 Filtering and Special Effects In many cases, specific lighting problems can be solved by placing an optical filter on the camera lens. The three most common filters used for black and white cameras are polarizing filters, color filters, and infrared filters. Polarizing Filters Reflected light is highly polarized (the light waves have a predominant orientation about the wave axis). A polarizing filter can be adjusted so that light waves with a predominant orientation are filtered. If reflected glare from an object is a problem, a polarizing filter may be able to minimize the problem. A polarizing filter reduces the overall scene brightness so more intense lighting sources are needed with this type of filter. By adjusting the orientation of polarizing filters on both the light source and lens, you can significantly reduce ambient light and reduce shiny (specular) reflections. Color Filters Color filters allow you to reduce or eliminate different colors of light that reach the camera. Color filters may enable the system to ignore annoying object features that are a given color, or ignore non-significant differences in an object that develop due to differences in the colors of the feature. Color filtration is difficult and should be attempted only when other avenues have been exhausted. Infrared Filters CCD cameras usually have a relatively high sensitivity to infrared light. Warm or hot objects emit infrared light (which is invisible to the human eye). If you suspect your camera data may be inaccurate due to infrared emissions, try placing an infrared filter over the lens. 190 VisionWare User’s Guide, Rev. A Installing VisionWare A A.1 Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 A.2 Initialization Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 A.3 Autostarting VisionWare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 VisionWare User’s Guide, Rev. A 191 Appendix A - Installing VisionWare A.1 Installing the Software To install VisionWare V+ on your hard drive: 1. Create a subdirectory for AIM. 2. Copy the AIM files to the hard drive. 3. Upgrade the operating system (if necessary). See sections following for specific information. Create a Sub Directory for the AIM Files Turn on the controller and perform the steps below when the startup procedures have completed. At the controller keyboard, type: fdirectory/c c:\aim\ A new subdirectory is created. To make that directory the default directory, type: default = c:\aim To verify that the directory was properly created and is the default directory, type: default The bottom line of the monitor window displays: DISK>C:\aim\ If this line is not displayed, repeat the steps in this section. Copy the AIM Files to the Hard Drive Use the V+ utility program DISKCOPY to copy the AIM floppy disks to your hard drive. Complete instructions for using the utility program are contained in the Instructions for Adept Utility Programs supplied with your V+ reference manuals. The following section describes the procedure to copy the MotionWare files to your hard drive. 1. Turn on your controller. 2. After the startup procedures have completed, make AIM the default directory by typing: default = c:\aim 3. Run the diskcopy program. Place the Adept Utility Disk in the A drive and type: load a:diskcopy 4. After the program files are loaded, type: execute 1 a.diskcopy 5. Remove the utility disk. Insert a VisionWare disk into the A drive. 6. From the menu that is presented, choose: 4. => Copy multiple files 192 VisionWare User’s Guide, Rev. A Installing the Software 7. When prompted What is the INPUT disk?, type: a 8. When prompted What is the OUTPUT disk?, type: c 9. When prompted Do you want to verify copy operations?, type: y 10. When prompted Enter spec of file(s) to copy, type: *.* 11. When prompted Enter output subdirectory, Press the ENTER key. 12. When prompted Do you want existing files automatically superseded?, type: y 13. When prompted Copy this file, type: g 14. Repeat steps 10-13 for the remaining AIM disks.1 15. After the last disk has been copied, when prompted Enter spec of file(s) to copy, Press the ENTER key. 16. Choose exit. Upgrade the Operating System If VisionWare is being delivered with a new system, the correct operating system is already installed. If you are adding VisionWare to an existing system, you may be required to upgrade your operating system. To determine if you need to upgrade your operating system, turn on the controller and type: id The second line displayed by the ID command shows the system configuration. The first number in the software line is the operating system version. It must be 11.2 or higher, otherwise you must upgrade to the current version. To upgrade your operating system: 1. Turn on the controller and let it load the existing operating system. 2. Insert the Adept Utility Disk (delivered with the existing system software) in the A drive and load the file CONFIG_C.V2, type:2 1 If you are not using VisionWare with a robot or motion device, you do not need to copy the MotionWare or AIM PCB disks. 2 Or use the correct drive and path specification if the file is stored on the hard drive. VisionWare User’s Guide, Rev. A 193 Appendix A - Installing VisionWare load a:config_c.v2 When loading is complete, you can remove the Utility Disk from the disk drive. 3. Start execution of the program by typing the command: execute a.config_c (Or use execute 1 a.config_c to execute the program as task #1.) 4. Choose V+ Installation from the menu. 5. Follow the prompts provided by the program (see below). NOTE: If a floppy diskette is modified, the write-protect slider on the back of the diskette must be in the unprotected position. That is, it must be in the position that closes the hole through the diskette jacket. Ensure that you move the slider back to the protected position after the operation is completed. Do not alter the original V+ system diskette supplied by Adept. Instead, make a copy of the distribution diskette (with this program during the process of installation, or with the DISKCOPY utility). Then modify the configuration information on the copy. 6. The configuration program can be deleted from the system memory by typing the following commands (type kill 1 in place of kill if the program was executed as task #1): kill deletem a.config_c 194 VisionWare User’s Guide, Rev. A Initialization Databases A.2 Initialization Databases MotionWare has several initialization databases that control MotionWare at startup. To change an initialization value, perform: Setup Seek ➡ Initialization Data ➡ select an initialization file ➡ Index ➡ select an initialization record Initialization Options The following tables summarize the initialization options available to VisionWare. Table A-1 Options in the Baseline File (BASEINI.DB) Record Name Use abort “Are you sure?” enable Enable/disable the Are you sure? verification when the Abort button is pressed on the debug control panel access level, initial Set the system access level at startup. (Do not change this record unless you have created a user account with an access level of 4.) access level, V+ monitor Set the access level required to display the monitor window. autostart module name Name of module to load and select when autostarting autostart sequence name Name of sequence to execute when autostarting backup copy directory Name of the subdirectory to use with the Backup/Restore utility. cycle repeat, initial Set the Repeat option on the Task Control Panel database auto-save enable Enable/disable auto-saving database records whenever a database editing page is exited error/message log queue size Used by AIM customizers only error/message log queue task Number of the task to handle the error/message queue Kermit directory file start Specify position of first character of the file name of a directory record returned by Kermit to the File Manager. language definition, English Specifies English as one of the available languages (other languages may be added by system customizers) language selection If multiple languages have been implemented, specify which language to display. module default directory Default directory for newly created resource modules screen blanking time interval Set the idle time before the screen goes blank signal for operator attention The digital I/O signal that should be set whenever the *operator attention* message is generated VisionWare User’s Guide, Rev. A 195 Appendix A - Installing VisionWare Table A-1 Options in the Baseline File (BASEINI.DB) (Continued) Record Name Use stack size The maximum depth of nested sequences that can be called from a single task statements - baseline Name of the baseline statement database statements - task control Name of the task control statement database task number, concurrent number Specifies the total number of tasks searched when looking for a free task of concurrent AIM processes task number, first concurrent Specifies the first task searched when looking for a free task of concurrent AIM processes user name, initial Name of the user to be logged on at startup Table A-2 Options in the Vision (VISWINI.DB) File Record Name Use example - custom camera model Example of a record to define a custom camera model example -custom convolution Example of a record to define a custom convolution example - custom morph pattern Example of a record to define a custom morphology record results log enable, initial Initial setting of the result logging check box results log file name, initial Initial name for result file results log update interval Interval to write data to results log file runtime graphics, initial Display or hide runtime graphics at start-up stats, max bin size, boolean Default maximum bin size for Boolean results stats, max bin size, real Default maximum bin size for real results stats, number of bins Number of bins that constitutes “recent history” virtual camera alloc enable Enable/disable pre-runtime allocation of virtual cameras virtual frame buffer size Size of the virtual frame buffers (and by default, the number of frame buffers) vision display mode, initial Start vision window in grayscale or binary 196 VisionWare User’s Guide, Rev. A Initialization Databases Table A-3 Options in the VisionWare (VWINI.DB) File Record Name Use control sequence module Default module for Master Control Panel button sequences master control panel file name Name of the menu file that will accessed by the Master Control Panel pull-down master control panel page name Name of the menu page that will accessed by the Master Control Panel pull-down picture-priming enabled Enables immediate acquisition of next image statements - VisionWare VisionWare statements database The VisionWare Record Type initialization file (VWRTINI.DB) contains basic information on all the record types available to VisionWare. Unless you are creating your own vision record type or want to specifically disable some existing record type, you do not need to use this file. Table A-4 Options in the User File (USERINI.DB) Record Name Use error database, additional This record allows you to create your own error/message database and have it loaded along with the standard AIM error database. overlay, additional The name of a custom V+ program to be loaded as an overlay during startup. The file name must be of the form *.OVR, and the first program in the file must be the same as the file name. statements, additional The name of a custom statement database to be merged with the standard AIM statements. If other AIM application or add-in modules are loaded, their initialization databases are described in documentation accompanying those programs. VisionWare User’s Guide, Rev. A 197 Appendix A - Installing VisionWare A.3 Autostarting VisionWare VisionWare can be automatically started at system power-on. Before starting VisionWare, complete these steps: 1. Before the controller is turned on: Set the autostart position on the configuration DIP switch to autostart. The location of the configuration DIP switch on the SIO module is detailed in the Adept MV Controller User’s Guide. 2. Before starting VisionWare: Make sure the root directory of the C drive is the current directory, type: default disk = c:\ Copy the VisionWare autostart file from the distribution diskette to the root directory and give the file the correct name, type:1 fcopy auto.v2 = a: vwauto.v2 3. After starting VisionWare, open the BASEINI.DB initialization file, perform: Setup ➡ Initialization Data ➡ dbl clk “baseini.db” Select the record named autostart module name. Type the name of the resource module you want loaded and selected at start up. Select the record named autostart sequence name. Type the name of the sequence you want executed at start up (in most cases this is a control sequence that performs all the work required to load and start an application sequence). This BASEINI.DB initialization file also contains many other initialization preferences that allow you to customize how VisionWare starts. These include: changing the vision-window display mode, enabling of runtime graphics, displaying the number of cycles to complete, displaying the user name for the initial logged-on user, and enabling of results logging. 1 The VAUTO file contains a program that sets the default disk to C:\AIM\. VisionWare must have been copied to this directory or the program auto must be changed to reflect the directory that holds the VisionWare files. 198 VisionWare User’s Guide, Rev. A Menu Bars and Quick Keys B B.1 Main Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 B.2 Record Editing Menu Bar and Quick Keys . . . . . . . . . . . . . . . . . . . . . . . . . 203 B.3 Vision Window Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 B.4 Sequence Editing Menu Bar and Quick Keys . . . . . . . . . . . . . . . . . . . . . . 208 VisionWare User’s Guide, Rev. A 199 Appendix B - Menu Bars and Quick Keys B.1 Main Menu Bar These menus are displayed whenever VisionWare is running. Several options are used only with the AIM system that underlies VisionWare. Execute Master Control Panel Display the master control panel Task Control Panel Display the task control panel *Stop All Tasks* Stop all user tasks (started from Master or Task Control Panel) Edit Sequence Edit a sequence Variable Edit or create records in the Variable database Vision Edit or create vision records Camera Edit or create camera records Module Select Select a resource module Show Statement Tree Display a graphic tree of the individual statements in a sequence AIM Status Window Display AIM status window Vision Results Display the Inspection Results menu page Live Video Select camera and display live video output for that camera Runtime Graphics Select display of runtime graphics 200 VisionWare User’s Guide, Rev. A Main Menu Bar IO Digital Signals Log Results Display/set digital I/O signals Set options for logging vision results Setup Initialization Data Set the values of system initialization variables Calibrate Camera Calibrate a specific camera Utilities Save All DBs Save changes made to any databases in memory Set Access Level Set the current user’s access level File Manager Display the AIM file manager Backup Create a backup definition Restore Restore the system files from a backup definition DBM Utilities Enter the database creation and editing program Edit menu Enter the menu editing program V+ Developer Open the V+ developer option (see the AIM Customizer’s Guide for these three options) Import/Export Windows Import/Export a vision image or Export TIF file of a menu page Profiler Display the system CPU usage profiler Export ADX Data Export a database to an ADX file format Import ADX Data Import an ADX formatted file into a database VisionWare User’s Guide, Rev. A 201 Appendix B - Menu Bars and Quick Keys Special Sample Menu Display a sample menu for use with menu editing program Edit User Accounts Create new users, edit or delete existing users Edit Statements Create or edit AIM statements (see the AIM User’s Guide) Edit Error Messages Edit the error database (see the AIM User’s Guide) Edit Help File Edit help databases (see the AIM User’s Guide) Edit Init Data Edit the AIM initialization databases Edit Raw Sequence Edit the sequence database Link All Databases Reexecute the linking process that is performed when a sequence is executed System Shutdown Exit AIM and save all modified databases Help Error Messages Browse the error message database System ID Display the system ID window 202 VisionWare User’s Guide, Rev. A Record Editing Menu Bar and Quick Keys B.2 Record Editing Menu Bar and Quick Keys This menu is displayed whenever you are editing database records. The quick keys that correspond to the different menu options are shown in parentheses (an “S+” indicates that the SHIFT key should be held down when the quick key is pressed). Go Goto Goto the highlighted record (F3) Select Display a pick list of records appropriate to the highlighted field (F5) Tree Display the record tree showing other records associated with this record Back Go back to the previously open record Retrieve Return the record name of the open record to the previously open record (S+F3) Exit Exit record editing mode, does not permanently save new or altered records to the disk (F7) Seek Index Display a pick list of all records in the current database First Goto the first record in the database (Home) Previous Goto the previous record in the database (Page Up) Next Goto the next record in the database (Page Down) Last Goto the last record in the database (End) Find Enter a field value, search the database of the highlighted field for the value (F7) Repeat Find Repeat the last find operation (F8) Edit Undo Field Undo un-entered changes made from the keyboard (F6) New Record Create a new database record (F2) Cut Record Cut the current record to the copy buffer (S+F9) VisionWare User’s Guide, Rev. A 203 Appendix B - Menu Bars and Quick Keys Copy Record Copy the current record to the copy buffer (F9) Paste Record Paste the record in the copy buffer to the current database (F10) Help Field Information Display the help screen for the currently highlighted menu item (F1) Page Information Display help screen for the current menu page (S+F1) Whenever the record editing menu is displayed, the following quick keys are active. Table B-1 Record Editing Quick Keys Key Combination Effect Help (F1) Display help for the current menu page or the currently selected menu page item. New (F2) Create a new record in the current database and go to that record. Save (Shift+F2) Display the Save All Modified Databases window. Go To (F3) If a source field is selected, go to that record. Retrieve (Shift+F3) Return the record name of the open record to the previously open record. Exit (F4) Close the currently open menu page and return to the next open page (if any). Shift+F4 Close all open menu pages. Display (F5) If a source field is selected, display a pick list of records appropriate to the selected field. Undo (F6) Undo the most recent changes entered from the keyboard (only if the changes have not been entered by pressing ENTER or moving to another field) Redraw (Shift+F6) Force a redraw of the screen (updates digital I/O references). Find (F7) Display the Find window. Repeat (F8) Repeat the last executed find operation. Copy (F9) Copy the currently displayed record. Cut (Shift+F9) Cut the currently displayed record and place it in the copy buffer. 204 VisionWare User’s Guide, Rev. A Record Editing Menu Bar and Quick Keys Table B-1 Record Editing Quick Keys (Continued) Key Combination Effect Paste (F10) Paste the record currently in the copy buffer. Tab Select the next menu item. The next menu item is the physical item to the right of the currently selected menu item, or the leftmost item below the currently selected menu item. If the last menu item is selected, the first menu item will be selected. Shift+Tab Select successive menu items in the reverse order of Tab. Shift+↑, ↓, →, ← Selected successive menu items in a top/bottom or left/right order. Enter If a data box is selected, causes the system to accept the data box entry. If a button is selected, has the same effect as if the button is clicked on with the mouse pointer. Page Up Go to the previous record in the database. Page Down Go to the next record in the database. Home Go to the first record in the database. End Go to the last record in the database. Ctrl+Delete Delete the value in a selected field. VisionWare User’s Guide, Rev. A 205 Appendix B - Menu Bars and Quick Keys B.3 Vision Window Menu Bar This menu bar is displayed in the vision window whenever a vision record is being edited. The vision window and menu bar are displayed by performing: Edit ➡ Vision Image New Picture(s) Acquire the needed images for the current operation (redraw any graphics) Show Edge Image Show the grayscale edge image Live Grayscale When chosen, show the actual camera output (in grayscale mode) Live Binary When chosen, show the actual camera output (in binary mode) Grayscale Image When chosen, show the image currently stored in the grayscale frame buffer Binary Image When chosen, show the image currently stored in the binary frame buffer Image Lock Take a new picture only when New Picture(s) is chosen (useful when developing applications using strobe lights) Show Vision Tools When chosen, display the graphics for all currently defined vision tools Points When chosen, display graphics for currently defined point class recs Lines When chosen, display graphics for currently defined line class recs Circles When chosen, display graphics for currently defined circle class recs Vision Frames When chosen, display graphics for currently defined frame class recs Delete All Delete all but pictures, cameras, models Delete all vision records Delete all vision records except camera, picture, prototype model, and font records Delete all vision records (in the currently open database) 206 VisionWare User’s Guide, Rev. A Vision Window Menu Bar Goto Top Level List Display a list of top-level vision inspections Top of tree Redraw the currently displayed tree from the top Options Vision tool timer Hide or show the timer in the lower left corner of vision window Show edge points Enable or disable the display of “points used” for finder tools Zoom Zoom In Zoom in on the vision window Zoom Out Zoom out on the vision window Zoom Popup... Display window that lets you see zoomed area before zooming Back to normal Display the un-zoomed vision image VisionWare User’s Guide, Rev. A 207 Appendix B - Menu Bars and Quick Keys B.4 Sequence Editing Menu Bar and Quick Keys This menu bar is displayed whenever you are editing a sequence. The sequence editor and menu bar is displayed by performing: Edit ➡ Sequence File Export File Export the sequence to an ASCII file Exit Exit the sequence editorchanges saved to RAM only (F4) Go Sequence Index Display the select/create/delete sequence popup window Goto Field Record Goto the selected record Select Field Index Display a pick list of records appropriate to the highlighted argument (F5) Move First Line Move cursor to the first line of the sequence (CTRL+Home) Last Line Move cursor to the last line of the sequence (CTRL+End) Previous Page Show the previous screen of statement lines (Page Up) Next Page Show the next screen of statement lines (Page Down) Find Repeat Find Repeat the last find operation (F8) Repeat Change Repeat the last change operation (S+F8) Find Setup Specify a string to find in the current sequence (F7) Change Setup Specify a string to find in the current sequence, and another string to replace the found string with (S+F7) 208 VisionWare User’s Guide, Rev. A Sequence Editing Menu Bar and Quick Keys Edit Undo Field Undo recent (un-entered) changes made from the keyboard (F6) Delete Field Delete the highlighted record or statement name (CTRL+U) Disable Enable or disable the current line (Esc) Expand Display or hide the optional arguments in the current statement line (F11) Append Line Insert Line Delete Line Append a new line to the end of the sequence (F2) Insert a new statement line above the current cursor location (CTRL+Insert) Delete the current statement line — not placed in copy buffer (CTRL+Delete) Copy Line Copy the current line to the copy buffer (F9) Cut Line Cut current line and place it in copy buffer (S+F9) Paste Line Paste the first line in the copy buffer above the current cursor location (F10) Paste All Paste the entire copy buffer above the current cursor location (S+F10) Table B-2 Sequence Editing Quick Keys Key Combination Effect New (F2) Append a new statement line to the end of the sequence. Save (Shift+F2) Display the “Save All Modified Databases” pop-up window. Go To (F3) When “--statement--” is highlighted, display a pick list of statements. When an uncompleted statement argument is highlighted, display a pick list of appropriate records. When a completed statement argument is highlighted, go to the record. Retrieve (Shift+F3) Return to the sequence editor after a “Go to”. Exit (F4) Exit the sequence editor. Display (F5) Display a pick list for the highlighted statement or argument. Undo (F6) Undo recent changes entered from the keyboard (unless the ENTER key has been pressed or another menu item has been highlighted). Find (F7) Display the find pop-up window. Change (Shift+F7) Display the change pop-up window. Repeat (F8) Repeat the last executed find operation. Shift+F8 Repeat the last executed change operation. VisionWare User’s Guide, Rev. A 209 Appendix B - Menu Bars and Quick Keys Table B-2 Sequence Editing Quick Keys (Continued) Key Combination Effect Copy (F9) Copy the currently highlighted statement line to the copy buffer. Cut (Shift+F9) Cut the currently highlighted statement line and place it in the copy buffer. Paste (F10) Paste the most recently cut or copied line above the currently highlighted statement line. Paste All (Shift+F10) Copy all lines in the copy buffer above the currently highlighted statement line. Edit (F11) Expand or contract the highlighted statement. Double click the statement line Expand the currently highlighted statement. Double click the statement number Enable or disable a statement. Shift + ↑, ↓, →, ← Highlight successive statement arguments in a top-to-bottom or left-to-right order. →, ← Move the typing cursor within a statement name or argument. Enter Move to the first argument in the next statement. Delete Delete character at the typing cursor. Backspace Delete the character to the left of the typing cursor. Ctrl+Insert Add a statement above the current statement line. Ctrl+Delete Delete the current statement line (not placed in copy buffer). Home Go to the first line of the current screen. End Go to the last line of the current screen. Ctrl+Home Go to the first line of the sequence. Ctrl+End Go to the last line of the sequence. Page Up Display the previous screen full of statements. Page Down Display the next screen full of statements. ESC Enable or disable a statement. Control+U Blank the highlighted statement or argument name. 210 VisionWare User’s Guide, Rev. A VisionWare Utilities C C.1 The File Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 File Manager Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 C.2 The Backup and Restore Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 The Backup Menu Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Backup Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 Creating a Backup Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Restoring Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Restore Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 VisionWare User’s Guide, Rev. A 211 Appendix C - VisionWare Utilities C.1 The File Manager The File Manager allows you to copy, delete, rename, and move files and directories. To access the File Manager, perform: Utilities ➡ File Manager The following screen is displayed: ➊ ➌ ➋ ➍ ➎ ➐ ➏ ➑ Figure C-1 File Manager Window The File Manager screen contains two scrolling list windows. Each window displays all files and directories in the corresponding selected directory. File Manager Options ➊ 1 Select A:, C:, Kermit, or NFS> as the source device for this half of the window.1 Before NFS> can be selected, amount name must be entered in the data box next to NFS>2. The Kermit device is available only if your controller has been configured to use a serial port to access another computer running a Kermit server. Then the Kermit device provides access to files and directories on that computer. See the V+ Language User’s Guide for details. NFS is available only to systems equipped with the optional AdeptNet hardware and software. NFS allows you to access files and directories on a remote computer on a network. See the AdeptNet User’s Guide for details. 2 This information is stored for the current AIM session and is re-displayed each time the File Manger is opened. 212 VisionWare User’s Guide, Rev. A The File Manager An NFS device can be re-read by clicking on the NFS> radio button (even if it is currently selected). ➋ This window shows the directory path for item ➎. Double click any directory in the path to display the files and directories in that directory. ➌ This string can be used to limit the files displayed in item ➎. (This string does not affect the directories displayed in item ➎). For example, the string “*.v2” would limit the display to the files with that extension. ➍ These options specify the order in which the files and directories in item ➎ are displayed: Name sorts the files alphabetically based on the file name Extension sorts the files alphabetically based on the file extension Size sorts the files based on their size Type sorts the files based on the type attribute (directory, protected, etc.) Date sorts the files based on the creation/update date None does not sort the files (shows files as they are stored on disk) Select ✔ Reverse to sort files in reverse order (Has no effect on None.) ➎ This area shows, for the device selected in ➊ and the directory path shown in ➋, all of the directories present and all of the files present that match the specification entered in ➌. This is the area where you select files or directories to copy, delete, rename, duplicate, or move. Click once on a file or directory to select it. To deselect an entry, click the entry again. Selected files and directories appear with a ✔ to the left. Unselected files are black, unselected directories are blue, and selected files and directories are red. Selected system files are orange and unselected system files are gray. Directories are identified by a “D” in the attribute column (immediately after the file size). Protected files are marked with a “P” and system files are marked with an “S”. To move one level down in the directory structure, double click the desired directory entry. ➏ Choose Select All to select all the files and directories shown in item ➎. Choose Deselect All to deselect all the files and directories that are selected. ➐ ➑ You can operate on files and directories from only one side of the File Manger. These radio buttons indicate which side is the active side. The active side is also outlined in red. You can select a side by clicking on one of the radio buttons or by clicking on an entry in item ➎, or by choosing Select All . Choose Copy --> to make copies of the selected files and place them in the directory shown on the opposite side of the window. Choose Move --> to move the selected files to the directory shown in the opposite side of the window. VisionWare User’s Guide, Rev. A 213 Appendix C - VisionWare Utilities Choose Delete to delete the selected files. NOTE: Files cannot be restored after they are deleted (except if they had previously been saved with the backup utility). ➒ Choose New Dir to create a new directory in the active window. Enter the name for the new directory, when prompted. Choose Rename to rename the highlighted file or directory. A window prompts for the new name. Choose Duplicate to create a copy of the selected file in the same directory. A window prompts you for a name for the copied file.) NOTE: Rename and Duplicate are available only when a single line is selected in item ➎. Duplicate cannot be used on a directory entry. The window that prompts for the new name can be dragged aside in order to get an unobstructed view of the main window. 214 VisionWare User’s Guide, Rev. A The Backup and Restore Utility C.2 The Backup and Restore Utility The backup utility allows you to create backup files of your AIM and V+ files. Backup files can be used to restore files in the event of a drive failure, file corruption, or accidental deletion. The Backup Menu Page The backup utility is accessed by performing: Utilities ➡ Backup Figure C-2 Backup Selection This menu page has buttons for up to four backup definitions. Each button shows the name of a backup definition and the date of the last backup. Choosing a Start button begins the backup using the indicated backup definition. You can select which backup definitions appear on this page when you create or edit a backup definition (see item ➎ on page 217). To start a backup using a definition that is not assigned to one of the buttons, to modify a backup definition, or to create a new backup definition, choose Setup to display the window shown in Figure C-3. Backup Definitions Before you create a backup file, you need to create a backup definition that specifies which files to backup, the destination for those files, and the file(s) identification. To create a backup definition, perform: Utilities ➡ Backup ➡ Setup VisionWare User’s Guide, Rev. A 215 Appendix C - VisionWare Utilities The following screen is displayed: Figure C-3 List of Backup Definitions Choose Edit to change characteristics of the selected backup definition. (Double clicking the name of a backup definition has the same effect as choosing this button.) Choose New to load create a new backup definition (see the next section). Choose Start to begin creating a backup file using the highlighted backup definition. A status window displays the state of the backup operation and allow you to pause or abort the operation. Choose Delete to delete the selected backup definition. Choose Cancel to exit the backup utility. (The Exit function key and clicking the closewindow icon have the same effect.) Creating a Backup Definition When you choose Edit or New from the List of Backup Definitions window, this additional window is displayed: ➌ ➊ ➍ ➋ ➏ ➎ ➐ ➑ ➒ ➓ Figure C-4 Backup Definition 216 VisionWare User’s Guide, Rev. A The Backup and Restore Utility ➊ This area allows you to specify the source of the files to backup and which file groups to add to the backup definition. Indicate the path to the source files. This should be an absolute path (see the V+ Language User’s Guide). You can change the path by: directly entering a path; double clicking any directory (indicated by a “D” after the file size in item ➋), or selecting a directory and choosing Open Directory . (Double click the “..” line to move up the directory tree one level.) The File specification data box allows you to restrict the files displayed in the source file window. To select all files, type: *.* To select a group of files (all database files, for example), type: *.db See theV+ Language User’s Guide for details on using wild cards. ➋ This window shows the files that can be added to the backup definition from the specified path, matching the file specification. You can either add all of the files shown or select individual files. To add all files, select the “.” line (single period at the top of the list) and choose Add to Specification . In the example shown, all database files have been selected (“*.db” in the file specification). To place all these files in the backup definition, select the “.” line and choose Add to Specification . The path and file specification are added to the Saveset list (item ➏). Note that all the individual file names are not added. To add selected files from the source list, select each individual file and then choose Add to Specification . ➌ Specify where the backup files will be stored: • Select the desired output device. If you are backing up to an NFS drive, type a mount name and then select NFS. This information is stored for the current AIM session and is re-displayed each time the File Manger is opened. • Indicate the directory specification for the backup files. • You can also enter a description of this backup definition. ➍ Select ✔ Include system files to include any V+ system files that are included in the selected entry in the backup list (item ➏) or directories within that entry. Select ✔ Include subdirectories to include all sub directories of the selected directory entry in the backup list. NOTE: these selections are made for each entry in the backup list, not for all of the entries in the list. Highlight each entry in the list and select the desired options for that entry. ➎ Select one of the check boxes if you want this definition to appear as one of the standard buttons on the Backup Selection window (see Figure C-2). If another backup VisionWare User’s Guide, Rev. A 217 Appendix C - VisionWare Utilities definition has already been assigned to that button, a window warns you and then allows you to re-assign the button or keep the current assignment. ➏ ➐ This list shows all the specifications that will be included in the backup. Full names are shown for files added individually. A wild card specification is shown for files added as a group. A specification can be edited or deleted by selecting the line and then choosing one of the buttons at the bottom of the window. There are two, or more, files associated with a backup. A backup definition file and the actual backup files that contains all the selected files. Select ✔ Copy BKD File to make a copy of the definition file in a directory of the C: drive as well as in the Output directory. (The back-up directory is defined in an initialization record in the BASEINI initialization file.) ➑ Select Complete to backup all files regardless of whether they have been backed up previously. Select Partial to backup only files that have changed since they were stored in a backup and files that have never been stored in a backup. ➒ ➓ Select Current date to use the current date as the file name (in the form mmmddyyA). Select Auto generated to have a random number assigned as the file name. Select User supplied to assign your own file name (when the backup is started). Choose Edit to manually edit the selected file specification. (Double clicking a specification has the same effect as choosing this button.) Choose Delete to remove the selected file specification from the backup list. Choose Clear to remove all items from the backup list. (The Exit function key and clicking the close-window icon have the same effect.) Restoring Files The file restore utility reinstalls files contained in a backup file that was previously created with the backup utility. To start the restore process, perform: Utilities 218 ➡ Restore VisionWare User’s Guide, Rev. A The Backup and Restore Utility Figure C-5 List of Backup Savesets This window shows backup directory files at the indicated device and path. To prepare to restore the files, highlight the desired saveset and choose Select or double click the saveset. The restore menu page is displayed. The restore utility can be exited by choosing Cancel , pressing the Exit function key, or clicking the close-window icon. Restore Options ➍ ➊ ➎ ➋ ➌ Figure C-6 Restore Menu Page VisionWare User’s Guide, Rev. A 219 Appendix C - VisionWare Utilities ➊ ➋ This area shows information about the backup selected from the backup savesets list. You can change the device, path, and saveset name in this window. However, it is usually easier to cancel this window and make changes in the List of Backup Savesets window. Indicate the target path to receive restored files. NOTE: The path will be added to the path stored in the backup definition file. Thus, to restore files to their original location, the path should be “\” (or blank). ➌ A check mark indicates that the file will be restored. To select/deselect specific files, select the file and then click the check box. The up and down arrow buttons can be used to move through the list. Choose Restore All to select all of the files for restore. Choose Restore None to deselect all of the files. ➍ ➎ This area indicates the files stored in the backup file. The files marked with a check mark will be restored. Either double click a file name or choose Get File Information to see basic information on that file. Select ✔ Overwrite files to have the utility automatically overwrite files of the same name. Choose Start to begin restoring files. Once a restore operation has started, a window shows the status of the restore and gives you the option to pause or abort the operation. 220 VisionWare User’s Guide, Rev. A Basic, OCR, and Special Purpose Records D D.1 Inspection Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 D.2 Inspection Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 D.3 Inspection Record Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 D.4 Picture Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 D.5 Picture Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 D.6 Value Combination Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 D.7 Value Combination Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 D.8 Prototype Model Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 D.9 Prototype Model Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 D.10 Prototype Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 D.11 Prototype Finder Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 D.12 OCR Font Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 D.13 OCR Font Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 D.14 OCR Field Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 D.15 OCR Field Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 D.16 Correlation Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 D.17 Correlation Template Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 D.18 Correlation Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 D.19 Correlation Window Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 D.20 Frame Pattern Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 D.21 Frame Pattern Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 D.22 Conditional Frame Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 D.23 Conditional Frame Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 VisionWare User’s Guide, Rev. A 221 Appendix D - Basic, OCR, and Special Purpose Records D.1 Inspection Records Every individual inspection begins with a top-level inspection record. This record specifies what type of inspection is to be made, the different operations available for a particular type of inspection, and the acceptable range of values for passing or failing the inspection. The name of this record is the one you use when you build inspection statements in the sequence editor. This record receives the results generated by the other records associated with this inspection record, evaluate the success of the inspection, and report the results. ➋ ➊ ➌ ➍ ➎ ➐ ➏ ➑ ➒ ➓ Figure D-1 Inspection Record 222 VisionWare User’s Guide, Rev. A Inspection Record Options D.2 ➊ ➋ ➌ ➍ Inspection Record Options Shows the name of the record you are editing, and the date and time it was last altered. The record name can be changed at any time, but any sequences that use the old record name can no longer find the record. Select this option if you want this record to appear in the list of records available when TopLevel is chosen in the vision tree window. Choosing this option also makes this record available when completing statement arguments during sequence editing. Inspection records are normally top-level records. Select the type of inspection you want to make. The inspection types and specific operations are described in Chapters 6 and 7, and are summarized in Section D.3. After an operation is selected, data box(es) for the required records are displayed in this area. Choose this button to display the available operations (based on the selection from item ➌). After you select an inspection type and a specific operation for that type of inspection, you will create several other records to actually perform the inspection. Data boxes for the required records will be shown in this area. If ✔ Error if the Result is FAIL is selected and the inspection result is fail, the system returns an error during sequence execution. If ✔ Error if a source "not found" is selected and a source record fails to find a feature, the system returns an error during sequence execution. If an INSPECT_LIST or INSPECT statement encounters an error, sequence execution halts. ➎ ➏ ➐ ➑ ➒ ➓ The value generated based on the inspection type and specific operation is displayed in the Value information box. The result of the inspection is displayed in the Result information box. In the Nominal data box, enter the ideal value this inspection should have. The Deviation information box shows the difference between this ideal value and the one reported in item ➎. Choose this button to specify the minimum, maximum, and warning limits for this inspection, or to execute a test run of this inspection. See page 77 for additional details. Select this option to specify a digital output signal that will be set based on a success of the inspection. Digital I/O is covered in Chapter 12. Select this option to report the inspection data to the Inspection Results page when a sequence containing this top-level inspection is run. The number entered into Bin size is used in the statistical calculations when vision results are displayed (see Chapter 11). Select the desired data logging for this inspection (see Section 11.7). VisionWare User’s Guide, Rev. A 223 Appendix D - Basic, OCR, and Special Purpose Records D.3 Inspection Record Types The types of inspections and the specific operations available to each inspection type are listed in tables D-1 to D-5. The steps to complete after you create a new inspection record are: 1. Select a type of inspection 2. Create the record(s) that supply results to the inspection record 3. Select a specific operation 4. Enter the pass/fail criteria for the inspection Table D-1 Inspection Record Type: Measure Measure Operation Description POINT-POINT distance Measure the distance between two points. Point class records are listed in Table 5-1. POINT-LINE distance Measure the shortest (perpendicular) distance between a point and a line. Point class records are listed in Table 5-1. Line class records are listed in Table 5-2. LINE-LINE angle Measure the angle between two lines. Line class records are listed in Table 5-2. CIRCLE radius Measure the radius of a circle. The circle can come from an arc finder or a computed circle. CIRCLE diameter Measure the diameter of a circle. The circle can come from an arc finder or a computed circle. 224 VisionWare User’s Guide, Rev. A Inspection Record Types Table D-2 Inspection Record Type: Test a Value Record Type Testable Values Linear Ruler Search area clipped by field of view Number of edges found Distance from first to last edge Distance from ruler start to first edge Arc Ruler Search area clipped by field of view Number of edges found Angle from first to last edge Angle from ruler start to first edge Angle of the first edge with respect to the vision X axis Point Finder Success or failure of the finder tool Search area clipped by field of view Line Finder Success or failure of the finder tool % of edges found along the line Angle of the found line Search area clipped by field of view Maximum pixel error of fit line Circle/Arc Finder Success or failure of the finder tool % of edges found along the arc Arc radius Search area clipped by field of view Maximum pixel error of fit arc Blob Finder Success or failure of the finder tool Number of holes in the found blob Area of all holes Blob area Total area Perimeter Min/max radii or minor/major ellipse axis Prototype Finder Success or failure of the finder tool Percentage of prototype model verified Inspection Record The inspection value, deviation, or pass/fail indication Value Combination See Chapter 9. Computed Line Angle of the computed line Window See Table D-5 . OCR Field See “OCR Field Results” on page 138. Correlation Window The correlation match coefficient Success or failure of the correlation match Conditional frame Frame angle VisionWare User’s Guide, Rev. A 225 Appendix D - Basic, OCR, and Special Purpose Records Table D-3 Inspection Record Type: Combine Inspections Combining Operation Description AND Two inspection records are compared. If both pass, this inspection will pass. OR Two inspection records are compared. If either inspection passes, this inspection will pass. XOR Two inspection records are compared. If one inspection passes and the other fails, this inspection will pass. Multiplication The values returned from two different inspections are multiplied together and returned to this inspection. Addition The values returned from two different inspections are added together and returned to this inspection. Subtraction The values returned from two different inspections are subtracted from each other and returned to this inspection. Division The value returned from one inspection is divided by the value returned by another inspection and returned to this inspection. Table D-4 Blob Statistics Blob Operation Description Blob found indicator Success or failure of the blob finder Blob area The area (in pixels) of the found blob– minus hole areas Hole area The area (in pixels) of all holes found within the blob (a hole is any section of pixels within the blob that have the same color as the background) Number of holes The number of holes (bounded regions within the blob that have the same color as the background) Total area The blob area, including the area of all holes (in pixels) Major ellipse radius The smallest possible ellipse is fit to each blob; this value is the radius of the major axis of the ellipse Minor ellipse radius The radius of the minor axis of the best fit ellipse Angle of blob The angle of the found blob (This value depends on the selection made in the orientation group of the blob finder tool.) 226 VisionWare User’s Guide, Rev. A Inspection Record Types Table D-5 Inspection Record Type: Window Statistics Window Operation Description Average graylevel value Calculate the average graylevel value of all the pixels within a vision tool window. Maximum graylevel value Calculate the maximum graylevel value of the pixels within a vision tool window. Minimum graylevel value Calculate the minimum graylevel value of the pixels within a vision tool window. Standard deviation of graylevel values Calculate the standard deviation of the graylevel values found within a vision tool window. White pixels Count all the white pixels within the window and return that count. Black pixels Count all the dark pixels within the window and return that count. Edge pixels Count all the pixels along edges found in the image. An edge is detected when the difference in intensity from one pixel to the next exceeds the value specified for edge strength in the window tool record. Dynamic white pixels Count all the white pixels within the window and return that count. Specify new thresholds for the count. Dynamic black pixels Count all the black pixels within the window and return that count. Specify new thresholds for the count. The OCR inspection type is described in Chapter 8. VisionWare User’s Guide, Rev. A 227 Appendix D - Basic, OCR, and Special Purpose Records D.4 Picture Records A picture record specifies the contrast (gain, offset, threshold, and 2nd threshold) parameters that are in effect when a picture is taken. Every vision tool record must have a picture record associated with it. When you are creating new vision tool records, the most recently created picture record is used as a default by the new vision tool record. The sending of strobe pulse signals is activated by this record. Every picture record must have a camera record associated with it. ➋ ➊ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure D-2 Picture Record 228 VisionWare User’s Guide, Rev. A Picture Record Options D.5 ➊ ➋ ➌ ➍ ➎ Picture Record Options Shows the name of the record you are creating or altering, and the date and time it was created or last altered. The record name can be changed, but any vision tool records that use this record will no longer be able to find the record. Choose this button to start repetitive image acquisition. Unlike the New Picture menu item, this option takes into account the selections in the Modes of Operation group, allowing you to test I/O options. Select a camera record to be associated with this picture record. The camera record specifies the camera settings and calibration that are used when an image is acquired. Choose this button to start repetitive image acquisition. This option takes into account the selections in the Modes of Operation group, allowing you to test any I/O options. Select Wait for I/O signal if (during sequence execution) you want new image acquisition to wait until a specified digital signal is set to the correct state. A data box will be displayed requesting a digital input or soft signal number. Digital I/O is described in Chapter 12. Select Wait for external trigger if image-acquisition hardware should wait for an external hardware trigger. External triggers must be configured using the controller software configuration utility CONFIG_C. See the Instructions for Adept Utility Programs. External triggers eliminate the slight delay that might occur with normal digital I/O. ➏ Select Output I/O signal if you want a digital signal set after a picture is taken.1 The Motion items are used only by motion systems. Refer to the MotionWare User’s Guide for details. ➐ ➑ ➒ ➓ 1 Select this option if you want the image-acquisition hardware to generate a strobe signal whenever a new image is acquired. The strobe signal will be sent to the camera specified in option ➌. You may use the strobe signal to latch belt or robot encoders in a motion system, or to trigger a strobe light. Choose this button to display a graph of the graylevel value distribution. A graph will be displayed showing the frequency of each graylevel value in the current image. Choose Auto-set to automatically set the gain and offset parameters. Use the slide bars to fine-tune the parameters. The actual parameter values are shown in the data box next to the parameter name. Gain and offset are explained in , “Vision Basics.” Choose Auto-set to automatically set the binary threshold. The actual parameter values are shown in the data box next to the parameter name. Use the slide bars to fine tune the parameters. Threshold and 2nd threshold are explained in Chapter 13, “Vision Basics.” This signal is set as soon as the picture is taken: it does not wait for image processing to complete. VisionWare User’s Guide, Rev. A 229 Appendix D - Basic, OCR, and Special Purpose Records D.6 Value Combination Records Combination records allow you to use a single tool to execute multiple operations, and then report the values generated to another vision record. Combination records themselves do not create multiple operations: They execute the multiple instances of a repeat tree, combine the results, and return the result to the next higher record. Therefore, a value combination record must always be paired with a repeat record to be able to perform multiple operations. See Chapter 10 for details on repeat records. ➊ ➋ ➌ ➍ ➎ ➏ ➐ Figure D-3 Value Combination Record 230 VisionWare User’s Guide, Rev. A Value Combination Record Options D.7 ➊ ➋ ➌ Value Combination Record Options Shows the name of this value combination record and the date it was last modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a value combination record.) In the Repeat tree data box, specify the record that defines the top of the repeat tree. This record must be from the test-a-value class (Section 5.4). The repeat tree must include a repeat record (Table 10-1). The Using each of information box shows the record that defines the bottom of the repeat tree. This record will be the first unused repeat record below the Repeat tree record. ➍ ➎ ➏ ➐ Select this option to halt at a repeat instance where a “not found” error occurs. This option applies only to errors where a vision tool lower in the inspection tree fails to locate a feature and does not return a value that the next higher record requires. Indicate the maximum number of values that should be collected. The special value “0” indicates that all possible repetitions should be made. This option is particularly appropriate when using repeat trees that generate an indeterminate number of repetitions. Choose this button to select the real value to collect (or boolean to evaluate) and return to the next higher record. The options available here will correspond to the values returned by the record shown in the Repeat tree data box. This group shows the values returned from the multiple operations. If boolean results are being returned, this group will display boolean rather than real results. VisionWare User’s Guide, Rev. A 231 Appendix D - Basic, OCR, and Special Purpose Records D.8 Prototype Model Records Prototype model records create the prototype models that prototype finder records use in the prototype recognition process. See Chapter 8 for details on creating and using prototype models. ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➒ ➑ Figure D-4 Prototype Records 232 VisionWare User’s Guide, Rev. A Prototype Model Record Options D.9 ➊ ➋ ➌ ➍ ➎ ➏ Prototype Model Record Options Displays the name of the record you are editing, and the date and time it was created or last altered. The record name can be changed, but any prototype finder records that use the old record name can no longer find the record. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. Specify a picture record to use when training the prototype. This same picture record and its associated camera record should be used in prototype finder records that locate this prototype. Indicate whether the prototype you are training is a light object on a dark background or vice versa. If this option is incorrectly specified, VisionWare will attempt to train the background as a prototype. Enter the minimum and maximum area ranges for the prototype. Any regions with a value less than the minimum value will not be considered when training the prototype. Any regions with a value greater than the maximum area will not be considered when training the prototype. Max. Pixel Variation: During prototype training, edges will be fit to the bounded regions in the field of view. The edges generated are used to create the prototype model. This value sets the maximum deviation that the fit edge can have from the area it is being fit to. Higher values result in fewer corners and edges. Max. Verify Distance: This data box specifies the maximum distance (in pixels) allowed between a feature in the prototype model and a feature in the image which is still considered to be a match. Features farther apart than this distance do not match. Increasing this value allows a sloppier fit to still be considered a match. Increase this value if there is considerable variation between objects being matched and if you can tolerate matches with a less precise fit. Disable arc fitting: If you are creating a model of an object that has no arc-shaped features, select this option. VisionWare will fit only straight line segments to the bounded regions. ➐ ➑ ➒ Show the regions that the system “sees” in the current picture. Show the current prototype model. Enter prototype training mode (detailed in Chapter 8). VisionWare User’s Guide, Rev. A 233 Appendix D - Basic, OCR, and Special Purpose Records D.10 Prototype Finder Records A prototype finder record locates a specific prototype if that prototype is within the field of view. The prototype model must have been created before the prototype finder can be used (see Section D.8). ➍ ➎ ➋ ➌ ➊ ➏ ➐ ➑ ➒ ➓ ❋ ✠ Figure D-5 Prototype Finder Record 234 VisionWare User’s Guide, Rev. A Prototype Finder Record Options D.11 Prototype Finder Record Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ Shows the name of the prototype finder record and the date it was created. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a prototype finder record.) Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Enter a picture record to be associated with this prototype finder record. This picture record must use one of the virtual cameras that were assigned when the prototype model was created. Select the prototype model this record is to find. Select ✔ Repeat to make this a repeat record (see Chapter 10). In the Max proto-instances to find data box, indicate the maximum number of prototypes the system should attempt to find (–1 indicates that all regions should be searched for prototype matches). This option can reduce processing time in complicated scenes. Max execution time controls the time a finder will spend looking for a prototype match. See the description of V.MAX.TIME in the Vision Reference Guide for details on how this option affects prototype matching. ➑ Choose Blob Ordering to specify the order in which multiple prototypes are found. Select ✔ No clipped protos and the system will recognize only prototypes that are entirely within the prototype finder search area (the angle of the tool search area must be 0, 90, 180, or 270 for this option to be available). ➒ ➓ ❋ Shows the absolute coordinates of the finder tool search area. The search area can be changed by entering values directly into these data boxes, or by using the drag handles on the finder tool. Select this button to make the tool relative to a vision frame. See “Making Vision Tools Relative to a Vision Frame” on page 147. Choose Show Prototype to show the current prototype model. Choose Show Recognition to display the outline of the prototype model over the regions that were recognized as matching the prototype. ✠ The Found item indicates whether a prototype match was successfully made. The % verified item indicates the percentage of total boundary length (including holes) that was common to both the prototype model and the image regions. The Centroid X, Y item indicates the centroid of the found prototype. The Angle item indicates the difference between the orientation of the prototype model and the orientation of the found prototype. VisionWare User’s Guide, Rev. A 235 Appendix D - Basic, OCR, and Special Purpose Records D.12 OCR Font Records Font records create the prototype font that is used by text verification records to locate strings of text. Every OCR Field record requires a font record. See Chapter 8 for details on OCR operations. ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure D-6 OCR Font Record 236 VisionWare User’s Guide, Rev. A OCR Font Record Options D.13 OCR Font Record Options ➊ ➋ ➌ ➍ Shows the name of the font record, the date it was created, and the font number for this record. Choose this data box to enter or change the characters in this font. Choose the number set, the capital letter set, or the lower case letter set to have the entire set added to the font (item ➋). Choose Show Regions to see the regions VisionWare considers to be in the font. (The regions are outlined in green.) Indicate whether the font characters are white on a dark background or black on a light background. ➎ ➏ ➐ ➑ ➒ ➓ Enter the minimum area (in pixels) for a single character in the font. Any regions with an area below this value will not be considered in the recognition process. Use this option to filter disjoint regions (such as the dot on an i). Place a sample of the font in the field of view and choose Measure it . Follow the displayed series of steps to measure the height of a capital character in the font. The results are displayed in Pixel height of chars. Enter a picture record to be used when training this font. This picture record should also be used by the OCR Field records that use this font. Place a sample of the font in the field of view and choose Train to create the prototype model of the font characters in item ➋. Choose Show to display the training status of the characters in the font. When you have completed training of the font, choose Plan to prepare the font for use by an OCR Field record. VisionWare User’s Guide, Rev. A 237 Appendix D - Basic, OCR, and Special Purpose Records D.14 OCR Field Records An OCR Field record performs text verification or recognition. Verification or recognition is based on a trained font. Font creation is detailed in Section D.12. ➋ ➌ ➊ ➍ ➎ ➐ ➑ ➏ ➒ ➓ ❋ ✠ ◆ Figure D-7 OCR Field Record 238 VisionWare User’s Guide, Rev. A OCR Field Record Options D.15 OCR Field Record Options ➊ ➋ ➌ ➍ ➎ ➏ Shows the name of the OCR Field record and the date it was created or last altered. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. If Full text recognition is selected, this option must be selected to make this record available to the OCR_OUTPUT statement. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. In the Picture name data box, enter the picture record to be used when text recognition or verification is attempted. The picture record must use the same camera record as the font record used. In the Font name data box, enter the name of the font (OCR Font record) that contains the anticipated characters. Choose Tool Loc to view the absolute coordinates of the OCR Field search area, or to make the search area frame relative. The search area can be sized with the drag handles, or by entering the absolute coordinates in the pop-up window displayed after this button is chosen. ➐ Select ✔ Relative to to make the tool relative to a vision frame. A data box is displayed requiring a source record that returns a frame value. ➑ If ✔ Relative to is selected, select ✔ Force absolute angle of zero to force the reference-frame angle to be ignored and assumed to be zero. ➒ If Verify against expected chars is selected, successive regions in the OCR search area are compared to the corresponding characters in the expected text (item ➓). If Verify against all chars is selected, each region in the OCR search area is compared with every character in the font. This option requires more processing time. If Full text recognition is selected, all characters recognized within the search area are returned along with the average and minimum recognition score. See the OCR_OUTPUT statement in Chapter 3 for details on full text recognition. ➓ ❋ Specify the characters you expect to find in the field of view (not used with full text recognition). Choose Train to train the font (this button is not active until a font name is entered). Choose Show Font to see the status of the font. ✠ ◆ Max execution time (secs) allows you to limit the amount of time the tool spends verifying or recognizing characters. Max blob area (in pixels) allows you to limit character recognition to bounded regions that are smaller than the specified area. The results returned for each type of operation are described in “OCR Field Results” on page 138. VisionWare User’s Guide, Rev. A 239 Appendix D - Basic, OCR, and Special Purpose Records D.16 Correlation Templates Correlation templates record the graylevel values of a section of pixels. Correlation windows compare areas of the field of view with the correlation template. See Chapter 8 for details on correlation operations. ➊ ➋ ➌ ➎ ➍ ➏ ➐ ➑ Figure D-8 Correlation Template Menu Page 240 VisionWare User’s Guide, Rev. A Correlation Template Options D.17 Correlation Template Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ Shows the name of the correlation template record and the date it was created or last altered. Select a picture record to use when training this correlation template. Correlation templates are automatically numbered by VisionWare. This information shows the number of this template record. Size the template search area so it encompasses the image area you want to train and then choose Train . Choose Show to outline the image area trained as a correlation template. Select to allow hierarchical searching. This method of searching can produce significant improvement in the speed of correlation matching. See the Correlation Window description for details. This area shows the location of the image template. This area shows the size of the image template. The speed of finding a correlation template match within a correlation window is relative to the size of the image template and the size of the match search area. Large templates or large search areas will consume considerable processing time. Choose Opti-size to increase your template to the next largest size that is optimal for the correlation algorithm. Normally you should choose this button only once. Repeatedly choosing it makes your template much larger than necessary and slows down this tool. VisionWare User’s Guide, Rev. A 241 Appendix D - Basic, OCR, and Special Purpose Records D.18 Correlation Windows A correlation window defines a search area within which matches to a correlation template are to be located. ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure D-9 Correlation Window 242 VisionWare User’s Guide, Rev. A Correlation Window Options D.19 Correlation Window Options ➊ ➋ Shows the name of the correlation window record and the date it was created or last altered. Select ✔ TopLevel to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. VisionWare statements cannot directly use a correlation window record.) Select ✔ Show at runtime to have the window’s tool graphics displayed when runtime graphics are displayed during sequence execution. ➌ Select a picture record to use during template matching (does not have to be the same picture record used when the template was trained, but the same camera record should be used). Select the correlation template record to use for the matching operation. ➍ Select Match only, no search area to restrict template matching to an area the same size as the correlation template. Select Allow search area to allow template matching in an area larger than the template. ➎ ➏ Choose Show template to show the template location within the field-of-view. This group shows the location and size of the correlation window. Select ✔ Relative to to make this tool relative to a vision frame class tool. Choose Snap tool to template exactly to force the correlation window to exactly match the template location and size. ➐ ➑ ➒ ➓ Specify the hierarchical search options. In this type of search, a rough search is made in the search area and areas are identified that might contain a match. Finer searches are then made only in these areas. This process is repeated the number of times specified in Max depth. The accept and reject level indicate a score for determining which areas to search again at the next higher level. Maximum search time indicates how long to search before completing the search or declaring failure. The match coefficient indicates the percent of pixels in the match area that correspond to pixels in the template. This area shows the center of the matching area. This area shows the size of the correlation window. VisionWare User’s Guide, Rev. A 243 Appendix D - Basic, OCR, and Special Purpose Records D.20 Frame Pattern Records Frame pattern records create multiple vision frames. Any records that are declared to be relative to a frame pattern record will be repeated for all the frames created (a value combination record is also required – see Chapter 10). ➋ ➊ ➌ ➍ ➎ ➏ ➐ ➑ ➒ Figure D-10 Frame Pattern Record 244 VisionWare User’s Guide, Rev. A Frame Pattern Record Options D.21 Frame Pattern Record Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ Shows the name of this frame pattern record and the date it was last modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a frame pattern record.) Select a picture record to be associated with this frame pattern record. This record provides the default reference frame for the returned results. Select a pattern for this repeating frame. In the Count data box, enter the number of times the frame should be repeated. For rectangular patterns, two data boxes will be displayed. Use these data boxes to specify the size of the grid of frames. Use the drag handles on the frame pattern tools to set the size, location, and orientation of the tool. The values will be displayed in these data boxes. (You can also edit the values directly). Select this option if this frame pattern is to be relative to another vision frame. A data box will be displayed for the vision frame. If another frame pattern record is selected, all the instances generated by this record will be repeated for each instance of the specified frame pattern record. This data box shows the distance between frames in linear or rectangular patterns, or the angular spacing between frames in arc shaped patterns. Shows the value of the displayed frame. This is the first frame that will be evaluated. It is also the frame that will be used if this frame pattern record is not associated with a value combination record. Choose this button to show all the frames that will be created by this record. VisionWare User’s Guide, Rev. A 245 Appendix D - Basic, OCR, and Special Purpose Records D.22 Conditional Frame Records Conditional frame records allow you to specify a frame to use only when certain criteria are met. ➊ ➋ ➌ ➍ ➎ Figure D-11 Conditional Frame Record 246 VisionWare User’s Guide, Rev. A Conditional Frame Record Options D.23 Conditional Frame Record Options ➊ ➋ ➌ Shows the name of this conditional frame record and the date it was last modified. Select a frame source and inspection records that this frame’s conditional use will be based on. If all the specified inspections pass, the frame record will be evaluated and the result passed to all records using this frame as a source. If an inspection fails, a null frame result will be passed. If ✔ Condition Offset on Inspection Record is not selected, the values from the X, Y, and Angle data boxes are always added to the resulting frame value. If this item is selected, the X, Y, and Angle values are conditionally added based on the criteria specified in the Inspection for Conditional Offset ➍ area. If ✔ Specify nominal angle is selected, the orientation of the frame result is constrained to be ±90 ° of the specified angle. ➍ A vision inspection record name must be placed in the Inspection data box. The success or failure of this inspection and its results determine if the Frame Offset is added to the frame result. If no error occurs during the inspection operation: - If Inspection Passes is selected, the Frame Offset is added if the result is “pass”. - If Inspection Fails is selected, the Frame Offset is added if the result is “fail”. If an error occurs during the inspection operation: - If Don't use Frame Offset is selected, the frame offset is not added to the result. - If Use Frame Offset is selected, the frame offset is added to the result. - If Reject this record is selected, the entire conditional frame record fails and returns the error from the inspection. ➎ This area shows the results of the conditional frame evaluation. VisionWare User’s Guide, Rev. A 247 Finder Tool Records E E.1 Line Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 E.2 Line Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 E.3 Point Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 E.4 Point Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 E.5 Arc Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 E.6 Arc Finder Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 VisionWare User’s Guide, Rev. A 249 Appendix E - Finder Tool Records E.1 Line Finder Records Line finders locate edges of objects or edges of object features. ➋ ➌ ➊ ➍ ➏ ➎ ➐ ➑ ➒ ➓ Figure E-1 Line Finder Tool Record 250 VisionWare User’s Guide, Rev. A Line Finder Record Options E.2 ➊ ➋ ➌ ➍ ➎ ➏ ➐ Line Finder Record Options Shows the name of the line finder record and the date it was created. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a line finder record.) Select this option to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Enter the name for a picture record to be used by this line finder record. Choose this button to edit the absolute coordinates of the tool search area. Check this box to make the tool relative to a vision frame (see “Making Vision Tools Relative to a Vision Frame” on page 147). Type the name of the vision frame. Type of Edge Data: Select Sub-pixel grayscale edges and the finder tool will locate edges based on grayscale data using the edge strength value specified by Edge strength. Set edge strength to the difference in pixel intensities that must be found before an edge is detected. Select Binary edges using binary images and the finder tool will locate edges based on binary data using the threshold values specified in the picture record associated with this tool record (item ➍). Select Binary (specified threshold) and the finder tool will locate edges based on binary data using the threshold values specified by Threshold and 2nd threshold. (When this option is selected, Scroll bars displays scroll bars for the thresholds.) Edges will be detected in the binary image based on these specified threshold settings (see Chapter 13 for details on binary and grayscale images). Use edge points closest to: In the event of multiple edges in the search area: selecting tool to use the edge nearest the dark blue line of the tool. Selecting Dark side causes the Guide line causes the tool to use the edge nearest the guide line (green). Selecting Light side causes the tool to use the edge found nearest the light blue line. (Line finders search for edges in a dark-to-light direction. Therefore, a dark-tolight transition must occur within the line finder tool search area.) Set Effort level % to the percentage of individual points on the search line that are used to detect edges. Higher effort levels require more found points before a line is successfully fit (and require more processing time). For example, at effort level 50, only half of the individual points on the finder tool are used in the search for an edge. Clearly defined edges generally require an effort level less than 20%. Use the lowest effort level required to accurately locate features in the image. VisionWare User’s Guide, Rev. A 251 Appendix E - Finder Tool Records ➑ ➒ ➓ Lines are generated by a line finder based on a least squares algorithm using the individual points found within the search area of the tool. If you enable iterative refinement, you control how precise the line fitting must be. In the Max err dist (pixels) data box, enter the maximum difference allowed between a found point and the corresponding point on the fit line. The iterative refinement will filter points that do not meet this criterion. In the Max std dev (pixels) data box, enter the maximum standard deviation acceptable. The iterative refinement will filter points until the standard deviation of the fit line is lower than the specified maximum. The points that are used to generate the fit line are shown in white. The filtered points are shown in gray. (Options ➡ ✔Show edge points must be selected from the vision window menu bar.) If ✔ Specify nominal angle is selected, the orientation of the found line will be constrained to ± 90° of the specified angle. Since all lines have an inherent 180° ambiguity, this option allows you to control the orientation returned by a finder tool. Line found indicates whether a line was found. The Clipped item indicates whether the window is completely within the processed area of the field of view. If a line is found, the X and Y values displayed in the Point on Line information boxes represent the closest point on the found line to the initial search location (indicated by a white dot in the tool graphic). The angle of the found line with respect to the vision X axis is displayed in the Angle of Line information box. Maximum error distance indicates the maximum deviation between the edge points used and the found line (in pixels). The error is calculated only along the section of the search line that actually registered points on the found line. If ✔ Enable is selected for iterative refinement, the results show the maximum error on the dark and light sides of the tool. Percentage of points filtered out indicates what percentage of found points were not used in generating the fit line. Percentage of line with edge points indicates how many points on the search line coincided with the line that was actually found. 252 VisionWare User’s Guide, Rev. A Line Finder Record Options VisionWare User’s Guide, Rev. A 253 Appendix E - Finder Tool Records E.3 Point Finder Records Point finder tools return the X/Y coordinates of a point, as well as an indication of whether a point was found or not. The found point can be used by any record requiring a point value. ➋ ➌ ➊ ➍ ➏ ➎ ➐ ➑ ➒ ➓ ❋ Figure E-2 Point Finder Tool Record 254 VisionWare User’s Guide, Rev. A Point Finder Record Options E.4 ➊ ➋ ➌ ➍ ➎ ➏ ➐ Point Finder Record Options Shows the name of the point finder record and the date it was created. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a point finder record.) Select this option to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Specify the picture record to be used when an image is acquired for this vision tool. Choose this button to edit the absolute coordinates of the tool search area, or to make the tool relative to a vision frame (see “Making Vision Tools Relative to a Vision Frame” on page 147). Check this button to make the tool relative to a vision frame.Type the name of the vision frame. Points are searched for in a dark-to-light direction (a dark-to-light transition must occur within the tool search area). In the event of multiple points in the search area: Selecting the tool. Dark side causes the tool to use the point nearest the dark blue line of Selecting Light side causes the tool to use the point found nearest the light blue line. (A white dot on the search area graphic indicates the starting search direction.) The found point is marked with a pink dot. If Options ➡ ✔Show edge points is performed from the vision window, the unused points are shown in white. ➑ Select Sub-pixel grayscale edges and the finder tool will locate points based on gray-scale data using the edge strength value specified in item ➒. Select Binary edges using binary image and the finder tool will locate points based on binary data using the threshold values specified in the picture record associated with this tool record (item ➍). Select Binary (specified threshold) and the finder tool will locate points based on binary data using the threshold values specified in item ➒. ➒ ➓ ❋ The options displayed here will depend on the selection made from item ➑. Effort level % controls the density of the search. For example, at effort level 50, only half the pixels within the search area are checked for transitions. Indicates whether a point was found, and whether the window is completely within the processed area of the field of view. If a point is found, its X and Y values are displayed in the Point information boxes. VisionWare User’s Guide, Rev. A 255 Appendix E - Finder Tool Records E.5 Arc Finder Records Arc finder tools return the X/Y coordinates of the center of the found arc, the radius of the arc, information on how accurately the arc was located, and whether an arc or circle was found. ➊ ➋ ➍ ➌ ➎ ➏ ➐ ➑ ➒ ➓ Figure E-3 Circle Finder Tool Record 256 VisionWare User’s Guide, Rev. A Arc Finder Record Options E.6 ➊ ➋ ➌ ➍ ➎ Arc Finder Record Options Shows the name of the arc finder record and the date it was created. The Top Level item is primarily for other AIM application modules and is not generally selected in VisionWare. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Enter the name of a picture record to be used to acquire images for this arc finder. Choose this button to edit the absolute coordinates of the tool search area, or check the Relative to box to make the tool frame relative (see “Making Vision Tools Relative to a Vision Frame” on page 147). You can also select a tool editing mode for arc-shaped tools. Fixed center allows you to change the tool’s included angle and radii without moving the tool center. Three points allows the center to move as the included angle or radii are changed. Select either Full circle for a complete circle or Circular arc for an arc shaped tool. The default tool will be displayed in the vision window. It can be edited using the drag handles. ➏ Search modes: Indicate the intensity of the inside of the circle. This option, in conjunction with the options in the Closest to items, allows you to control which arc is located when multiple arcs are seen within the search area. Select the measurement(s) you want the arc finder to make: If Center is selected, the arc center will be calculated and the radius reported will be the tool radius (choose Radius is selected, the arc radius will be Tool loc to see the tool radius). If calculated and the center reported will be the tool center (choose Tool loc to see the tool radius value). If Both is selected, the arc center and radius will be calculated. In the event of multiple edges in the search area, selecting Inside causes the tool to use the arc nearest the inside of the tool. Selecting Guide line causes the tool to use the arc nearest the guide line (green). Selecting Outside causes the tool to use the arc found nearest the outside of the tool. ➐ Type of Edge Data: Select Sub-pixel grayscale edges and the finder tool will locate edges based on grayscale data using the edge strength value specified by Edge strength. Set edge strength to the difference in pixel intensities that must be found before an edge is detected. Select Binary edges using binary images and the finder tool will locate edges based on binary data using the threshold values specified in the picture record associated with this tool record (item ➌). Select Binary (specified threshold) and the finder tool will locate edges based on binary data using the threshold values specified by Threshold and 2nd threshold. (When this option is selected, Scroll bars displays scroll bars for the thresholds.) Edges will be detected in the binary image based on these specified threshold settings (see Chapter 13 for details on binary and grayscale images). VisionWare User’s Guide, Rev. A 257 Appendix E - Finder Tool Records ➑ ➒ ➓ Set Effort level % to the percentage of individual points on the search line that are used to detect edges. Higher effort levels require more found points before an arc is successfully fit (and require more processing time). For example, at effort level 50, only half of the individual points on the finder tool are used in the search for an edge. Clearly defined edges generally require an effort level less than 20%. Use the lowest effort level required to accurately locate features in the image. Arcs are generated by an arc finder based on a least squares algorithm using the individual points found within the search area of the tool. If you enable iterative refinement, you control how precise the arc fitting must be. In the Max err dist (pixels) data box, enter the maximum difference allowed between a found point and the corresponding point on the fit arc. The iterative refinement will filter points that do not meet this criterion. In the Max std dev (pixels) data box, enter the maximum standard deviation acceptable. The iterative refinement will filter points until the standard deviation of the fit arc is lower than the specified maximum. The points that are used to generate the fit arc are shown in white. The filtered points are shown in grey. (Options ➡ ✔Show edge points must be selected from the vision window menu bar.) Arc found indicates whether or not an arc was found. Clipped indicates whether the search area was completely within the processed area of the field of view. If an arc is found, its X and Y (center) values are displayed in the Center information boxes. The radius of the found arc is displayed in the Radius information box (see the next section for additional details on the values reported here). Maximum error distance indicates the maximum deviation between the edge points used and the found arc (in pixels). The error is calculated only along the section of the search arc that actually registered points on the found arc. If iterative refinement is enabled, Max error on outside shows the maximum deviation to the outside of the fit line, Max error on inside shows the maximum pixel deviation to the inside of the fit arc, % of arc with edge pts indicates how many points on the search arc coincided with the arc that was found, and % of points filtered out shows the percentage of points not used to generate the fit arc. 258 VisionWare User’s Guide, Rev. A Computed Feature Records F F.1 Computed Line Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 F.2 Computed Line Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 F.3 Computed Point Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 F.4 Computed Point Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 F.5 Computed Circle Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 F.6 Computed Circle Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 F.7 Computed Frame Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 F.8 Computed Frame Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 VisionWare User’s Guide, Rev. A 259 Appendix F - Computed Feature Records F.1 Computed Line Records A computed line can be created from any two points. Computed lines can also be created running through a point parallel to a line, or running through a point and perpendicular to a line. You can also use this type of record to place reference (fixed) lines in the field of view. ➋ ➊ ➌ ➍ ➎ Figure F-1 Computed Line Record 260 VisionWare User’s Guide, Rev. A Computed Line Record Options F.2 ➊ ➋ ➌ ➍ ➎ Computed Line Record Options Shows the name of the computed line record and the date it was created or last modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a computed line record.) Select the method for computing a line: Fixed line A fixed line must be associated with a picture record. A data box labeled In PICTURE is displayed requesting a picture record. Data boxes are displayed showing the X/Y coordinates of a point on the line, and angle of the line relative to the vision X axis. Change the values in the data boxes to create the desired line, or use the drag handles to move the line to the desired location. This line also can be made relative to a vision frame. Through 2 POINTs Two data boxes are displayed requesting point class records (Table 5-1). Select existing records or create new ones. VisionWare will calculate a point running through these two points. Through POINT, parallel to LINE Two data boxes are displayed requesting vision records. One requires a point class record (Table 5-1). The other requires a line class record (Table 5-2). VisionWare will create a line going through the point parallel to the line. Through POINT, perpendicular to LINE Two data boxes are displayed requesting vision records. One requires a point class record (Table 5-1). The other requires a line class record (Table 5-2). VisionWare will create a line going through the point perpendicular to the line (shortest distance). If ✔ Specify nominal angle is selected, the orientation of the found line will be constrained to ±90° of the specified angle. Since all lines have an inherent 180° ambiguity, this option allows you to control the orientation of the computed line. This option is particularly important if the computed line results are being used to generate a vision frame. Shows the X/Y coordinates of the center point of the line and the angle of the line with respect to the vision X axis. These values can be used by other vision records requiring a line result. VisionWare User’s Guide, Rev. A 261 Appendix F - Computed Feature Records F.3 Computed Point Records Often, the most accurate way to calculate a point is to compute it from other features. For example, computed points can be calculated based on the intersection of a line and another line, a line and a circle or midway between two points. A computed point record is also used to place a fixed point in the field of view A fixed point could be used if you want to make all your measurements from a known reference point. ➋ ➊ ➌ ➍ Figure F-2 Computed Point Record 262 VisionWare User’s Guide, Rev. A Computed Point Record Options F.4 ➊ ➋ ➌ ➍ Computed Point Record Options Shows the name of the computed point record and the date it was created or last modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a computed point record.) Select the method for computing a point: Fixed point A fixed point must be associated with a picture record. A data box labeled In PICTURE is displayed requesting a picture record. Data boxes are displayed showing the X/Y coordinates of a fixed point. Change the values in the data boxes to place the point at the desired location, or click on the point in the vision window and drag it to the desired location.This point can be made relative to a vision frame. LINE-LINE intersection Two data boxes are displayed requesting vision records that return lines (Table 5-2). Select existing records or create new ones. VisionWare will calculate the X/Y intersection of these two lines. CIRCLE-LINE intersection Two data boxes are displayed requesting vision records. One requires a line class record (Table 5-2). The other requires a record returning the center of a circle (computed circle or arc finder). You are also asked to select point 1 or point 2. If you select point 1, VisionWare will calculate the intersection of the line and the first intersection point on the circle. If you select point 2, the intersection of the line and the second intersection point on the circle will be calculated. Midway between two POINTS Two data boxes are displayed requiring point class records (Table 5-1). The point returned will be midway between the points returned by the two records. Shows the X/Y coordinates of the computed point. These values can be used by other vision records requiring a point value. VisionWare User’s Guide, Rev. A 263 Appendix F - Computed Feature Records F.5 Computed Circle Records A circle can be computed using three points on the circle, or from a center point and a point on the circle. Computed points, fixed points, or points from the finder tools can be used to calculate a circle. Fixed (reference) circles can be placed in the field of view using this type of record. ➊ ➋ ➌ ➍ Figure F-3 Computed Circle Record 264 VisionWare User’s Guide, Rev. A Computed Circle Record Options F.6 ➊ ➋ ➌ ➍ Computed Circle Record Options Shows the name of the computed circle record and the date it was created or its operation was modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare. Standard VisionWare statements cannot directly use a computed circle record.) Select the method for computing a circle: Fixed circle A fixed circle must be associated with a picture record. A data box labeled In PICTURE will be displayed requesting a picture record. Data boxes will be displayed showing the X/Y coordinates and radius of a fixed circle. Change the values in the data boxes to create the desired circle, or use the drag handles to size the circle or move it to the desired location. This fixed circle can be made relative to a vision frame. Center and POINT on circle Data boxes will be displayed requesting point class records for a point for the center of the circle, and a point on the circumference of the circle (Table 5-1). Through 3 POINTs Three data boxes will be displayed requesting point class records (Table 5-1). Select existing records or create new ones. VisionWare will create a circle that intersects these three points. Shows the X/Y coordinates and the radius of the computed circle. VisionWare User’s Guide, Rev. A 265 Appendix F - Computed Feature Records F.7 Computed Frame Records Computed frames are used to create a vision frame from other features. Frames allow you to place vision tools on objects that are not always in the same location or orientation. When you create a vision tool record, you can specify that it be relative to a vision frame. If the object that defines this vision frame moves, so will the vision frame and the tools that are relative to that frame. You can also create a fixed frame using this type of record. ➋ ➊ ➌ ➍ Figure F-4 Computed Frame Record 266 VisionWare User’s Guide, Rev. A Computed Frame Record Options F.8 ➊ ➋ ➌ Computed Frame Record Options Shows the name of the computed frame record and the date it was created last modified. Select this option to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record will also show up in the pick list displayed when a --vision-- argument is selected from the sequence editor. (This option is primarily for other AIM application modules and is not generally selected in VisionWare.) Select the method for computing a frame: NULL frame This option will give you a frame whose value is the same as the vision reference frame. The X, Y, and rotation values will all be 0. Fixed Frame This option allows you to place a reference frame anywhere in the field of view. A fixed frame must be associated with a picture record. A data box labeled In PICTURE will be displayed requesting a picture record. Three additional data boxes will be displayed showing the origin and rotation of the fixed frame (with respect to the vision reference frame). Enter new values in these data boxes to create the desired reference frame, or use the drag handles on the frame graphic to move the frame to the desired location. A fixed frame can be relative to another frame. Origin, POINT on X axis, PT in + Y dir This option requires three records (refer to Table 5-1): Origin POINT: a record returning a point value to specify the origin of the frame. PT on X axis: a record returning a point on the X axis (positive or negative). PT in +Y dir: a record returning a point in the positive Y direction (does not have to be on the Y axis). Origin, POINT on the + X axis This option requires two records (refer to Table 5-1): Origin POINT: a record returning a point value to specify the origin of the frame. PT on +X axis: a record returning a point on the positive X axis. X axis, POINT on +Y axis This option requires two records (refer to Table 5-1 and Table 5-2): X axis: a record returning a line to form the X axis of the frame. POINT on +Y axis: a record returning a point in the +Y direction. The Y axis will go through this point and intersect the X axis at the nearest (perpendicular) distance from the point. X axis, LINE thru origin This option requires two records (refer to Table 5-2): X axis: a record returning a line to form the X axis of the frame. LINE thru origin: a record returning a line. The intersection of this line and the X axis line will form the origin of the frame. (This line does not form the Y axis of the frame; the Y axis is perpendicular to the X axis, starting at the point the two lines intersect.) ➍ Shows the X/Y coordinates and the rotation of the computed frame with respect to the vision coordinate frame. The frame origin can be used by vision records requiring a point value. The X axis of the frame can be used by records requiring a line value. VisionWare User’s Guide, Rev. A 267 General Tool Records G G.1 Linear Ruler Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 G.2 Linear Ruler Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 G.3 Arc Ruler Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 G.4 Arc Ruler Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 G.5 Ruler Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 G.6 Ruler Profile Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 G.7 Window Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 G.8 Window Record Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279 G.9 Image Processing Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 G.10 Image Processing Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Add Two Images. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Subtract Images (A - B) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 Convolve. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Morphological Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 Edge Detection Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Threshold Image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Copy Image to New Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 G.11 Blob Finder Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 G.12 Blob Finder Record Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 VisionWare User’s Guide, Rev. A 269 Appendix G - General Tool Records G.1 Linear Ruler Records A linear ruler detects edges (intensity transitions) along its length. The results returned by this record are: the distances from the start of the ruler to the first edge and from the first to the last edge, the X/Y coordinates of the first edge, the number of edge points found, and a ruler clipped indicator. ➋ ➊ ➍ ➌ ➎ ➏ ➐ ➑ ➒ ➓ Figure G-1 Linear Ruler Tool Record 270 VisionWare User’s Guide, Rev. A Linear Ruler Record Options G.2 Linear Ruler Record Options ➊ ➋ Shows the name of the ruler record and the date it was last modified. Select ✔ TopLevel to have this tool record included in the list of top-level records presented when the vision record tree display is activated. The record also shows up in the pick list displayed when a --vision-- argument is selected from the sequence editor. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. See Chapter 9 for details on repeat records. ➌ ➍ ➎ Choose this button to edit the absolute coordinates of the tool search area, or to make the tool relative to a vision frame (see Section 9.6). Specify the picture record to be used when an image is acquired for this tool. Select Sub-pixel grayscale edges for the ruler to locate edges based on grayscale data using the edge strength value specified in item ➏. Select Binary edges using binary image for the ruler to locate edges based on binary data using the threshold values specified in the picture record associated with this tool record (item ➍). Select Binary (specified threshold) for the ruler to locate edges based on binary data using the threshold values specified in item ➏. (When this option is selected, item ➏ displays scroll bars for the thresholds.) ➏ If Sub-pixel grayscale edges is selected, a slide bar for edge strength is displayed. If Binary edges using binary image is selected, this area is blank. If Binary (specified threshold) is selected, slide bars for threshold and 2nd threshold are displayed. ➐ ➑ Choose Show Profile to show the ruler profile (see “Ruler Profiles” on page 276). The edge point reported in the Results group is the edge specified in Use edge #. Edge direction specifies the intensity change that must occur before an edge is detected. Dark-to-light detects edges only when the ruler senses a dark-to-light transition (goes from a low graylevel value to a high graylevel strength value, or from a black to a white pixel). Light-to-dark detects edges when the ruler senses a lightto-dark transition. Any direction detects transitions in either direction. If ✔ Return “not found” if no edges is selected, the not found error is returned when this tool fails to find an edge. The not found error generates a yellow warning sign on any records using this record as a source record. ➒ The #edge points displays the total number of edges found by the ruler. The Clipped item indicates whether the ruler was entirely within the FOV. Edge point displays the coordinate values of the specified edge. Distance to 1st edge displays the distance from the start of the ruler to the first edge found. Distance from 1st to last edge displays the distance from the first edge found to the last edge found. VisionWare User’s Guide, Rev. A 271 Appendix G - General Tool Records ➓ 272 See Chapter 9 for details on repeat records. VisionWare User’s Guide, Rev. A Linear Ruler Record Options VisionWare User’s Guide, Rev. A 273 Appendix G - General Tool Records G.3 Arc Ruler Records Arc rulers measure the angular spacing between edges along an arc. Gauge faces, gears, and similar radially oriented objects can be effectively inspected with arc rulers. ➋ ➊ ➌ ➍ ➎ ➏ ➑ ➐ ➒ ➓ Figure G-2 Arc Ruler Tool Record 274 VisionWare User’s Guide, Rev. A Arc Ruler Record Options G.4 Arc Ruler Record Options ➊ ➋ Shows the name of the arc ruler record and the date it was last modified. Select ✔ TopLevel to have this tool record included in the list of top-level records. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. See Chapter 9 for details on repeat records. Choose Tool Loc to edit the coordinates of the tool search area, or to make the tool relative to a vision frame (see Section 9.6). ➌ ➍ ➎ ➏ Specify the picture record to be used when an image is acquired for this tool. Select partial arc or Full circle. Once a shape has been selected, use the tool drag handles to size and locate the tool. The tool location values can be displayed by choosing Tool Loc . Fixed center allows you to change the tool’s included angle and radii without moving the tool center. Three points allows the center to move as the included angle or radii are changed. Select Sub-pixel grayscale edges for the ruler to locate edges based on grayscale data using the edge strength value specified in Edge strength. (If this option is selected, a slide bar for edge strength is displayed.) Select Binary edges using binary image for the ruler to locate edges based on binary data using the threshold values specified in the picture record associated with this tool record. Select Binary (specified threshold) for the ruler to locate edges based on binary data using the threshold values specified in threshold and 2nd threshold. (If this option is selected, scroll bars for threshold and 2nd threshold are displayed.) ➐ ➑ Edge direction specifies the intensity change that must occur before an edge is detected. Dark-to-light detects edges only when the ruler senses a dark-to-light transition (goes from a low edge graylevel value to a high graylevel strength value, or from a black to a white pixel). Light-to-dark detects edges when the ruler senses a light-to-dark transition. Any direction detects transitions in either direction. Select ruler. Clockwise for edges to be searched for in a clockwise direction along the arc Select Counter-clock for edges to be searched for in a counter-clockwise direction. The edge point reported in the Results group is the edge specified in Use edge #. ➒ ➓ Choose Show Profile to show the ruler profile (see “Ruler Profiles” on page 276). If ✔ Return “not found” if no edges is selected, the not found error is returned when this tool fails to find an edge. The not found error generates a yellow warning sign on any records using this record as a source record. The #Number of edge pts item displays the total number of edges found by the ruler. Clipped indicates whether the ruler was entirely within the FOV. Edge point displays the coordinate values of the specified edge. Angle to 1st edge pt displays the angle VisionWare User’s Guide, Rev. A 275 Appendix G - General Tool Records from the start of the ruler to the first edge found. Angle from 1st to last displays the angle between the first edge found and the last edge found. G.5 Ruler Profiles When the Show Profile button is chosen from a ruler tool record, these graphs are displayed. The ruler profile allows you to see exactly what a ruler is finding along its length. The profiles are very useful for fine-tuning the edge strength and threshold values specified for the ruler. They are also a good way to see how different lighting conditions affect ruler performance. ➊ ➋ ➌ ➍ ➏ ➎ ➐ ➑ Figure G-3 Ruler Profiles 276 VisionWare User’s Guide, Rev. A Ruler Profile Options G.6 Ruler Profile Options ➊ ➋ ➌ ➍ ➎ Plots the graylevel value found in each pixel the ruler crosses. If a binary ruler type has been selected, purple lines on this graph indicate the values of Threshold and 2nd threshold. Only the first 400 pixels are plotted. This axis represents graylevel intensities. Plots the difference in graylevel values from one pixel to the next. If a grayscale ruler has been selected, purple lines on this graph represent the edge strength value. Since edges are looked for in a dark-to-light as well as light-to-dark direction, there is a purple line for each direction. The profile shown in Figure G-3 is for a ruler with edge strength set to 20. The ruler found a dark-to -light edge and then another dark-to-light edge. Only the first 400 pixels are plotted. This axis represents the change in graylevel values between pixels (gradient). If a grayscale ruler has been selected, a data box and slide bar for edge strength is displayed. If you change the value of edge strength, the value in the tool record is also changed. If a binary ruler using specified threshold values has been selected, data boxes and slide bars for Threshold and 2nd threshold are displayed. If you change the threshold values, the threshold values in the tool record are also changed. If a standard binary ruler has been selected (using the threshold values from the picture record associated with the ruler record), this area is blank. ➏ Once a ruler profile has been displayed, the range of values on the Y axis is not updated unless Re-plot is chosen. If you change threshold or edge strength values so they exceed the current range of values, the purple lines indicating threshold and edge strength values are not drawn until the graph is re-plotted. If you move or re-size the vision tool while the Ruler Profile window is open, the data for the new ruler location is not updated until Re-plot is chosen. ➐ ➑ Choose this button to exit the ruler profile display. This item shows the number of edge points that are detected. VisionWare User’s Guide, Rev. A 277 Appendix G - General Tool Records G.7 Window Records Windows return data about graylevel values or thresholded pixel values within the window. These records are used primarily with the Window stats inspection type. See Chapter 13 for a discussion of graylevel and thresholded pixel values. ➋ ➊ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓ Figure G-4 Window Tool Record 278 VisionWare User’s Guide, Rev. A Window Record Options G.8 Window Record Options ➊ ➋ ➌ ➍ ➎ ➏ ➐ Shows the name of the window record and the date it was last modified. Select ✔ TopLevel item to have this tool record included in the list of top-level inspections and the pick list displayed when a --vision-- argument is selected from the sequence editor. Select ✔ Show at runtime to have the vision tool graphics displayed in the vision window when an inspection using this record is run. Choose this button to edit the absolute coordinates of the tool search area, to select a tool editing mode (fixed center or 3 point), or to make the tool relative to a vision frame (see Section 9.6). Specify the picture record to be used when an image is acquired for this tool. Select ✔ Force absolute angle of zero to ignore the relative vision frame angle and always use an angle of zero. Select the window shape that most closely fits the area you are inspecting. Once a shape has been selected, the default tool is shown in the vision window. Use the tool drag handles to size and locate the tool. The tool shape and location values can be displayed by selecting item ➌. Fixed center allows you to change the tool’s included angle and radii without moving the tool center. Three points allows the center to move as the included angle or radii are changed. This mode is not meaningful for rectangular shapes. Select the statistics you want the record to gather. Not all options can be selected individually. Selecting ✔ Standard deviation, for example, causes other options to be automatically selected. See Chapter 13 for a discussion of graylevel intensities, edge strength, and binary threshold values. The different operations are: Count white/black pixels: Returns the number of white and the number of black pixels found within the window. The threshold values used are the threshold settings of the picture record associated with this tool (item ➍). Count edge pixels: Returns the number of edge pixels found within the window. When this option is selected, an Edge strength thresh data box is displayed. You must enter the required change in intensity value between pixels before an edge will be detected. Average graylevel: Returns the average graylevel value found in the pixels within the window. Min and max graylevel: Returns the minimum and maximum graylevel values found in the pixels within the window. Dynamic white/black pixel cnt: Returns the number of white and black pixels. The pixel count is based on the threshold values you enter into the Threshold and 2nd threshold data boxes. (Threshold data boxes and slide bars are displayed when this option is selected.) Standard deviation: This option returns the standard deviation from the average intensity value found within the window. ➑ If a graylevel statistic was selected from item ➐, the results are displayed here. VisionWare User’s Guide, Rev. A 279 Appendix G - General Tool Records ➒ ➓ 280 If a pixel counting operation was selected from item ➐, the results are displayed here Window clipped indicates whether the search area was within the field of view. VisionWare User’s Guide, Rev. A Window Record Options VisionWare User’s Guide, Rev. A 281 Appendix G - General Tool Records G.9 Image Processing Records Image processing records allow you to perform various image processing operations on the image from a picture record. This processed image can then be used as a source record wherever a picture record is normally used. ➊ ➋ ➌ ➍ Figure G-5 Image Processing Record 282 VisionWare User’s Guide, Rev. A Image Processing Options G.10 Image Processing Options ➊ ➋ ➌ ➍ Select the image process you want to perform (described in the following section). This area shows options specific to each operation (described below). Specify the AOI (area of interest) option for the processed image. Normally, the AOI is the same as the primary image. However, if you need to use the unprocessed image for other vision tools, you can copy the processed image to a new AOI and preserve the original image. A virtual frame buffer combines with an AOI specification to identify a physical frame store, virtual frame buffer, and area-of-interest for storing an image. See the AdeptVision User’s Guide for details. For operations involving two images you have the choice of using either picture’s buffer or a new buffer. For operations involving a single image, you have the choice of using the picture’s buffer or a new buffer. Add Two Images This operation adds the grayscale or binary image data. Figure G-5 shows the options when Add two images is selected. The options are: • Binary: The exclusive OR result of each pair of pixels is stored. • Grayscale average: The grayscale values are added and divided by 2. • Grayscale add: The grayscale values are added and clipped at 127. You can set new threshold values for the resulting image. Subtract Images (A - B) This operation subtracts the grayscale or binary image data. The subtraction options are: • Binary: The OR result of each pair of pixels is stored. • Grayscale subtr. : The grayscale values are subtracted, 128 is added to the result (to prevent negative values), and the result is divided by 2. • Grayscale subtract: The grayscale values are subtracted and clipped at 0. You can set new threshold values for the resulting image. VisionWare User’s Guide, Rev. A 283 Appendix G - General Tool Records Convolve This operation applies a defined convolution to the image. The Processing Parameters group looks like: Convolution kernels are defined in the visini initialization database. There are also several pre-defined convolutions that are loaded when V + is started. See the description of VDEF.CONVOLVE in the AdeptVision Referenc e Guide for details on the pre-defined convolutions and how convolutions are used. The convolution can be applied multiple times. Select the number of iterations for this convolution. Specify the threshold values for the resulting image. Specify the source for the image. Morphological Operation This operation applies a defined morphological operation to the image. The Processing Parameters group looks like: Morphological operations are defined in the visini initialization database. The predefined morphological operations that are loaded when V+ is started are “erosion” and “dilation.” See the description of VDEF.MORPH in the AdeptVision Reference Guide for details on the pre-defined operations and how morphological operations are used. The operation can be applied multiple times. Select the number of iterations for this operation. Specify the threshold values for the resulting image. Specify the source for the image. 284 VisionWare User’s Guide, Rev. A Image Processing Options Edge Detection Operator This operation selects the edge detection operation used. The Processing Parameters group looks like: See the description of VEDGE in the AdeptVision Reference Guide for details. Threshold Image This operation allows you to apply both the first and second thresholds to an image. See the description of V.2ND.THRESHOLD in the AdeptVision Reference Guide for details on setting a second threshold. Copy Image to New Buffer This operation allow you to create an exact copy of an image. You can apply new threshold values to this image. VisionWare User’s Guide, Rev. A 285 Appendix G - General Tool Records G.11 Blob Finder Records Blob finders locate bounded regions in the field of view. The blob finder returns the centroid and the rotation angle of the region, the length and width of the bounding box of the region, the area of the region, and whether a region was found. ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➒ ➑ ➓ Figure G-6 Blob Finder Tool Record 286 VisionWare User’s Guide, Rev. A Blob Finder Record Options G.12 Blob Finder Record Options ➊ Select ✔ Repeat if this record is to be used as a repeat record. See Chapter 10 for details on repeat records. ➋ Select ✔ Relative to to make the tool relative to a vision frame. A data box is displayed requiring a source record that returns a frame value. Choose Snap to Full Screen to expand the blob finder tool boundaries to the entire frame size. ➌ Select a mode. Full-featured provides all information available on a blob. Quick-Blob mode provides less information but executes significantly faster. The data items that are not available to quick blobs are grayed out. Choose Select ordering to determine which blob is selected for processing from among multiple blobs. If the ✔ Repeat option is selected, this option allows you to determine the order in which multiple blobs are processed. Several of the ordering options are based on the bounding box of the blob. A bounding box is the smallest rectangle that can completely enclose the blob. ➍ The blob finder tool calculates a frame based on the found blob. The X axis line options are: Select Best fit ellipse for a line that goes through the major axis of an ellipse that would best fit around the blob. Select Max radius for a line from the centroid of the found blob to the furthest point on the perimeter of the blob. Select Min radius for a line from the centroid of the found blob to the nearest point on the perimeter of the blob. Select Zero (constant) for a line through the centroid of the blob (line is parallel to the vision X axis). The calculated line is shown in yellow on the vision window (except for a Zero line). ➎ Select Dark object if the object you are locating is dark compared with the background. Select Light object if the object you are locating is light compared with the background. Enter the minimum and maximum areas for found blobs. No blobs will be located that are smaller than the minimum area, or larger than the maximum area. The minimum hole area is used in calculating the number of holes and the resulting hole area. ➏ Select ✔ Include hole areas in “Total Area” to have the vision system not subtract hole areas from area calculations. Select ✔ Don’t consider clipped blobs to have the vision system consider only blobs that are entirely within the processed area of the field of view (when the tool angle is 0, 90, 180, or 270). VisionWare User’s Guide, Rev. A 287 Appendix G - General Tool Records ➐ Choose Show blobs to have the vision system outline the found blob(s). The outline is shown in green in the vision window. Choose Show Repeat Results to have the vision system display the frame results for all found blobs. These are the results that are returned if this is used as a repeat record. ➑ The results returned for a blob are: The Found item indicates whether or not a blob was found. The Ang item displays the angle of the line specified in item ➏. The Centroid X and Y items show the centroid of the found blob. Blob area shows the blob area. Hole areas shows the area of all the holes in the found blob. A hole is any area within the found blob that has the same intensity as the background. (Item ➎ determines which intensity is object or background.) Total area shows the total area of the found blob. Number of holes shows the number of holes found in the blob. If an orientation is selected, the angle of the orientation is shown. The Perimeter item displays the perimeter of the found blob (if ✔ Compute perimeter is selected). ➒ ➓ 288 This option uses the perspective correction from the camera calibration when analyzing blobs. Select ✔ Compute perimeter to have the perimeter of the found blob(s) calculated. (Not available for quick-blobs.) VisionWare User’s Guide, Rev. A Index Buttons, pressing Numerics 2nd threshold example 185 setting 81 C A Access level 29, 200, 201 Accounts creating user 30 Active/inactive menu options 22 Adept calibration sheet 85 AIM resource modules 14 Angle measuring 103 Arc finder records 256–258 Arc finder tools iterative refinement 258 Arc finders controlling accuracy of fit line Arc ruler 274–275 Arguments completing 38 types 43 ASCII files writing databases to 19 writing sequences to 19 AUTO.V2 198 Auto-loading modules 17 258 B Back lighting 189 Backing up files 215 Backup/Restore utility 215–220 BASEINI.DB 195, 198 Baseline initialization database 195 BFD (backup file definition) 215 Bin size 77, 170, 223 setting limits 167 Binary image example 182 Binary processing defined 182 Binary vs. grayscale processing 184 Blob defined 187 Blob finder records 286–288 289 13 Calibrating a camera 85 Calibration camera 85 defined 184 methods 85 perspective distortion 85 CALL statement 62 Camera calibration 84–88, 187 and robots 85 Camera coordinate frame 140 Camera records 82–84 creating 82 Camera resource 19 Changing sequence arguments 43 Charts inspection 170 Choosing items 13 Circle class records 92 Circle finder records 256 Clauses, optional 38 Clicking 9 Color filters 190 Combination records 155 Combine inspections inspection type 225, 226 Combining operations 154–163, 230 Commenting statements 39 Completing arguments 38 Computed circle creating 265 Computed circle records 264–265 Computed frame methods 144 Computed frame records 266–267 Computed frames creating 142 Computed line records 260–261 Computed point records 262–263 Conditional frame records 246 Conditional statements ELSE 64 END 63 EXIT_LOOP 66 IF 63 NEXT_LOOP 66 REPEAT 65 VisionWare User’s Guide, Rev. A Index WHILE 65 CONFIG_C 193 Contrast 186 Control panels master 54 task 48 Control sequences 34 Conveyor resource 19 Copying files 212 Copying modules 17 Copying records 22 Copying statement lines 39 Correlation templates 130–131, 240–241 Correlation windows 132–133, 242–243 Cpk 173 Creating a sequence 34 Creating directories 212 Creating modules 17 Cursor 22 Cursor keys 21 Cutting records 22 Cutting statement lines sequence editor 39 D Data logging and inspection record 77 Databases global 20 importing/exporting ASCII files variable 69 Debugging sequences 50 Deleting files 212 Deleting statements 39 Device, pointing 9 Diameter measuring 104 Diffuse lighting 189 Digital I/O 176–180 displaying signal status 176 negative signals 178 numbering 177 soft signals 177 statements 178 viewing states of 176 with a picture record 178 Digital I/O statements 58, 178 Digital input with picture record 178 Digital input signal and picture record 81, 229 Digital output setting state of 176 with inspection record 178 290 19 Digital output signal and inspection record 77 and picture record 81, 229 specifying 223 Directional lighting 189 Directories creating 212 duplicating 212 renaming 212 Directory displaying file directory 212 for resource module 16 Disk and memory read-write 35 DISKCOPY 192 Displaying inspection results 170 Double clicking retrieving records 26 Dragging 9 Dual-vision systems 21 Duplicating directories 212 E Edge strength defined 186 Editing modules 17 Editing records 21, 102 Editing sequences 37–56 during execution 56 Effort level with arc finder tool 258 with line finder tool 251 with point finder tool 255 ELSE 64 END 63 Executing a sequence from a sequence Executing VisionWare 8 EXIT_LOOP 66 Exiting record editing 24 Exporting databases 19 Exporting sequences 19 External trigger 178 and camera record 81, 229 F F4 key 24 File Manager 212–214 Files backing up 215 copying 212 deleting 212 displaying directory of moving 212 renaming 212 VisionWare User’s Guide, Rev. A 212 62 Index restoring 215 Finding and changing text sequence editor 43 Finding records 23 Finding sequence arguments 43 Fixed frame creating 267 Fixed frames 143 Fixed line 260 creating 261 Fixed point creating 263 FOR statement 64 Force resource 19 Frame class records 92 Frame pattern records 244–245 Frame resource 19 Function keys in sequence editor 40 IF 63 Ignore "not found" errors system message 77, 223 Importing databases 19 Importing sequences 19 Index sequence 35 Infrared filters 190 Initialization databases 195 BASEINI.DB 195 USERINI.DB 197 VISWINI.DB 196 VWINI.DB 197 Inspection test running 79 Inspection charts 170 Inspection records 76–79, 222–223 Inspection results 168–173 setting pass/fail limits 78 Inspection results menu page 168 Inspection tree for frame relative inspection 151 Inspection types combine inspections 226 measure 224 test a value 108, 225 window stats 113 Inspections combination 230 steps to create 28 Inspections types measurement 96 Installing VisionWare 192 IO 179 IO command 176 IO statement 180 IO_LIST statement 180 Iterative refinement arc finder 258 line finder 252 G Gain 187 setting 81, 229 with graylevel statistics 114 Global databases 20 and modules 20 Graphics displaying all 166 Graylevel statistics 113–117 calculating 279 Inspection type 227 Grayscale image example 182 Grayscale processing defined 182 Grayscale vs. Binary Processing 184 H High warning limit inspection record 78 Highlighting 21 Holes in blobs or prototypes K Key combinations 187 13 L I I/O signals and picture taking 81, 229 high warning limit 79 low warning limit 79 pass/fail 79 picture record 81, 229 setting signal after picture taking 229 81, Lighting back 189 diffuse 189 directional 189 strobe 189 structured 189 types 188 Line class records 91 VisionWare User’s Guide, Rev. A 291 Index Line finder records 250–252 Line finder tools iterative refinement 252 Line finders controlling accuracy of fit line 252 Line to line angle measuring 103–104 Linear ruler 270–271 LOAD statement 68 Loading modules 15 Loading modules from a sequence 68 Location resource 19 Logging data and inspection record 77 Logging off of the system 30 Logging on to the system 30 Logging vision results 171 Looping 154 Looping structures FOR 64 REPEAT 65 WHILE 65 Low warning limit inspection record 78 M Main menu options 200 Managing files 212 Manual conventions 11 Master control panel 54 Maximum limit inspection record 78 Measure Inspection type 224 Measurement types 96 angle between two lines 103 circle diameter 104 circle radius 104 point to line 101 point to point 97 Measurements types of 96 Menu bars 200–210 main menu 200, 201 main menu bar vs. window menu bar 10 record editing 203 sequence editor 208 Menu options active/inactive 22 Menu pages standard features 10 292 using 10 Menu, selection 12 Minimum limit inspection record 78 Module directory 16 Module resources types of 19 Module utilities 17 Modules 14 and global databases 20 and sequences 34 auto-loading 17 copying 17 creating 17 deleting resources 19 editing 17 importing/exporting ASCII loading 15 managing 17 resource 14 selecting 15 unloading 69 Motion devices and VisionWare 3 MotionWare using with VisionWare 8 Mouse 9 Moving files 212 N NEXT_LOOP 66 Nominal value 78 NULL frame creating 267 Null frames 143 O OCR field record 136 OCR field records 238–239 OCR font records 134, 236–237 OCR operations 134–138 Offset 186 setting 81, 229 with graylevel statistics 114 Operating system upgrading 193 Operator control panel 48–49 Optional clauses 38 Options, statement tree 46 P Pass/fail conditions VisionWare User’s Guide, Rev. A 19 Index specifying 77, 223 Pass/fail criteria for boolean values 79 Pass/fail criteria for numeric values 77 Password 30 Pasting records 22 Pasting statement lines sequence editor 39 Path for resource directory 16 Path resource 19 PAUSE_TASK statement 68 Pausing a task 68 Performing sequences 13 Perimeter calculating blob 288 Perspective correction 85 Picture records 80–81, 228–229 creating 80 Picture taking waiting on I/O signal 81, 229 Pixel 117 defined 182 Pixel counting background/object vs. black white 118 Pixels counting 279 types of counts 118 Point class records 91 Point finder records 254–255 Point to line measuring 101–103 Point to point measuring 97–100 Pointing device 9 Polarizing filters 190 Profiles ruler 276 Prototype finder records 128–129, 234– 235 Prototype model records 120, 232–234 Prototype parameters 125 Prototype training 120 Prototype vs. system parameters 125 Prototypes creating 120 editing 122 Prototypes and camera calibration 120 Prototyping 120–129 Q QCLOG.V2 Quick keys 173 record editing 204 sequence editor 209 R Radius measuring 104 Read only option for sequence 34 Recent history 167 changing value of 167 Record creating 25 finding 23 Record classes 90 circle 92 frame 92 line 91 point 91 test a value 108 test-a-value 93 Record editing menu bar options 203 quick keys 204 Record types arc ruler 274 arc/circle finder 256 blob finder 286 camera 74, 82 computed circle 264 computed frame 266 computed line 260 computed point 262 conditional frame 246 correlation window 132 correlation windows 242 frame pattern 244 inspection 74, 76, 222 linear ruler 270 OCR field 136, 238 OCR font 134, 236 picture 74, 80, 228 point finders 254 prototype finder 128, 234 prototype model 120, 232 template 130 value combination 230 vision tool 74 window 278 Recording vision results 171 Records copying 22 cutting 22 deleting 22 editing 102 VisionWare User’s Guide, Rev. A 293 Index other aids for creating 25 pasting 22 selecting different 23 Reference frames 140–151 camera 140 tutorial 148 using 140 Relative tool placement 140 Renaming directories 212 Renaming files 212 REPEAT 65 Repeat records and combination inspections Repeat trees 231 Resolution defined 183 Resource module 14 directory 16 options 17 Restoring files 215 Results file 171 Results logging 171 enabling at start up 172 RESUME_TASK statement 68 Resuming a task 68 Retry statement 53 RETURN statement 63 Returning values 28 ROBINI.DB initialization database 197 Robots and VisionWare 3 Ruler profiles 276 Rulers arc 274 graph of results 276 Runtime graphics displaying 166 S sample.arc.fdr 102 sample.ln.fdr1 102 sample.window 115 Scrolling 10 Searching for and replacing text sequence editor 43 SELECT_TASK Statement 69 Selecting 21 Selecting a task 69 Selecting items 13 Selecting modules 15 Sequence aborting 53 and module utilities 34 294 154 argument types 43 associated module 34 calling another sequence 62 copying/pasting statement lines 39 creating 34 debugging 50, 56 diskfile name 34 editing 37–56 editing during execution 50 execution 48 finding/changing arguments 43 pausing 48, 52 read only 34 read/write options 34 removing statements 39 selecting for edit 35 selecting for task 48 single step execution 50 single stepping 53 starting 48 Sequence control LOAD 68 PAUSE_TASK 68 RESUME_TASK 68 RETURN 63 SELECT_TASK 69 START_TASK 69 STOP_TASK 69 UNLOAD 69 Sequence control statements 58, 68 Sequence editor menu bar options 208 quick keys 40, 209 short cuts 40 Sequence index 35 Sequence resource 19 Sequences and resource modules 34 and statement tree 45 control 34 importing/exporing ASCII files 19 single step execution 56 Sequences, performing 13 Serial output vision results 171 Shifted Process Capability Index 173 Signals negative number 178 soft 177 special 177 Single step execution 53 Single step execution of sequence 56 Single step sequence execution 50 Soft signals 177 VisionWare User’s Guide, Rev. A Index Software installing 192 Source records 74 Speed setting robot 50 START_TASK Statement 69 Starting a task 69 Starting the system 8 Statement argument types 43 components 37 retrying 53 selecting in sequence 37 Statement lines copying and pasting 39 Statement tree 45 options 46 Statements 58–69, 178–180 CALL 62 commenting 39 digital I/O 58 ELSE 64 END 63 EXIT_LOOP 66 FOR 64 IF 63 IO 179, 180 IO_LIST 180 LOAD 68 NEXT_LOOP 66 optional arguments 38 PAUSE_TASK 68 removing from sequence 39 removing temporarily from a sequence 39 REPEAT 65 RESUME_TASK 68 RETURN 63 SELECT_TASK 69 sequence control 58 START_TASK 69 STOP_TASK 69 UNLOAD 69 WAIT_FOR 178, 179 WAIT_UNTIL 179 WHILE 65 Stop on reject system message 77, 223 STOP_TASK statement 69 Strobe activating 81, 229 Strobe lighting 189 Structured lighting 189 Sub-pixel grayscale edges line finder 251, 257 point finder 255 with ruler record 271 System access levels 29 System vs. prototype parameters Systems dual-vision 21 125 T Task described 54 pausing 68 resuming 68 starting 48, 69 STOPPING 69 Task control panel 48 Tasks selecting 69 Test a value tutorial 110, 112 Test running inspections 79 Testable values list of 108 Test-a-value class records 93 Testing values 110–118 Threshold defined 185 example 185 setting 81 Tool resource 19 Tree vision 27 Tree, statement 45 Typing cursor 22 U UNLOAD statement 69 Unloading modules 69 User accounts adding 30 editing 30 Users adding 30 Using prototypes 128 Utilities backup and restore 215 file manager 212 module 17 V Value combination records Variable database 69 Variable resource 19 VisionWare User’s Guide, Rev. A 155, 230–231 295 Index Vision frame 140 Vision frames and frame class tools 140 full 141 translational only 141 Vision graphics displaying all 166 Vision resource 19 Vision results displaying 167 displaying graphics 166 Vision results file 171 Vision tools making relative 147 relative placement 140 Vision tree 27–28 Vision window menu bar options 206 VisionWare installing 192 using with MotionWare 8 with a motion device 3 VisionWare initialization databases Vison record creating 25 VWAUTO.V2 198 VWINI.DB 197 197 W WAIT_FOR 178 WAIT_UNTIL 179 Walk thru training 50 WHILE 65 Window features 9 Window records 278–279 and pixel counting 118 Window stats 113–118 Windows 9 closing 10 opening 9 selecting 10 sizing 10 296 VisionWare User’s Guide, Rev. A Adept User’s Manual Comment Form We have provided this form to allow you to make comments about this manual, to point out any mistakes you may find, or to offer suggestions about information you want to see added to the manual. We review and revise user’s manuals on a regular basis, and any comments or feedback you send us will be given serious consideration. Thank you for your input. NAME_______________________________________________ DATE_________________________ COMPANY _________________________________________________________________________ ADDRESS___________________________________________________________________________ PHONE_____________________________________________________________________________ MANUAL TITLE: ____________________________________________________________________ PART NUMBER and REV level:________________________________________________________ COMMENTS: ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ ______________________________________________________________________________________ MAIL TO: Adept Technology, Inc. Technical Publications Dept. 150 Rose Orchard Way San Jose, CA 95134 FAX: (408) 432-8707 VisionWare User’s Guide, Rev. A 00713-00230, Rev. A