For connecting the Vision Sensor to the Robot Controller, follow the procedures below. 30 6.1. Connecting Vision Sensor to Robot Controller 1 * Omitted (Refer to the source code) Declare internal variables. 2 Execute the initialization function (fhdefglobal) for external variables.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (2)Initialaize global variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CALL fhdefglobal() Initialization function for external variables socket no = 0 _ err no = success _ cur local coord = 0 _ _ cur tool coord = 0 _ _ cmd res = 0 _ TYPE "Initialization Done." 3 Set the IP address and the port number of the Vision Sensor to the variables. (When changing those from the default.) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (1)Set the network configuration ; You have to configure the following communication settings.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $ip address = "10.5.5.100" IP address _ $port _no = "9876" Port number retries connect = 2 ;times _ timeout connect = 4 ;sec _ retries connect = 2 ;times _ timeout connect = 4 ;sec _ 4 Set the variables as arguments for the connection function (fhconnect) to the Vision Sensor (FH server) and execute it.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; (2)Connect to the FH server ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WHILE bconnected == 0 DO Connection function with the Vision Sensor (FH server) CALL fhconnect($ip address, $port no, retries connect, timeout connect, socket no, _ _ _ _ _ err no) _ ; Error check IF err no success THEN _ TYPE "ERROR: fhsample main(): Connection failed. Exit:", err no _ _ GOTO 11 END END TYPE "Connection Done."