Plugin variables

Some functions of the plugin use variables to store their output. Here is the list of variables used in the plugin:

Table 1 Plugin variables

Name

Description

Type

By default

EYEFrame

Store the frame used in hand-eye calibration

frame

{0,0,0,0,0,0}

EYEPos_Rx

Store the last EYE+ pick point position read for 6-axis robots

pointRx

{0,0,0,0,0,0}

EYEPos_Rs

Store the last EYE+ pick point position read for SCARA robots

pointRs

{0,0,0,0,0,0}

EYELastErr

Stores the last error found by E_CHECK_ERR

number

0

EYERawRes

Stores the last response found by E_RAW_COMMAND

string

“”

EYEFrame

EYEFrame is the father of the two position variables EYEPos_Rx / EYEPos_Rs and the father of this frame is the robot’s world[0] frame. By default, this frame is not initialized. You have to initialize it at least once by defining p0 (origin of the frame), pX (p0-pX defines the X direction of the frame) and pY (p0-pY defines the Y direction of the frame).

  • Method 1: Using the dedicated wizard for this on SP2 in the JOG/Frame section:

    ../_images/frame_create_wizard.png

    Fig. 11 Stäubli wizard to initialize a frame

  • Method 2: Or manually in your robot program using the command setFrame(p0, pX, pY, eye:Frame).

Warning

If you don’t set the EYEFrame correctly, it will remain equal to the world[0] frame, and as a result, your robot movement could damage your setup.

EYEPos_Rx / EYEPos_Rs

These variables store the last part coordinates received after sending a E_GET_PART. A position variable is defined as a structure containing a transformation and a configuration. The transformation takes the following form: {X,Y,0,0,RZ}.

  • The X and Y coordinates of the part stored in the variable are only valid in the robot frame you defined during the hand-eye calibration. These coordinates are also only valid with the tool you used during the hand-eye calibration. For this reason, make sure to link the position EYEPos_Rx or EYEPos_Rs to the right frame and tool in your program.

    Note

    Stäubli robots work in millimeters. Then make sure to enter millimeters value during the hand-eye calibration.

  • The Z coordinate is set to 0. You have to add an offset in the Z direction in the position to avoid hitting the plate of the Asycube when picking up a part.

  • RZ is the angle sent by EYE+ in degree.

    Note

    This RZ orientation is referenced to the Asycube frame you defined for the hand-eye calibration. Therefore, if the Z axis of your frame is oriented upwards and your robot’s tool is oriented downwards, you should use -RZ instead of RZ. See section RZ angle correction for more details.

The coordinates of the part found with E_GET_PART are written in either EYEPos_Rx or EYEPos_Rs depending on your robot type:

  • EYEPos_Rx for 6-axis robots

  • EYEPos_Rs for SCARA robots

Important

To set the robot type in the plugin, you must have called the E_CONFIGURE command at least once.

See below an example of an initialization program for pick and place.

Robot initialization program example

Listing 10 “init.pgx”
// vvvvvvvv Initialize robot settings vvvvvvvv

// Initialization of mdesc
mDesc.accel = 100
mDesc.vel = 100
mDesc.decel = 100
mDesc.rvel = 99999
mDesc.tvel = 99999
mDesc.leave = 10
mDesc.reach = 10

//Set Asycube frame manually (same used in hand-eye calibration)
pFrameO.trsf = {336.43, 121.32, -155.17, 180, 0, 0}
pFrameX.trsf = {335.16, -93.86, -155.51, 180, 0, 0}
pFrameY.trsf = {507.32, 120.04, -155.25, 180, 0, 0}
setFrame(pFrameO, pFrameX, pFrameY, eye:EYEFrame)

// Link tool with flange[0] based on your tool properties
tRobotTool.trsf.x = 5.38
tRobotTool.trsf.y = 0
tRobotTool.trsf.z = 48.76
tRobotTool.trsf.rx = 0
tRobotTool.trsf.ry = 15
tRobotTool.trsf.rz = 0

// Assign EYEPos_Rx remaining components
eye:EYEPos_Rx.trsf.z = 40
eye:EYEPos_Rx.trsf.rx = 180
eye:EYEPos_Rx.trsf.ry = 0
eye:EYEPos_Rx.trsf.rz = -eye:_Rx.trsf.rz
Listing 11 “start.pgx”
  call eye:E_RESET()
  call eye:E_CONFIGURE("192.168.0.50", 7171)

  call init()

  call eye:E_START_PROD(12345)
  call eye:E_GET_PART()
  call eye:E_CHECK_ERR()
  // if no error, move on the part
  if eye:EYELastErr == 0
    movel(eye:EYEPos_Rx, tRobotTool, mDesc)
  endIf

EYELastErr

This global variable is used to store the return value of the E_CHECK_ERR command. Once the error is returned as output from the function, the error is cleared internally (value set to 0).

EYERawRes

This global variable is used to store the return value of the E_RAW_COMMAND command. Each time a new response is received, the last response stored in the variable is deleted and replaced by the new one.