Plugin functions

You can start programming with the EYE+ plugin on your Teach Pendant or directly through WorkVisual.

Important

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

The following 7 commands are basic 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

Warning

Do not use the functions that start with EYE_INTERNAL_. These functions are used internally to manage the communication with your EYE+.

EYE_CONFIGURE( socketFlag1:IN, socketFlag2:IN )

Parameters

  • (optional) socketFlag1 - is the flag number you have selected in your configuration file EYESocket1.xml. The parameter must be an integer in the range of 1-32.

  • (optional) socketFlag2 - is the flag number you have selected in your configuration file EYESocket2.xml. The parameter must be an integer in the range of 1-32 and must be different from socketFlag1.

Note

By default, socketFlag1 and socketFlag2 are equal to 21, 22 respectively.

Description

This command must always be called at the beginning of your program to define the client configuration.

Once you have chosen the socketFlag1 and socketFlag2, consider the following flags, inputs and timers as reserved for the proper behavior of the plugin.

  • $FLAG[socketFlag1] and $FLAG[socketFlag2]

  • $TIMER_FLAG[socketFlag1] and $TIMER_FLAG[socketFlag2]

  • $OUT[socketFlag1] and $OUT[socketFlag2]

Note

If you did not change the *.xml files configuration, you can call this function without parameters. Then consider the following flags, inputs and timers as reserved for the proper behavior of the plugin.

  • $FLAG[21] and $FLAG[22]

  • $TIMER_FLAG[21] and $TIMER_FLAG[22]

  • $OUT[21] and $OUT[22]

Usage example (with default parameters)

; Configure the communication with default parameters:
; $FLAG[21], $FLAG[22], $TIMER_FLAG[21], $TIMER_FLAG[22], $OUT[21], $OUT[22]
EYE_CONFIGURE()

; ...

Usage example (with defined parameters)

; Configure the communication with the reserved:
; $FLAG[1], $FLAG[2], $TIMER_FLAG[1], $TIMER_FLAG[2], $OUT[1], $OUT[2]
EYE_CONFIGURE( 1, 2 )

; ...

EYE_START_PRODUCTION( recipeID:IN )

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

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_START_PRODUCTION( 12345 )
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
   ; EYE+ is in production state
ENDIF

EYE_STOP( state:IN )

Parameters

  • state - is an EYE+ states. The parameter must be a string.

Description

This command is used to stop an EYE+ state. It must be called at the end of your program.

Usage example

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_START_PRODUCTION( 12345 )

; ...

EYE_STOP("production")
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
   ; EYE+ is not in production anymore
ENDIF

EYE_GET_PART

Return

The returned part is stored in the global position named EYEPos.

When a part is found, only the X, Y and C values are overwritten. You have to assign the other components (Z, A, B) yourself according to your robot setup.

Note

Most of the time, the value of B must be equal to 180° or 90° (tool facing down). You must then set C equal to (-C) to make the tool rotate in the correct orientation.

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.

Warning

If you do not assign the other components (Z, A, B), the position may not be reachable.

Usage example

; Initialize components A and B of EYEPos
EYEPos.A = 0
EYEPos.B = 90

; Move to home position
PTP XHOME

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_START_PRODUCTION( 12345 )

EYE_GET_PART()
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
  ; Move above the part regarding your current tool and robot base
  EYEPos.Z = 50
  EYEPos.C = -EYEPos.C
  LIN EYEPos Vel=2 m/s PMOTION Tool[1]:Flange Base[1]:Asycube ;%{PE}

  ; Move to the position regarding your current tool and robot base
  EYEPos.Z = 10
  LIN EYEPos Vel=2 m/s PMOTION Tool[1]:Flange Base[1]:Asycube ;%{PE}

  ; Move above the part
  LIN {Z 50}

  ; Move to home position
  PTP XHOME
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

; Initialize components A and B of EYEPos
EYEPos.A = 0
EYEPos.B = 90

; Move to home position
PTP XHOME

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_START_PRODUCTION( 12345 )

EYE_PREPARE_PART()

; Do something with your robot
; ...

EYE_GET_PART()
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
  ; Move above the part regarding your current tool and robot base
  EYEPos.Z = 50
  EYEPos.C = -EYEPos.C
  LIN EYEPos Vel=2 m/s PMOTION Tool[1]:Flange Base[1]:Asycube ;%{PE}

  ; Move to the position regarding your current tool and robot base
  EYEPos.Z = 10
  LIN EYEPos Vel=2 m/s PMOTION Tool[1]:Flange Base[1]:Asycube ;%{PE}

  ; Move above the part
  LIN {Z 50}

  ; Move to home position
  PTP XHOME
ENDIF

EYE_STOP("production")

EYE_RAW_COMMAND( command:IN, socketNumber:IN, response:OUT )

Parameters

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

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

  • response - is a parameter passed by reference that will contain the response string to the input command. The parameter must be a string.

Return

The raw response of the command is stored in the string response[].

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 position register. However, if you use a EYE_RAW_COMMAND('get_part', 1) command, the string response will contain all the part coordinates.

Usage example

CHAR response[254]

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_RAW_COMMAND( "start production 12345", 1, response[] )
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
   ; EYE+ is not in production
ENDIF

EYE_STOP("production")

EYE_CHECK_LAST_ERROR

Return

The last detected error is returned as direct output.

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

; Configure the communication
EYE_CONFIGURE()

; Start EYE+ in production using the correct recipe identifier
EYE_START_PRODUCTION( 12345 )
IF EYE_CHECK_LAST_ERROR() <> 0 THEN
   ; EYE+ is in production state
ENDIF