Plugin functions

You can start programming with the EYE+ plugin on MotoSim or Teach Pendant. For this you need to create your own JOB program.

To call a plugin function in your program, you must use the CALL JOB: command as follows:

CALL JOB:EYE_START_PRODUCTION ARGF 32439

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

  • EYE_CONFIGURE.JBI

  • EYE_START_PRODUCTION.JBI

  • EYE_PREPARE_PART.JBI

  • EYE_GET_PART.JBI

  • EYE_STOP.JBI

  • EYE_RAW_COMMAND.JBI

  • EYE_CHECK_LAST_ERROR.JBI

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(IpAddress, Port, StartingPoint)

Parameters

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

  • StartingPoint - is the starting point of the memory area reserved by the plugin. The parameter must be an integer. Make sure that they do not overlap with variables already used in your program.

    Note

    Refer to section Reserved memory for more details on the range.

Description

This command must always be called at the beginning of your program to define the client configuration and to define the starting point of the reserved memory zone.

Warning

If you have not configured the clients correctly, you will get the following error 602 - Client configuration error and the client configurations will not be changed.

Usage example

' EYE+ configuration is 192.168.0.50:7171
' Reserved memory area from 300 to 600 maximum
CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
'
CALL JOB:EYE_CHECK_LAST_ERROR
GETS LI000 $RV
IFTHEN LI000<>0
  ' Error
ENDIF
'
' ...

EYE_START_PRODUCTION(RecipeId)

Parameters

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

Description

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

Usage example

CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
CALL JOB:EYE_START_PRODUCTION ARGF 65447
'
CALL JOB:EYE_CHECK_LAST_ERROR
GETS LI000 $RV
IFTHEN LI000=0
  ' EYE+ is in production
ENDIF
'
' ...

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

CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
CALL JOB:EYE_START_PRODUCTION ARGF 65447
'
' ...
'
CALL JOB:EYE_STOP ARGF "production"

EYE_GET_PART

Returns

The returned part is stored in the point P[StartPoint].

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

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.

Important

You must initialize the output position at least once before using the EYE_GET_PART command. To do this you need to go to the output position configured as P[StartPoint] in the Yaskawa position variables and change the following information:

  • Section 1: Select either BASE, ROBOT or UTIL. The choice depends on your application. Your choice must match the robot frame you have defined for your pick and place.

  • Section 2: You must initialize the position elements Z, Rx, Ry.

  • Section 3: You must select the correct tool to use for your pick and place application.

../_images/EYEPos_initialization.png

Fig. 7 Initialize P[StartPoint]

Usage example

CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
CALL JOB:EYE_START_PRODUCTION ARGF 65447
CALL JOB:EYE_GET_PART
'
CALL JOB:EYE_CHECK_LAST_ERROR
GETS LI000 $RV
IFTHEN LI000=0
  SETE P300 (3) xxx ' (Value Z)
  SETE P300 (4) xxx ' (Value Rx)
  SETE P300 (5) xxx ' (Value Ry)
  MOVL P300 V=75.0
ENDIF
'
' ...

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

CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
CALL JOB:EYE_START_PRODUCTION ARGF 65447
'
' Assign the other components of the part position to be reachable
SETE P300 (3) xxx '(Value Z)
SETE P300 (4) xxx '(Value Rx)
SETE P300 (5) xxx '(Value Ry)
'
CALL JOB:EYE_PREPARE_PART
'
' ...
'
CALL JOB:EYE_GET_PART
CALL JOB:EYE_CHECK_LAST_ERROR
GETS LI000 $RV
IFTHEN LI000=0
  ' Move to part position
  MOVL P300 V=75.0
ENDIF
'
' ...

EYE_RAW_COMMAND(Client)

Parameters

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

Returns

The raw response of the command is stored in a reserved byte memory area.

Note

Refer to Table 1 for the reserved memory area for client 1 and refer to Table 2 for the reserved memory area for client 2.

