Sample program

Here we introduce an example of a program to perform a basic pick and place.

../_images/get_part.png

Fig. 10 Production scenario with get_part

It is necessary at this stage to have already performed the camera configuration, as well as the creation of a recipe with its hand-eye calibration.

Basic scenario - get_part

Initialization

1. Prepare the robot

  • Initialize robot frames and tools.

  • Initialize the robot gripper.

  • Move the robot out of the field of view.

2. Initialize the communication

Call the command EYE_CONFIGURE with the correct flag numbers.

3. Start EYE+ in production

Stop the current state of the EYE+ if needed and start the production with the desired recipe.

Cyclic part of robot program

4. Get the part coordinates

Call the command EYE_GET_PART to get the coordinates of the part to be picked. These coordinates will be stored in the variable EYEPos.

5. Check if no error occurs while requesting the part coordinates

Call the command EYE_CHECK_LAST_ERROR and check if it returns 0. If it does not, an error has occurred (e.g. a timeout).

6. Calculate position

Create the needed positions:

  • Pick position: EYEPos with the Z, A and B coordinates,

  • Pick position with Z offset: Define a Z-offset from the pick position to make sure not to hit anything when picking the part, whether it is the Asycube or another part.

../_images/pick_part_path.png

Fig. 11 Path to pick the part

7. Pick

Follow the path from OutOfView to EYEPosDZ to EYEPos and pick the part with your gripper.

8. Place

Follow the path from EYEPos to EYEPosDZ to OutOfView to PlacePos and place the part with your gripper.

Out of cyclic part

9. Stop EYE+ state

Stop the EYE+ production state by calling the command EYE_STOP.

Example of Kuka program

Here is an example of a simple pick and place program:

&ACCESS RVO
DEF sampleProgram ( )
   INT I

   MOVE_TO_INITIAL_POS()
   EYEPos.Z = 8

   EYE_CONFIGURE()
   IF EYE_CHECK_LAST_ERROR() <> 0 THEN
      ; error
      EXIT
   ENDIF

   EYE_START_PRODUCTION(12345)
   IF EYE_CHECK_LAST_ERROR() <> 0 THEN
      ; error
      EXIT
   ENDIF

   FOR I = 1 TO 20 STEP 1
      EYE_GET_PART()
      IF EYE_CHECK_LAST_ERROR() <> 0 THEN
         EYE_STOP("production")
         EXIT
      ELSE
         ; Open the gripper
         ; ...

         ; Move above the part
         EYEPos.Z = 8
         EYEPos.C = - EYEPos.C

         LIN EYEPos Vel=2 m/s PDEFAULT Tool[1]:Flange Base[1]:Asycube ;%{PE}

         ; Move on the part
         EYEPos.Z = -10

         LIN EYEPos Vel=2 m/s PDEFAULT Tool[1]:Flange Base[1]:Asycube ;%{PE}

         ; Move above the part
         EYEPos.Z = 8

         LIN EYEPos Vel=2 m/s PDEFAULT Tool[1]:Flange Base[1]:Asycube ;%{PE}

         ; Place the part
         PLACE_PART()

         ; Close the gripper
         ; ...

         ; Open the gripper
         ; ...
      ENDIF
   ENDFOR

   EYE_STOP("production")
   IF EYE_CHECK_LAST_ERROR() <> 0 THEN
      ; error
      EXIT
   ENDIF
END