Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with KUKA robots

From 3D scanning Knowledge base - Photoneo wiki
Revision as of 08:55, 28 August 2018 by Durovsky (talk | contribs)

Jump to: navigation, search

NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.

1. Prerequisities

Photoneo KUKA Interface is compatible with KRC4 systems from v8.3.

In addition to compatible system version, the following conditions must also be met:

- Ethernet KRL Interface v.2.1 or higher installed

Switch to Expert Mode and browse to Menu -> Startup -> Additional Software to check if Ethernet KRL is available on robot controller:

KUKA Setting Up Guide Step 1.png


2. KUKA Controller setup

The following tutorial gives a step by step guide of how to configure your KUKA KRC4 controller and install all necessary files you will need to get the robot interface for Photoneo Binpicking Studio up and running.

This tutorial was originally written using the latest KRC4 system version 8.3, however it should be compatible with higher versions with minor changes.

2.1 Network configuration

Photoneo KUKA Module utilizes TCP/IP communication for transferring data between KRC4 Robot Controller and Vision Controller. As a first step in commissioning, ensure that IP address of KRC4 controller meets your network configuration requirements

Turn on the KRC4 Controller, wait for the Initialization Screen to appear, open the Menu screen' and select the Startup '-> Network Configuration option:


KUKA SettingUpGuideStep2.png


The Network Settings window should now appear. Adapt network configuration to meet your requirements:


KUKA SettingUpGuideStep3.png


KRC4 Control PC needs to be rebooted in order to apply new network configuration. Open the Menu Screen and select the Shutdown -> Reboot control PC option:


KUKA SettingUpGuide Restart.png


3. Photoneo KUKA Module Setup

The first step in the installation of Photoneo KUKA Module is to copy the files from Photoneo KUKA Module Archive which you received with Photoneo BP Studio to the Robot Controller.

The standard way how this can be performed on KUKA controller is to copy files directly from the USB stick using the Pendant.

The Photoneo KUKA Module consists of following files:

  • Photoneo Folder
  • - pho_state_server.src
  • - pho_common.src
  • - pho_motion.src
  • - pho_common.dat
  • - pho_motion.dat
  • Program Folder
  • - customer_definitions.src
  • - main_application.src
  • - main_application.dat
  • Photoneo EthernetKRL Config
  • - pho_bp_client.xml
  • - pho_state_server.xml



4. KRL

Photoneo KUKA interface was designed to be easily integrated into existing application written in KRL code. It provides two means which influence the final robot behavior:

- KRL API - set of KRL procedures used to control the bin picking sequence. Requests and related communication functions are defined in photoneo_common.src and used within main_app.src

- KRL CONFIG - customer_definitions.src enables user to configure application specific settings such as gripper commands, velocity, acceleration and approximation distances.

4.1 KRL API

The following API describes the functionality of requests provided by Photoneo KUKA Interface. These requests are intended for high level control of bin picking sequences and are usually called in main_app.src


PHO_ConnectToVC() - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established. If the server running on the Vision Controller side is not running or does not respond, an error is raised and the RAPID program is terminated.

PHO_RequestInit(start_pose:IN, end_pose:IN) - request to initialize bin picking application on the Vision Controller side. Start and End Poses defined by the operator on the pendant are transferred to the Vision Controller and used in the trajectory planning pipeline as start and terminus points.

PHO_RequestScan() - request to trigger the next scan and localization. Non-blocking request; the KRL program continues immediately at the next line.

PHO_WaitForScan() - function to wait for scan to be finished. This should be called after triggering the scan, but not immediately. Blocking request; the KRL program waits for response from Vision Controller.

PHO_RequestTrajectory() - request to start trajectory planning for current goal. Non-blocking function; the KRL program continues immediately at the next line.

PHO_ReceiveTrajectory() - function to receive requested bin picking trajectories (consisting of a sequence of trajectory and gripper operations). This is usually called inside PHO_PickObject() function by default. Blocking function; waits for motion data to be received.

