TP programming
You can start programming with the EYE+ plugin on the IPendant touch through TP program. A TP program is a .TP
file
containing robot instructions (registers and I/O manipulation, apply robot displacements, call other programs ..) that
can be directly started from the IPendant touch. This is the normal way of programming Fanuc robots if you don’t have
ROBOGUIDE.
To call a plugin command from a TP program, you must use the CALL
command and select the program through
[INST] > CALL > CALL program > COLLECT > KAREL Progs
.
The following 7 commands are programs allowing to create a simple and easy to integrate pick and place.
EYE_CONFIGURE
EYE_STOP
EYE_START_PRODUCTION
EYE_GET_PART
EYE_PREPARE_PART
EYE_RAW_COMMAND
EYE_CHECK_LAST_ERROR
Robots instructions provided in TP programs targets basic implementations. If you need to do more advanced programming with your robot or with EYE+ (e.g. multi-feeding..), you will have to start programming in KAREL.
Warning
Programs that starts with IPL_ASYRIL_EYE_ are used internally to manage the communication with your EYE+ and must not be called in your programs.
Important
The camera configuration and hand-eye calibration must be done from the EYE+ Studio interface before executing any commands. If you do not know how to proceed, please refer to the Camera configuration wizard and Hand-eye calibration wizard sections.
Note
String arguments in TP program are limited to 34 characters. Some EYE+ commands required more than 34 characters (e.g. multi-feeding commands). If you encounter this kind of situation, you should program your request using Karel program directly.
EYE_CONFIGURE(client1, client2, ip_address = ‘192.168.0.50’, port_number = 7171)
Parameters
client1 - is the number of the first client reserved for the communication. The parameter must be an integer in the range of 1-8 and different from client2.
client2 - is the number of the second client reserved for the communication. The parameter must be an integer in the range of 1-8 and different from client1.
ip_address - (optional) is the IP address of your EYE+. The parameter must be a string with the IP address format
x.x.x.x
. If not set, the default IP address is used:192.168.0.50
.port_number - (optional) is the port number of your EYE+. The parameter must be an integer. If not set, the default port number is used:
7171
.Warning
If you want to specify the parameter port_number, you must also specify the parameter ip_address. If you don’t, you may have unexpected issues.
Description
This command must be called at least once to specify the clients used by the communication.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using IP address 192.168.0.52 and port number 7171
3: CALL EYE_CONFIGURE(1,2,'192.168.0.52',7171)
4: CALL EYE_CHECK_LAST_ERROR
5: IF (R[21]<>0) THEN
6: ! Not well configured
7: ENDIF
[End]
EYE_START_PRODUCTION(recipe_id)
Parameters
recipe_id - the recipe’s unique identifier. The parameter must be an integer between 1 and 65535.
Description
This command must be called to start EYE+ in production state using the right recipe.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4:
5: ! Start EYE+ in production state
6: CALL EYE_START_PRODUCTION(43099)
7: CALL EYE_CHECK_LAST_ERROR
8: IF (R[21]=0) THEN
9: ! EYE+ is in production
10: ENDIF
11:
12: ! Stop the EYE+ production state
13: CALL EYE_STOP('production')
[End]
EYE_STOP(state)
Parameters
state - is an EYE+ states. The parameter must be a string.
Description
This command is used to stop an EYE+ state and stop the communication on both clients. You must always end your
program with an EYE_STOP('production')
.
Warning
If you miss the call at the end of your program, you will need to do a fnct > ABORT (ALL)
with the
IPendant touch to stop the communication when starting another program.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4:
5: ! Stop all EYE+ state
6: CALL EYE_STOP('recipe_edition')
7: CALL EYE_STOP('camera_configuration')
8: CALL EYE_STOP('handeye_calibration')
9: CALL EYE_STOP('production')
10:
11: ! Start EYE+ in production state
12: CALL EYE_START_PRODUCTION(43099)
13: ! ...
14:
15: CALL EYE_STOP('production')
16: CALL EYE_CHECK_LAST_ERROR
17: IF (R[21]=0) THEN
18: ! EYE+ is in ready state
19: ENDIF
[End]
EYE_GET_PART
Returns
The returned part is stored in the reserved position register PR[20]
. Refer to table
Table 1 for more information.
Only the X, Y and R components are overwritten in the specified position register. You have to add the other components (Z, W, P) yourself according to your robot setup. These missing components can be assigned by hand or by using the assignment operator in your program.
Warning
If you do not assign the last components, the position will not be reachable by your robot.
Description
This command is used to request one part from EYE+. This is a blocking command, meaning it will keep going until it gets a response from EYE+.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4:
5: ! Start EYE+ in production state
6: CALL EYE_START_PRODUCTION(43099)
7:
8: ! Assign the other components of the part position to be reachable
9: PR[20, 3] = 15
10: PR[20, 4] = (-180)
11: PR[20, 5] = 0
12:
13: ! Get coordinates of one part
14: CALL EYE_GET_PART
15: CALL EYE_CHECK_LAST_ERROR
16: IF (R[21]=0) THEN
17: ! EYE+ found a part
18: ENDIF
19:
20: ! Stop the EYE+ production state
21: CALL EYE_STOP('production') ;
[End]
EYE_PREPARE_PART
Description
This command is used to request one part from EYE+. This command is not a blocking command. The part coordinates can be retrieved later with the EYE_GET_PART command.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4:
5: ! Start EYE+ in production state
6: CALL EYE_START_PRODUCTION(43099)
7:
8: ! Assign the other components of the part position to be reachable
9: PR[20, 3] = 15
10: PR[20, 4] = (-180)
11: PR[20, 5] = 0
12:
13: ! Prepare one part
14: CALL EYE_PREPARE_PART
15:
16: ! ...
17:
18: ! Get coordinates of one part
19: CALL EYE_GET_PART
20: CALL EYE_CHECK_LAST_ERROR
21: IF (R[21]=0) THEN
22: ! EYE+ found a part
23: ENDIF
24:
25: ! Stop the EYE+ production state
26: CALL EYE_STOP('production') ;
[End]
EYE_RAW_COMMAND(cmd, client = 1)
Parameters
cmd - is the raw command to send to EYE+. This parameter must be a string.
client - (optional) is the client number that will be used to send the command. The parameter must be an integer whose value is equal to 1 or 2. If no parameter is specified as input, the default client used is the 1.
Note
Client 1 is the first client you entered in the EYE_CONFIGURE command and client 2 is the second client you entered.
Returns
The raw response of the command is stored in the reserved string register SR[20]
. Refer to table
Table 1 for more information.
Description
This function is used to send raw commands to EYE+. Refer to chapter Commands to know what kind of commands can be sent.
Note
String arguments in TP program are limited to 34 characters. Some EYE+ commands required more than 34 characters (e.g. multi-feeding commands). If you encounter this kind of situation, you should program your request using Karel program directly.
Warning
If you send the command EYE_RAW_COMMAND('set_parameter part_quantity 2')
, the
EYE_GET_PART command will provide only the first part coordinates in
the position register. However, if you use a EYE_RAW_COMMAND('get_part')
command, the string response will
contain all the part coordinates.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4:
5: ! Start EYE+ in production state
6: CALL EYE_RAW_COMMAND('start production 12345')
7: IF (SR[20]='200') THEN
8: ! EYE+ is in production
9: ENDIF
10:
11: ! Stop the EYE+ production state
12: CALL EYE_STOP('production')
[End]
EYE_CHECK_LAST_ERROR
Returns
The last error detected is stored in the reserved register R[21]
. Refer to table
Table 1 for more information.
Description
This function is used to check if an error has occurred.
If no error has occurred, the output is equal to 0.
If an EYE+ error has occurred, the output is equal to one of the error codes listed in Error codes (error type
4xx
or5xx
).If a plugin error has occurred, the output is one of the following errors displayed in section Plugin errors (error type
6xx
).
Once the error is returned as output from the function, the error is cleared internally (value set to 0).
Note
A good practice is to use this function just after each plugin command. This way, you will be able to know on which command the last error occurred.
Usage example
1: ! Configure the communication using client C1: and C2:
2: ! using default IP address and port number
3: CALL EYE_CONFIGURE(1,2)
4: CALL EYE_CHECK_LAST_ERROR
5: IF (R[21]<>0) THEN
6: ! An error occured while configured the clients
7: ABORT
8: ENDIF
9:
10: ! Get coordinates of one part
11: CALL EYE_GET_PART
12: CALL EYE_CHECK_LAST_ERROR
13: IF (R[21]=403) THEN
14: ! Production subsystem has not been started
15: ENDIF
16:
17: CALL EYE_CHECK_LAST_ERROR
18: IF (R[21]=0) THEN
19: ! Now the error is cleared
20: ENDIF
21:
22: ! Stop the EYE+ production state
23: CALL EYE_STOP('production')
24: CALL EYE_CHECK_LAST_ERROR
25: IF (R[21]<>0) THEN
26: ! An error occured while stopping the production
27: ABORT
28: ENDIF
[End]