Plugin functions

You can start programming with the EYE+ plugin on your PBX or directly through RCX studio.

Important

The camera configuration and the hand-eye configuration must be done from the EYE+ studio before programming any commands. For further information, please refer to the Camera configuration wizard and Hand-eye calibration wizard.

To call a plugin command from your program, you must use the CALL command.

Warning

Do not use the following functions in your program:

  • EYE_READBUFFER1

  • EYE_READBUFFER2

  • EYE_INTERNAL_RAW1

  • EYE_INTERNAL_RAW2

  • EYE_TIMER

  • EYE_CHECK_IP

  • EYE_FIND

  • EYE_RAISE_ERROR

  • EYE_COORDINATES

  • EYE_SET_TIMEOUT

  • EYE_GET_TIMEOUT

  • EYE_CLEAR_BUFFER1

  • EYE_CLEAR_BUFFER2

These functions are used internally to manage the communication with your EYE+.

The following 7 commands are basic functions allowing to create a simple and easy to integrate pick and place.

  • EYE_CONFIGURE

  • EYE_START_PRODUCTION

  • EYE_STOP

  • EYE_GET_PART

  • EYE_PREPARE_PART

  • EYE_RAW_COMMAND

  • EYE_CHECK_LAST_ERROR

EYE_CONFIGURE(ipAdress$, port%, robotType%, pointNumber%)

Parameters

  • ipAdress$ - is the IP address of your EYE+. The parameter must be a string with the IP address format x.x.x.x.

  • port% - is the port number of your EYE+. The parameter must be an integer.

  • robotType% - is your robot type. The parameter must be an integer

    • robotType% = 1 for SCARA robot,

    • robotType% = 2 for 6-axis robot.

  • pointNumber% - is the point number where coordinates of the part will be written. The parameter must be an integer between 0 and 9999.

    ../_images/point_definition.png

    Fig. 5 Point definition if pointNumber% = 664

Description

This command must be called at the beginning of your program. This command is used to:

  • Define GP6 and GP7 clients in General Ethernet Port.

  • Initializes the point where coordinates of the part will be written.

Note

If you do not configured the clients correctly, you will get the following error 602 - Client configuration error and the communication between your robot and your EYE+ will not start.

Warning

If you are already using the GP6 and GP7 clients, please contact our support team.

Usage example

1 ' Set clients configuration to 192.168.0.50:7171 for a SCARA robot
2 ' and define the point P664 for the part coordinates
3 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
4 CALL *EYE_CHECK_LAST_ERROR
5 IF EYELastErr% = 602 THEN
6   HALT  'ERROR
7 ENDIF

EYE_START_PRODUCTION(recipeID%)

Parameters

  • recipeID% - 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 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
2 CALL *EYE_START_PRODUCTION(12345)
3 CALL *EYE_CHECK_LAST_ERROR
4 IF EYELastErr% = 0 THEN
5   ' EYE+ is in production
6 ENDIF
7 CALL *EYE_STOP("production")

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.

Usage example

 1 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
 2 CALL *EYE_STOP("recipe_edition")
 3 CALL *EYE_STOP("camera_configuration")
 4 CALL *EYE_STOP("handeye_calibration")
 5 CALL *EYE_STOP("production")
 6 '
 7 CALL *EYE_START_PRODUCTION(12345)
 8 '...
 9 '
10 CALL *EYE_STOP("production")
11 CALL *EYE_CHECK_LAST_ERROR
12 IF EYELastErr% = 0 THEN
13   ' EYE+ is in ready state'
14 ENDIF

EYE_GET_PART

Returns

The returned part is stored in the point variable Pxxxx where xxxx is the point number you haven chosen while calling the command EYE_CONFIGURE.

Only the components for X axis (A1), for Y axis (A2) and for RZ angle (A4 or A6) are overwritten in the position Pxxxx. You have to define the other components of the point yourself according to your robot setup. These missing components can be assigned by hand or by using the assignment operator LOCx in your program.

Note

If in EYE_CONFIGURE you have chosen a SCARA robot, the robot position is only defined with the following components: A1, A2, A3, A4.

And if you have chosen a 6-axis robot, the robot position is only defined with the following components: A1, A2, A3, A4, A5, A6.

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 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
 2 CALL *EYE_START_PRODUCTION(12345)
 3 '
 4 ' Assign the other components of the part position to be reachable (6-axis robot in use)
 5 ' Assign Z position
 6 LOC3(P664) = 15.000
 7 ' Assign RX position
 8 LOC4(P664) = -180.000
 9 ' Assign RY position
10 LOC5(P664) = 0.000
11 '
12 CALL *EYE_GET_PART
13 CALL *EYE_CHECK_LAST_ERROR
14 IF EYELastErr% = 0 THEN
15   ' Move to position
16   MOVE P,P664
17 ENDIF
18 CALL *EYE_STOP("production")

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 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
 2 CALL *EYE_START_PRODUCTION(12345)
 3 '
 4 ' Assign the other components of the part position to be reachable (6-axis robot in use)
 5 ' Assign z position
 6 LOC3(P664) = 15.000
 7 ' Assign rx position
 8 LOC4(P664) = -180.000
 9 ' Assign ry position
10 LOC5(P664) = 0.000
11 '
12 CALL *EYE_PREPARE_PART
13 '
14 ' ...
15 '
16 CALL *EYE_GET_PART
17 CALL *EYE_CHECK_LAST_ERROR
18 IF EYELastErr% = 0 THEN
19   ' Move to position
20   MOVE P,P664
21 ENDIF
22 CALL *EYE_STOP("production")

EYE_RAW_COMMAND(command$, socket%)

Parameters

  • command$ - is the raw command to send to EYE+. This parameter must be a string.

  • socket% - is the socket number that will be used to send the command. The parameter must be an integer whose value is equal to 1 or 2.

Note

Socket 1 is related to the first client GP6 defined by the command EYE_CONFIGURE and socket 2 to the second client GP7.

Returns

The raw response of the command is stored in the global variable EYERawRes$.

Description

This function is used to send raw commands to EYE+. Refer to chapter Commands to know what kind of commands can be sent.

Warning

If you send the command EYE_RAW_COMMAND("set_parameter part_quantity 2", 1), the EYE_GET_PART command will provide only the first part coordinates in the point Pxxxx. However, if you use a EYE_RAW_COMMAND("get_part", 1) command, the string response will contain all the part coordinates.

Usage example

1 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
2 CALL *EYE_RAW_COMMAND("start production 12345", 1)
3 IF EYERawRes = "200" THEN
4   ' EYE+ is in production
5 ENDIF
6 CALL *EYE_STOP("production")

EYE_CHECK_LAST_ERROR

Returns

The last error detected is stored in the variable EYELastErr%.

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 or 5xx).

  • 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).

Usage example

 1 CALL *EYE_CONFIGURE("192.168.0.50", 7171, 1, 664)
 2 CALL *EYE_GET_PART
 3 CALL *EYE_CHECK_LAST_ERROR
 4 IF EYELastErr% = 403 THEN
 5   'Production subsystem has not been started
 6 ENDIF
 7 CALL *EYE_CHECK_LAST_ERROR
 8 IF EYELastErr% = 0 THEN
 9   'Now the error is cleared
10 ENDIF
11 CALL *EYE_STOP("production")