124406 2D VISION-GUIDED ROBOTICS ROBOT CONNECTION MANUAL FANUC CORPORATION EDITION This manual provides support for the necessary robot-side settings that must be configured to establish connections and communication between the XG/CV-X/XG-X Series and a robot. 1 Startup Flow Items to Prepare 2 Connecting to Robots Setup Procedure 3 Robot Communication Settings Connecting to Robots 4 Robot Communication Program 5 Robot Communication Settings Program (Only during Setting) 6 Robot Communication Settings (Only during Operation) 7 Troubleshooting Settings Writing the Communication Running the Communication Sample Program ■Operation confirmed robot controllers: R-30iB, R-30iB Plus, R-30iB Mate, R-30iB Mate Plus (For the latest information, contact a KEYENCE sales representative.) ■ Language used: TP Program ■ Communication method: Ethernet English Japanese(日本語) Simplified Chinese(简体中文) ・ Secondary damages (such as equipment damage, opportunity loss, and lost profit) and any and all other damages arising from the settings and programs introduced in this manual are not covered by the warranty. ・ You have to separately create robot movement programs such as those used during actual operations. ・ Proper nouns such as product names included in this manual are trademarks or registered trademarks of their respective companies. Note that the TM and ® marks are not written in this manual. ・ The contents of this manual may be changed without notice in the interest of improving the manual. Introduction Symbols Items to Prepare The following symbols are used in this manual to enable you to recognize important information at a glance. Be sure to read this section carefully. The items to prepare before connecting the XG/CV-X/XG-X Series controller (hereinafter referred to as "vision controller" in this manual) to the robot controller are listed below. DANGER Indicates a hazardous situation which, if avoided, will result in death or serious injury. WARNING Indicates a hazardous situation which, if not avoided, could result in death or serious injury. CAUTION Indicates a hazardous situation which, if not avoided, could result in minor or moderate injury. NOTICE Important Point Reference not Indicates a situation which, if not avoided, could result in product damage as well as property damage. Indicates precautions and limitations that must be followed during operation. Indicates operation. additional information on proper Indicates tips for better understanding or useful information. Indicates items and pages in this manual to be referenced. □ User Socket Messaging (R648) Non-free, robot-side option that is required for connecting to the vision controller * You do not need a development environment such as ROBOGUIDE. □ Ethernet cable Connects the vision controller and the robot controller USB memory device Used to copy the robot program for communication About Coordinate Systems The following differences exist between how the robot coordinate systems are expressed on the vision controller and on robots made by FANUC CORPORATION. vision controller Work coordinates Tool coordinates Robot User coordinates Tool coordinates Vision-Guided Robotics Setup Flow This manual explains step "2. Robot Communication Settings." For all other steps, see the "Vision-Guided Robotics Easy Installation Guide." 1. XG/CV-X/XG-X Installation ↓ 2. Robot Communication Settings (explained in this manual) ↓ 3. Adding a Robot Vision Setting ↓ 4. Setting and Executing Calibration ↓ 5. Setting Robot Vision Tools and Operation Verification ↓ 6. Operation Preparation 2 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 1. Startup Flow 1-1 Performing advance preparation and configuring settings [Advance preparation (1)] Checking the robot operation (preparation without using an image device) 1. Robot preparation 1 Enable jog operation on the robot. (Create the user coordinates and tool coordinates to use.) Startup Flow 2. Program startup preparation Create and check the operation of the program that will be used to grip the target at the specified position and place the target at the specified position. * The opening and closing of the hand are also required, so the corresponding wiring and operation checks must also be performed. [Advance preparation (2)] Attaching the camera and lighting Attach the camera and wire the devices. [Advance preparation (3)] Checking the communication Carry out the work described starting in chapter 2 of this manual. [Image processing settings] Configure the image processing settings. Link and configure the settings of the camera and robot, and then verify the operations with the actual devices. • Image capturing and lighting settings, calibration, search settings, and master position registration 1-2 Checking operation using the sample program and creating the program for actual operation Start the sample program and check the operation. The following operations are written in the sample program. (1) Issue the trigger. → Receive the data. (2) Move to the target's position. Communication (command I/O) can be checked and movement to the acquired position can be checked by starting the program. (Caution: The arm moves in a straight line from the current position to the detected position.) However, the hand operations as well as the preceding and subsequent operations are not written in the program. Therefore, as shown below, when not using image processing it is necessary to add the sample program instructions to the job program or to add to the sample program those operations that it does not already include to create the program for operation. Move P1 (Move to standby position P1.) ↓ Apply a trigger to the camera. ↓ Write the output coordinates to P3. ↓ Move P2 (Move to above the target.) ↓ Move P3 (Lower to the height of the target.) ↓ Hand operation (Grip the target.) ↓ Move P4 (Move to above the pick position.) ↓ Move P5 (Move to above the place position.) ↓ Move P6 (Lower to the place position.) ↓ Hand operation (Release the target.) ↓ Move P7 (Move to above the place position.) ↓ Move P1 (Return to the standby position.) The difference in the robot program compared to when not using vision-guided robotics is the part written in red on the left. These details are written in the sample program. When changing the text of the sample program, specify items such as: • The preceding and subsequent operations. • The opening and closing operations of the hand. • The path when moving to the target's position. Specify these items to ensure the operations are appropriate for the device. - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 3 2. Connecting to Robots 2-1 Connecting to the vision controller by Ethernet Use an Ethernet cable to connect the LAN connectors of the vision controller and the robot controller. Reference 2 We recommend that you use a category 5e or higher STP cable. If you are using a direct connection (not a hub), we recommend that you use a crossover cable. The KEYENCE genuine cable is a 3m, STP type, crossover cable (OP-66843). 3. Robot Communication Settings Connecting to Robots Use the teach pendant to configure the robot controller's communication settings. 3-1 Configuring the Robot Ethernet Settings 1. Press the "Screen Selection" button on the teach pendant (the teaching control console). 2. On the menu that is displayed, select "MENU 1" - "SETUP," and then select "SETUP 2" - "Host Comm." 3. On the "SETUP Protocols" screen that is displayed, select "TCP/IP," and then press "F3: DETAIL." 4 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 4. Select "IP addr," "Subnet Mask," and "Router IP addr," press the "Input" button for each selection, and then enter the robot controller communication settings. 3 Point Ensure that the IP address is not the same as that of another device. Reference 5. 6. Set the IP address and subnet mask so that the robot controller is within the same network as the vision controller. If necessary, set the default gateway. Example) Subnet mask: 255.255.255.0 (default value) If the vision controller IP address is 192.168.0.10 Only the fourth octet of the IP address ("10" in the above example) can be changed to a value in the range of 1 to 254. Press the "Back" button on the teach pendant, press "F4: SHOW," and then select "Clients." On the screen that is displayed, select "C1:," and then press "F3: DETAIL." Ports other than C1 can also be used. See "6-3 Commmunication Command List". - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 5 Robot Communication Settings Setting example Port#1 IP addr: 192.168.0.1 Subnet Mask: 255.255.255.0 Router IP addr (default gateway): 0.0.0.0 7. Select "Protocol:," press "F4: CHOICE," and then select "SM." 7 8 9 3 Robot Communication Settings 8. Select "Startup State:," press "F4: CHOICE," and then select "DEFINE." 9. Select "Server IP/Hostname:," press the "Input" button, and then enter the vision controller IP address. "192.168.0.10" is the default value on the vision controller side. Unless otherwise necessary, configure the setting with this detail. Point Ensure that the IP address is not the same as that of another device. 10. Press "F2: ACTION," and then select "DEFINE." 11. Press the "Screen Selection" button on the teach pendant. Then, on the menu that is displayed, select "--NEXT--," "SYSTEM," and then select "Variables." 12. On the screen that is displayed, select "$HOSTC_CFG," and then press "F2: DETAIL." 6 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - Reference You can quickly move through the items by holding down the "Shift" button while you press the "↓" button. An item is named "$HOSTS_CFG," so be careful to avoid mistakenly selecting this item. 13. On the screen that is displayed, select "1 [1]," and then press "F2: DETAIL." 3 "8500" is the default value on the vision controller side. (There is no need to set "Delimiter" on the robot controller side. In the vision controller network settings, select "CR" (the default value).) Unless otherwise necessary, configure the setting with this detail. - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 7 Robot Communication Settings 14. Select "$SERVER PORT," press the "Input" button, and then enter the vision controller port number. 4. Writing the Communication Program Write the robot program “Robot Vision Setup Program” for communication with the vision controller to the robot controller. 4 Writing the Communication Program 1. Download the “Robot Vision Setup Program” for the relevant robot model from the "Vision-Guided Robotics User Support" page on the KEYENCE website, and then decompress the downloaded file. 2. Copy the decompressed files (such as the robot vision setup program "keyencerobotvisionsetup.pc") to the root directory (directly under the drive name) of a USB memory device. 3. Insert the USB memory device to which you have copied the robot vision setup program into the USB port of the teach pendant or robot controller. 4. Press the "Screen Selection" button on the teach pendant. Then, on the menu that is displayed, select "FILE," and then select "File." 5. On the screen that is displayed, press "F5: UTIL," select "Set Device," and then select "USB on TP (UT1:)" or "USB Disk(UD1:)." 6. On the screen that is displayed, press "F2: DIR," and then select "*.PC." 7. Select "keyencerobotvisionsetup," and then press "F3: LOAD." 8. Follow the same procedure to Write the remaining "*.pc" files. 8 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 5. Running the Communication Program (Only during Setting) During setting, run the communication robot program “Robot Vision Setup Program.” Be sure to run “Robot Vision Setup Program” before you perform operations on the robot vision setting. Point 5-1 Running “Robot Vision Setup Program” Run “Robot Vision Setup Program” automatically in Automatic mode. 1. Press the "Screen Selection" button on the teach pendant. Then, on the menu that is displayed, select "--NEXT--," "SYSTEM," and then select "Variables." 2. Select "$KAREL_ENB," press the "Input" button, and then enter "1." Reference You can quickly move through the items by holding down the "Shift" button while you press the "↓" button. 5 Press the "List" button on the teach pendant. 4. Press "F1: TYPE," and then select "KAREL Progs." 5. Select "KEYENCESETUP." - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - Running the Communication Program (Only during Setting) 3. 9 6. Set the robot controller's "mode switch" to "AUTO." 7. Set the teach pendant's "teaching control console enabled switch" to "OFF." 8. Press the "Start" button on the robot controller to run the program. 5-2 Recovering from Errors and Re-running the Program If an error occurs while “Robot Vision Setup Program” is running, the error or an alarm will be displayed on the robot's teach pendant. Continue operations after using the following method to recover from the error. 1. Eliminate the cause of the error or alarm. 2. Press the "Clear Alarm" button on the teach pendant. 3. Perform the above procedure again to run the program. 5-3 Checking Communication with the Vision Controller 5 [CV-X] Running the Communication Program (Only during Setting) 1. On the setting screen, click "Robot Connection Settings." The "Robot Connection Settings" screen is displayed. 2. In the "Robot Connection Settings" field, select the setting that matches the robot to connect to. 3. In the "CV-X Communication Setting" field, click "Network Settings." The "Network Settings" screen is displayed. 4. In the "IP Address Setting" field, change the CV-X controller communication settings. Specify an IP address that is different from the robot's IP address. For details on the setting items, see the CV-X Series user's manual. 5. Click "Check Connection" to check that it is possible to communicate with the robot over Ethernet. On the "Check Connection" screen, you can specify the robot's IP address and click "Ping" to check the connection status. 6. In the "Non-Procedural (Command/Result Output)" field, change the settings as necessary. Point Configure the settings as follows: "Delimiter: CR," "Set Trigger-command Response to CV-compatible Mode: clear the check box." 7. When enabling robot operations from the CV-X, click "Enable Robot Operation from CV-X" in the "Robot Operation Setting" field to select the check box. 8. Click "Check Robot Operation Validity" and check that a message asking you to check that "Robot Vision Setup Program" is running is displayed. If "Robot Vision Setup Program" is not running on the robot controller, you will not be able to "Check Robot Operation Validity." For details, contact your KEYENCE sales representative. 9. 10 Click "Close." - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - [XG-X] Configure the "Ethernet" settings in advance from "Global Settings" > "I/O Settings" to match the communication method to use in the connection. 1. From the "Global Settings" menu at the top of the setting mode screen, select "I/O Settings" > "Robot Connection Settings." The "Robot Connection Settings" screen is displayed. 2. In the "Robot Connection Settings" field, select the setting that matches the robot to connect to. If you select the "Limit Robot Connection" check box, the display of the "Manufacturer" field is fixed to the set manufacturer when you display the "Robot Connection Settings" screen by clicking the "Options" menu, pointing to "Robot Settings," and then clicking "Connection." 3. When enabling robot operations from the XG-X controller, click "Enable Robot Operation from XG-X" in the "Robot Operation Setting" field to select the check box. 4. Select "Check Robot Operation Validity" and check that a message asking you to check that "Robot Vision Setup Program" is running is displayed. 5. When the settings are finished, select "OK." 5 Running the Communication Program (Only during Setting) - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 11 6. Sample Program (Only during Operation) This chapter explains the communication commands that can be used with TP programs during operation. You can use communication commands to send commands directly from the robot controller to the vision controller. If you are controlling the vision controller from a PLC during setting and operation, do not use communication commands. During operation, "Robot Vision Setup Program (KEYENCESETUP)" will not be run, but this is required in order to use the communication commands. Point Reference * You do not need a development environment such as ROBOGUIDE in order to use the communication commands. 6-1 Sample Operation Program A sample operation program that runs measurement on the vision controller from the robot side, and then applies the data output from the vision controller to move the robot to the corresponding position is shown below. 6 Sample Program (Only during Operation) 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: [End] !Connect CALL KEY_CONNECT !Send a command CALL KEY_SEND_CMD('T1') !Wait and set reply to R10 CALL KEY_WAIT_CMD('T1',10) !Set received values to R20,21,.. CALL KEY_RECV_VAL(20) !Set position PR[1,1]=R[20] PR[1,2]=R[21] PR[1,3]=R[22] PR[1,4]=R[23] PR[1,5]=R[24] PR[1,6]=R[25] !Move J PR[1] 10% FINE !Close CALL KEY_CLOSE 6-2 Entering Communication Commands Use the teach pendant to configure the robot controller's communication settings. 1. Press the "List" button on the teach pendant (the teaching control console). 2. Use the cursor to select the program that you want to edit, and then press the "Input" button. 3. Move the cursor to the position where you want to enter the communication command, and then press "F1: INST." 4. On the menu that is displayed, select "CALL," and then select "CALL Program." 5. Press "F3: COLLECT," select "KAREL Progs," and then select "KEY_***," the program to use. 6. If necessary, enter the arguments. Move the cursor to the right of the program name, and then press "F4: CHOICE" to specify the argument type. 12 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 6-3 Communication Commands KEY_CONNECT Starts communication with the vision controller. Syntax CALL KEY_CONNECT or CALL KEY_CONNECT(a) Arguments Arguments Stored value a Tag of client to connect to (1 when omitted) CAUTION After KEY_CONNECT is executed, using it again without first executing KEY_CLOSE will result in an error. All commands other than KEY_CLOSE can be used after KEY_CONNECT is executed. KEY_CLOSE Ends communication with the vision controller. Syntax 6 CALL KEY_CLOSE or CALL KEY_CLOSE(a) Arguments Stored value a Tag of connected client (1 when omitted) Sample Program (Only during Operation) Arguments KEY_SET_IP Changes the IP address of the specified client. Syntax CALL KEY_SET_IP(a,’b’) Arguments Arguments a b Stored value Client tag to change the IP address IP address after change CAUTION Execute KEY_CONNECT after executing KEY_SET_IP. After KEY_CONNECT is executed, using KEY_SET_IP without first executing KEY_CLOSE will result in an error. KEYENCESETUP Starts the set-up program. Syntax CALL KEYENCESETUP or CALL KEYENCESETUP(a) Arguments Arguments a Stored value Tag of connected client (1 when omitted) CAUTION Use this command only during vision controller setting. Once executed, the program continues running until an error occurs. Stop the program manually. - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 13 KEY_SEND_CMD Sends a command to the vision controller. Syntax CALL KEY_SEND_CMD(‘a’,b1,b2…,b9) Arguments Arguments a Stored value Command name Command parameters (can be omitted depending on the command used) * Up to 126 characters of result output can be received. b1 to b9 KEY_WAIT_CMD Receives the command execution result from the vision controller. Syntax CALL KEY_WAIT_CMD(‘a’,b) Arguments Arguments a b Stored value Name of command executed with KEY_SEND_CMD Register index in which to store the command execution result Execution result Variable R[b] R[b+1] and higher Stored value Command execution result 0: Success Other than 0: Command error (for error details, see the user’s manual) Command return value (When there are multiple result outputs, they are stored in subsequent registers—R[b + 2], R[b + 3], ...) CAUTION Before using this command, you must execute KEY_SEND_CMD. KEY_RECV_VAL Receives the result output from the vision controller. Syntax CALL KEY_RECV_VAL(a) Arguments Arguments a Value Register index in which to store the result output Execution result Variable R[a] and higher Stored value Result output (When there are multiple result outputs, they are stored in subsequent registers—R[a + 1], R[a + 2], ...) CAUTION Before using this command, you must issue a trigger. 14 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - KEY_SET_EXT Gives the value of the current additional axis. Syntax CALL KEY_SET_EXT(a) Arguments Variable Stored value a Position register index to which the value of the additional axis is given * Only a position register in which axis values are stored can be specified. * This command can be used only when the type of the additional axis is Auxiliary. CAUTION Using this command to a position register in which Cartesian coordinates are stored will result in an error. The robot may move to an unexpected position if the type of the additional axis is Integrated. 6-4 Communication Command Usage Example For details on the commands, see the CV-X user's manual and the XG-X communication control manual. ◼ Switching program settings (PW) Use PW, the program setting switch command, to switch to program setting No. 24 in SD1. 6 Sample Program (Only during Operation) 1: 2: 3: 4: 5: 6: 7: 8: [End] !Connect CALL KEY_CONNECT !Send a command CALL KEY_SEND_CMD('PW',1,24) !Wait and set reply to R10 CALL KEY_WAIT_CMD('PW',10) !Close CALL KEY_CLOSE ◼ Updating the image capture position (CPW) 1: 2: 3: 4: 5: 6: 7: 8: [End] !Connect CALL KEY_CONNECT !Send a command CALL KEY_SEND_CMD('CPW',1,1.234,2.345,3.456,4.567,5.678,6.789) !Wait and set reply to R10 CALL KEY_WAIT_CMD('CPW',10) !Close CALL KEY_CLOSE 6-5 Output Setting Details Set the output on the CV-X as shown below. 6-6 About the Sample Program Precautions regarding using programs saved with the sample program creation function are listed below. Point Saved files cannot be used as-is on the robot controller. Open the file in a program such as a text editor to copy the required part. Do not delete the files writing during setting, from the robot controller. - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 15 7. Troubleshooting The error "Running-320 (KEYENCE SETUP, 207) Undefined" occurs when the setup program is run. The likely cause is that the UserSocketMsg R648 option has not been installed. You can use the teach pendant to check whether this option is present: "Screen Selection → STATUS → Software Version." If this option is not installed, you cannot perform Ethernet non-procedural communication with external devices. Contact your KEYENCE sales representative. Pings do not pass through. The IP address or port setting may be incorrect. Also check whether the Ethernet cable is inserted into the correct Ethernet port. On the R-30iB robot controller, there are three Ethernet ports in the location where "Ethernet" is indicated. However, the port where the cable should be inserted is the topmost one, which is indicated as "CD38A." A communication error occurs. Execute "KeyClose" once, and then execute the program again. The error "UOP is enabled" occurs. Clear the UOP assignment, or switch from "Remote" to "Local" under "System Settings" → "Remote/Local Setting" to clear the error. A robot equipped with an additional axis is used. 16 - 2D VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - Troubleshooting Calibration and jog operation are executed based on the current additional axis coordinates by setting the type of the additional axis is set to Auxiliary. 7 Revision History Date Version February 2015 May 2015 July 2015 April 2016 October 2017 March 2018 First edition 2nd edition 3rd edition 4th edition 5th edition Revised 1st edition Revised 2nd edition Revised 3rd edition Revised 4th edition March 2020 July 2020 March 2023 Revision details Support has been added for version 3.4. XG Series has been added. XG-X Series has been added. Text has been added and changed. Text has been added and changed. Support has been added for the path generation tool. Addition of dedicated command details. - VISION-GUIDED ROBOTICS, ROBOT CONNECTION MANUAL, FANUC CORPORATION EDITION - 17 C 2015 KEYENCE CORPORATION. All rights reserved. Copyright○ 124406GB 2033-4 124406