PHO_RequestCalibAdd() - request to add calibration point - a scan is triggered and the calibration is recalculated. Blocking request; the program will not continue until the calibration result is recalculated and has been received by the Robot Controller.

PHO_RequestCalibSet() - request to set current calibration result to the PhoXi Scanner

PHO_RequestCalibReset() - request to reset current calibration and remove all previously added points

PHO_PickObject() - request to execute bin picking operation and perform motion execution. Blocking function; the program does not continue until the whole sequence is finished. Always make sure that the robot is in Start pose before calling this function.


4.2 KRL CONFIG

customer_definitions.src enables the user to configure several bin picking settings, including gripper command implementations, trajectory speed and approximation adjustments.


- PHO_GripperAttach() - implement function for opening your gripper here

- PHO_GripperDeattach() - implement function for closing your gripper here

- PHO_GripperUser_1() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_2() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_3() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_4() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_5() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_6() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_7() - implement custom user gripper command (reserved for future use)

- PHO_GripperUser_8() - implement custom user gripper command (reserved for future use)

- PHO_BinpickingSettings() - specify velocities, accelerations and approximation distances for bin picking trajectories (SPLINE segments). Adapt the number of trajectories to meet your Bin Picking Studio Setup. (by default 4 trajectories are used)


4.3 KRL ERROR HANDLING

Photoneo KUKA interface provides basic error handling. If an error occurs during bin picking operations, the PHO_OCCURED_ERR flag is set to true. The PHO_ERR_CODE variable contains the code of the specific error which will helps to identify the source of the problem.

PHO_NO_ERR := 0 - Service response from Vision Controller is valid

PHO_SERVICE_ERR := 1 - Service response from Vision Controller is invalid.

PHO_UNKNOWN_REQ := 2 - The Vision Controller received an unknown request.

PHO_COM_FAILURE := 3 - Communication failure due to socket closure.

PHO_BAD_DATA := 4 - Data validation check has failed.

PHO_TIMEOUT := 5 - Communication failure due to socket timeout.

PHO_UNKNOWN_ERR := 99 - Unspecified internal error

PHO_PLANNING_FAILED := 201 - Trajectory planning has failed

PHO_NO_PART_FOUND := 202 - No part has been localized

PHO_NOT_INITIALIZED := 203 - Bin picking application has not been properly initialized on Vision Controller

PHO_PART_LOST := 204 - Part has been lost during motion execution


4.4 MAIN MODULE

The following section provides a detailed explanation of MainModule.mod - the module through which the user's application and Photoneo Bin Picking API are integrated together.

NOTE: If you use a pre-generated program from Robot Studio simulation do not use MainModule.mod directly. The following description serves only as an example of how to use Photoneo RAPID API.

4.4.1 main()

The main() procedure is simply a selection of which particular sub-procedure is about to be executed. Comment bin picking if you want to execute calibration comment calibration line if you want to execute bin picking.


5. Runtime

Apply RAPID changes, restart the Robot Controller; if everything is set correctly, you should see the following info screen on the Pendant:


[[File: ]]


Make sure that your solution on the Deployment page of Binpicking Studio is running and Binpicking Status is in Waiting for a connection state as shown in the figure below:


[[File: ]]


Open Main Menu, browse to Production Window and Set PP to Main - at the beginning of the main function:


[[File: ]]


Choose if you want to run the application in AUTO or MANUAL mode and adopt the speed override if required:


[[File: ]]


Hit the Play button in AUTO mode or Enable + Play button in MANUAL mode and you should see the following application output:


[[File: ]]


You should notice that Binpicking Status has changed to the Connected state. It means that the Vision Controller has established a successful connection to the robot controller:


[[File: ]]


The robot should now start sending requests to the Vision Controller and execute bin picking movements.

NOTE: Ensure that you are ready to halt motion execution immediately. It is strongly recommended to reduce the speed to 10% of maximum during initial bin picking tests.