3.7.3. For Robots Manufactured by FANUC Corporation Connecting Vision Sensor to Robot Controller The following describes a program that connects the vision system to the robot controller. The following describes a program that switches the scene to a Camera Calibration AOS scene. Switching Scenes on the Vision Sensor 66 1 In Tag C1:, set the IP address of the vision system. Also, set the port number of the vision system. 2 Call the external variable initialization function (FHDEFGLOBAL) to initialize external variables. The external variables include variables for managing the communications status.
At the time of execution, be sure to call the external variable initialization function (FHDEFGLOBAL) to initialize them. 1: CALL FHDEFGLOBAL ; Initialization function for external variables 3 Set the local coordinate system number and the tool coordinate system number to 0. 2: UFRAME NUM=0 ; Local Coordinate System No. _ 3: UTOOL _NUM=0 ; Tool Coordinate System No 4 For Registers 196 and 197, set the number of retry times at connection and the timeout period (in seconds). For Registers 198 and 199, set the number of retry times at communications and the timeout period (in seconds). 5: R[196]=2 ; The number of retry times at server connection 6:
R[197]=10 ; The timeout period at server connection [sec.] 7: R[198]=2 ; The number of retry times at communications 8: R[199]=10 ; The timeout period at communications [sec.] 5 With the set register variables as arguments, call the connection function (FHCONNECT) to connect to the vision system (FH server). 10: CALL FHCONNECT('C1:',R[196],R[197]) ; Connection function with the 11: IF R[200] 0,JMP LBL[999] ; Vision Sensor (FH server) 1 Set the scene number of the Camera Calibration AOS as a variable. With the set variable as an argument, execute the scene switching function (FHSMPLCHGSN). Scene number 13: CALL FHSMPLCHGSN(R[198],R[199],127) ; Scene switching command 14:
IF R[200] 0,JMP LBL[998] ; execution sample function