Description

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

First, the send memory area must be filled in with the following command:

JOB:GSI_MAKEBARRAY ARGF LI000 ARGF LI001 ARGF 0 ARGF LS000
  • LI000 is a local integer that specify the position in memory where length of the data to send is stored. It can have two values:

    • LI000 = StartingPoint when using client 1,

    • LI000 = StartingPoint + 150 when using client 2.

  • LI001 is a local integer that specify the position in memory of the first byte to send. It can have two values:

    • LI001 = StartingPoint + 1 when using client 1,

    • LI001 = StartingPoint + 151 when using client 2.

  • LS000 is a local string containing the data to send.

The raw command to send is stored in a reserved byte memory area.

Note

Refer to Table 1 for the reserved memory area for client 1 and refer to Table 2 for the reserved memory area for client 2.

Warning

The length of the message can be up to 64 characters.

Table 1 Memory area for data sent and received by client 1: from StartingPoint to StartingPoint + 149

Byte position

Variable type

Description

StartingPoint + 0

BYTE

Size of data send on client 1

StartingPoint + 1

BYTE

First byte of the data to send on client 1

BYTES

StartingPoint + 65

BYTE

Last byte of the data to send on client 1

StartingPoint + 66

BYTE

Size of data received on client 1

StartingPoint + 67

BYTE

First byte of the data received on client 1

BYTES

StartingPoint + 130

BYTE

Last byte of the data to received on client 1

StartingPoint + 131

BYTE

Memory reserved for internal use..

BYTE

Memory reserved for internal use..

StartingPoint + 149

BYTE

Memory reserved for internal use..

Table 2 Memory area for data sent and received by client 2: from StartingPoint + 150 to StartingPoint + 300

Byte position

Variable type

Description

StartingPoint + 150

BYTE

Size of data to send on client 2

StartingPoint + 151

BYTE

First byte of the data to send on client 2

BYTES

StartingPoint + 215

BYTE

Last byte of the data to send on client 2

StartingPoint + 216

BYTE

Size of data received on client 2

StartingPoint + 217

BYTE

First byte of the data received on client 2

BYTE

StartingPoint + 280

BYTE

Last byte of the data to received on client 2

StartingPoint + 281

BYTE

Memory reserved for internal use..

BYTES

Memory reserved for internal use..

StartingPoint + 300

BYTE

Memory reserved for internal use..

Usage example

' Configure EYE+ and set StartingPoint = 300
CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
'
SET LI000 300 ' = StartingPoint + 0 (Position in memory containing the size of data to send on client 1)
SET LI001 301 ' = StartingPoint + 1 (Beginning of the memory area containing the data to send on client 1)
SET LS000 "start production 65447"
CALL JOB:GSI_MAKEBARRAY ARGF LI000 ARGF LI001 ARGF 0 ARGF LS000
CALL JOB:EYE_RAW_COMMAND ARGF 1

' Get EYE_RAW_COMMAND response code
SET LI002 367 ' = StartingPoint + 67 (Beginning of the memory area for data received on client 1)
CHR$ LS000 B[LI002] ' Get first caracter to string
INC LI002
CHR$ LS002 B[LI002] ' Get second caracter to string
CAT$ LS003 LS000 LS002
INC LI002
CHR$ LS000 B[LI002] ' Get third caracter to string
CAT$ LS003 LS003 LS000
'
'
IFTHEN LS003="200"
  ' SUCCEED
ENDIF

EYE_CHECK_LAST_ERROR

Returns

The last detected error is returned with $RV. The returned value is an integer.

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

CALL JOB:EYE_CONFIGURE ARGF "192.168.0.50" ARGF 7171 ARGF 300
CALL JOB:EYE_START_PRODUCTION ARGF 65447
'
CALL JOB:EYE_CHECK_LAST_ERROR
GETS LI000 $RV
IFTHEN LI000<>0
    ' ...
ENDIF
'
' ...