Warning

You are reading the documentation for an older Pickit release (3.1). Documentation for the latest release (3.4) can be found here.

KUKA example picking program

This example program requires that Pickit is installed and set up with your robot. For installation instructions, please refer to the KUKA installation and setup article.

Attention

Before running the robot program for the first time, make sure that:

  • There exists a valid robot-camera calibration.

  • The Tool Center Point (TCP) has been correctly specified.

  • The robot speed is set to a low value, so unexpected behavior can be identified early enough to prevent the robot from colliding with people or the environment.

  • Pickit is in robot mode, which is enabled in the Pickit web interface.

Attention

The examples contained in the Pickit application files contain hard-coded robot poses that should be adapted to every new robot. When executing such programs for the first time, please do so in manual mode and at low speed to check for potential collisions.

Example program: PickitSimplePicking

This example program can be found in R1 > Program > Pickit.

Note

This example program only works with Pickit software version of 2.2 or greater. If you are using a software version prior 2.2, please contact us at support@pickit3d.com, and we will assist you in finding a solution.

DEF  PickitSimplePicking ( )
   ;FOLD INI;%{PE}
   ;FOLD USER INI

   PTP HOME

   IF NOT Pickit_is_running() THEN
       PickitMessages(#info, 1) ;Pickit not in ROBOT mode
       HALT
   ENDIF

   Pickit_configure(2,2)

   BAS(#TOOL,1) ; Tool for picking
   BAS(#BASE,0) ; Robot base

   PTP Detect
   WAIT SEC 0.0
   Pickit_detect_with_retr(5)
   WAIT FOR Pickit_get_results()

   LOOP
       IF Pickit_object_found() THEN
           ;Calculate pick points
           F_Pick=Pickit_get_pose()
           F_PrePick=F_Pick:{X 0.0,Y 0.0,Z -100.0,A 0.0,B 0.0,C 0.0}
           F_PostPick={X 0.0,Y 0.0,Z 100.0,A 0.0,B 0.0,C 0.0}:F_Pick

           ; Check if positions are reachable
           PickitAxistest=INVERSE(F_Pick,XAbovePickArea,Pickit_ErrStatCheckPos1)
           PickitAxistest=INVERSE(F_PrePick,XAbovePickArea,Pickit_ErrStatCheckPos2)
           PickitAxistest=INVERSE(F_PostPick,XAbovePickArea,Pickit_ErrStatCheckPos3)
           IF (Pickit_ErrStatCheckPos1==0) AND (Pickit_ErrStatCheckPos2==0) AND (Pickit_ErrStatCheckPos3==0) THEN
               PTP AbovePickArea
               LIN F_PrePick
               LIN F_Pick
               ;Add grasping logic
               LIN F_PostPick
               LIN AbovePickArea
               PTP Detect
               WAIT SEC 0.0
               Pickit_capture_image()
               Pickit_process_image()
               PTP Dropit
               ;Add release logic
               WAIT FOR Pickit_get_results()
                   IF NOT Pickit_object_found() THEN
                   ; Retry detecting if no object found during the first detection.
                       PTP Detect
                       WAIT SEC 0.0
                       Pickit_detect_with_retr(4)
                       WAIT FOR Pickit_get_results()
                   ENDIF
           ELSE
               PickitMessages(#info,2) ;Object not reachable requesting next object..
               Pickit_next_object()
               WAIT FOR Pickit_get_results()
           ENDIF
       ELSE
           IF Pickit_roi_empty() THEN
               PickitMessages(#info, 3) ;ROI is empty
               EXIT
           ELSE
               PickitMessages(#info, 4) ;No objects found
               Pickit_save_scene()
               EXIT
           ENDIF
       ENDIF
   ENDLOOP
END

The idea of the program is the following:

  • First, it is checked whether or not Pickit is in Robot mode.

  • If so, the robot moves to the detect pose and a detection is triggered, otherwise the robot program is halted.

  • If an object is found, it is checked if the pick, pre-pick and post-pick points are reachable for the robot.

  • If the object is reachable, the robot moves to the object to pick it. Afterwards, the robot moves to a fixed drop-off position, Dropit. As soon as the robot is out of the field of view of the camera, a new Pickit detection is triggered, so that the detection is processed at the same time as the robot moves, optimizing cycle time.

  • If the object is not reachable, the robot requests the next detected object.

  • If the ROI is empty, the program stops.

  • If no object is found, and the ROI is not empty, a snapshot is saved on the Pickit system and the robot program stops.

Note

Depending on which Pickit software version you are running, the example program can look different, even though the functionality is the same. We recommend to use the example program shipped with your Kuka connect version

Define the tool for picking

Create a tool with the actual TCP values. In this example #TOOL1 is used.

Set correct input arguments

The commands Pickit_configure and Pickit_detect_with_retr need input arguments. See Pickit communication functions for more information about these arguments.

Define fixed points

In this example program, 4 fixed points are used. These points need to be defined depending on the application.

  • Home: Where the robot will start the program.

  • Detect: Where to perform object detection from.

  • AbovePickArea: A point roughly above the pick area from which the above two can be reached without collision.

  • Dropit: Where to place objects.

Add grasping/releasing logic

At the F_Pick and Dropit points, grasping and releasing logic needs to be added, respectively.

Execute the picking program

Now you can run the program. Happy picking!