Warning

You are reading an old version of this documentation. If you want up-to-date information, please have a look at 2.0 .

Plugin functions

You can start programming with the EYE+ plugin on your FlexPendant or directly through RobotStudio.

Important

The camera configuration and the hand-eye calibration 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.

EYE_CONFIGURE(string ipAddress, num portNumber)

Parameters

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

  • portNumber - is the port number of your EYE+. The parameter must be a num.

Description

This command must be called at the beginning of each program that uses this system module. It is used to define the communication settings. It will also initialize default EYEPos coordinates.

Note

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

Usage example

! Set clients configuration to 192.168.0.50:7171
EYE_CONFIGURE "192.168.0.50", 7171;
IF EYE_CHECK_LAST_ERROR() = 602 THEN
  ! ERROR
ENDIF

EYE_START_PRODUCTION(num recipeId)

Parameters

  • recipeId - the recipe’s unique identifier. The parameter must be a num between 1 and 65535.

Description

This command must be called to start EYE+ in production state using the right recipe.

Usage example

EYE_CONFIGURE "192.168.0.50", 7171;
EYE_START_PRODUCTION 12345;
IF EYE_CHECK_LAST_ERROR() = 0 THEN
  ! EYE+ is in production
ENDIF

EYE_STOP "production"

EYE_STOP(string 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. You must always end your program with an EYE_STOP "production".

Usage example

EYE_CONFIGURE "192.168.0.50", 7171;
EYE_STOP "recipe_edition";
EYE_STOP "camera_configuration";
EYE_STOP "handeye_calibration";
EYE_STOP "production";

EYE_START_PRODUCTION 12345;
!...

EYE_STOP "production";
IF EYE_CHECK_LAST_ERROR() = 0 THEN
  ! EYE+ is in ready state
ENDIF

EYE_GET_PART

Returns

The returned part is stored in the robtarget variable EYEPos.

Only the components for EYEPos.trans.x axis, EYEPos.trans.y axis and EYEPos.rot orientation are overwritten in the position EYEPos. You have to define the other components yourself according to your robot setup.

Note

The orientation of the EYEPos position is by default equal to [1,0,0,0] in quaternion. This orientation means in Euler angle [0°,0°,0°]. If you need to set another orientation on this position, you must do it before calling the EYE_GET_PART command with the function OrientZYX(.,.,.). Once the orientation is assigned, it will be retained in x and y after each call to EYE_GET_PART, only the z orientation will be changed.

! Add static rotation in x orientation of 180°
EYEPos.rot := OrientZYX(0,0,180);

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

EYE_CONFIGURE "192.168.0.50", 7171;
EYE_START_PRODUCTION 12345;

! Assign the other components of the part position to be reachable
EYEPos.rot := OrientZYX(0,0,180);
EYEPos.trans.z := 243;

EYE_GET_PART;
IF EYE_CHECK_LAST_ERROR() = 0 THEN
  ! Move to position
  MoveL EYEPos, v50, z0, tool0;
ENDIF

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

EYE_CONFIGURE "192.168.0.50", 7171;
EYE_START_PRODUCTION 12345;

! Assign the other components of the part position to be reachable
EYEPos.rot := OrientZYX(0,0,180);
EYEPos.trans.z := 243;

EYE_PREPARE_PART;

! ...

EYE_GET_PART;
IF EYE_CHECK_LAST_ERROR() = 0 THEN
  ! Move to position
  MoveL EYEPos, v50, z0, tool0;
ENDIF

EYE_STOP "production";

EYE_RAW_COMMAND(string command, INOUT string response{*})

Parameters

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

  • response - is the raw response received from EYE+. This parameter must be an array of string. Each element of the array can contain 80 characters maximum.

    Note

    The array must contain at least one element.

    VAR string response{1};
    

Returns

The number of elements written in the response array. The output is a num.

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", response), the EYE_GET_PART command will still only return the coordinate of the first part in the point EYEPos. However, if you use a EYE_RAW_COMMAND("get_part", response) command, the string response will contain the coordinates of all the parts.

Usage example

VAR string response{1};
VAR num number_of_response := 0;

number_of_response := EYE_RAW_COMMAND("start production 12345", response);
IF response{1} = "200" THEN
  ! EYE+ is in production
ENDIF

EYE_STOP "production";

EYE_CHECK_LAST_ERROR()

Returns

The last error detected is returned as direct output. The output is a num.

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

EYE_CONFIGURE "192.168.0.50", 7171;
EYE_GET_PART;
if EYE_CHECK_LAST_ERROR() = 403 then
  ! Production subsystem has not been started
end if

if EYE_CHECK_LAST_ERROR() = 0 then
  ! Now the error is cleared
end if

EYE_STOP "production";