Difference between revisions of "Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with KUKA robots"

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search
Line 271: Line 271:
  
  
Open Main Menu, browse to '''Production Window''' and '''Set PP to Main''' - at the beginning of the main function:
+
Select the ''main_application.src'' from the R1/Program/ folder:
  
  
Line 277: Line 277:
  
  
Choose if you want to run the application in '''AUTO''' or '''MANUAL''' mode and adopt the speed override if required:
+
Choose if you want to run the application in '''T1''', '''T2''' or '''AUT''' mode and adopt the speed override if required:
  
  
Line 283: Line 283:
  
  
Hit the '''Play''' button in AUTO mode or '''Enable + Play''' button in MANUAL mode and you should see the following application output:
+
Start the program on the robot controller and you should see the program pointer starting to execute program lines:  
  
  
Line 289: Line 289:
  
  
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:
+
You should also 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:
  
  

Revision as of 08:01, 30 August 2018

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

1. Prerequisities

Photoneo KUKA module prerequisities:

  • - KRC4 system v.8.3 or higher
  • - Ethernet KRL Interface v.2.1 or higher installed

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


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 and KUKA AGILUS KR6 R900 sixx robot.

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

Switch to Expert Mode, open the Menu screen and select the Startup-> Network Configuration option:


KUKA SettingUpGuideStep2.png


Amend 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 the Photoneo KUKA Module Archive to the Robot Controller.

The Photoneo KUKA Module consists of following files:

  • Photoneo EthernetKRL Config Folder
  • - pho_bp_client.xml
  • - pho_state_server.xml
  • 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

3.1 Ethernet KRL config

Photoneo EthernetKRL Config folder contains two XML files - pho_state_server.xml and pho_bp_client.xml.

Copy these files from USB stick to C:\System\KRC\Roboter\Config\User\Common\EthernetKRL\ as shown in the figure below:


KUKA SettingUpGuideStep4 v3.png


XML files hold the configuration of EKI communication interface. The only entries that need to be changed are the IP address tags.

Enter the IP address of the Vision Controller to External IP tag in pho_bp_client.xml as shown in the figure below:


KUKA SettingUpGuideStep5 v2.png


Enter the IP address of the Robot Controller to Internal IP tag in pho_state_server.xml as shown in the figure below:


KUKA SettingUpGuideStep6.png


Save the changes and reboot control PC again to apply new EthernetKRL interface configuration.

Ports utilized by Photoneo KUKA Module:

  • - State Server Port: 54601
  • - Bin Picking Client Port: 54602

Flags occupied by EthernetKRL functions:

  • - $FLAG[100] - State Server Connection Alive
  • - $FLAG[101] - Bin Picking Connection Alive
  • - $FLAG[102] - Bin Picking Data Received

NOTE: Prevent using these flags and ports in the rest of your application!!!

3.2 Copy Photoneo & Program files

Photoneo folder contains internal files that should not be edited by user.

Copy the whole Photoneo folder from USB Stick to the R1 folder/ (Ignore compilation errors now, just copy files):


KUKA SettingUpGuideStep7 v2.png


It is highly recommended to hide Photoneo folder from Operator reach.

Switch to Expert Mode, and set the System flag in the Properties of Photoneo folder:


KUKA SettingUpGuideStep10.png


Program folder contains files which should be adapted by user in order to meet application requirements.

Do not replace the whole program folder, only copy three files from Photono_KUKA_Module archive to R1/Program Folder:


KUKA SettingUpGuideStep8 v2.png


NOTE: Compilation errors should disappear after copying all files to the robot controller.

3.3 State Server configuration

In order to get State Server up and running, it is necessary to edit Submit Interpreter program sps.sub in R1/System.

Switch to Expert Mode and deselect Submit interpreter program before doing any changes:


KUKA SettingUpGuideStep11.png


As shown in the figure below, add following two lines of code to the original sps.sub file.

PHO_StatePublisherInit() goes to the USER INI section while and PHO_PublishState() goes to the USER PLC section:


KUKA SettingUpGuideStep12 v2.png


State Server is necessary for calibration and visualization purposes. As soon as you restart Submit interpreter it should be up and waiting for connection from the Vision Controller.

As was mentioned above State Server occupies $FLAG[100] and listens on the port 54601.

3.4 Bin Picking Client Configuration

Bin Picking Client can be launched using main_application.src. The main application contains definitions of fixed robot poses, bin picking initialization and the main bin picking loop.

User is expected to reteach home, start, end & placing positions, before selecting this file for launch. See Section 4 for more info on main_application.src

As was mentioned above, Bin Picking Client occupies $FLAG[101] & FLAG[102]' and utilizes port 54602' to connect to bin picking server running on the Vision Controller.

NOTE: When PLC is used as a high level controller, the code from main_applications.src can be divided into separate programs and launched directly from cell.src.

4. KRL

Photoneo KUKA interface was designed to be easily integrated into existing application written in KRL code. KRL API and KRL Config should be used to adapt default bin picking template to the requirements of specific application.

- KRL API - is set of KRL procedures used to control the bin picking sequence. Bin Picking initialization, main loop and error handling are implemented here. Please keep the order of request calls as defined in basic template.

- 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_application.src


PHO_ConnectToVC() - function to establish a connection to the Vision Controller. Blocking function; suspends the program until a proper connection is established.

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 operations (consisting of a sequence of trajectories and gripper commands). Blocking function; waits for bin picking 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 not 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 execute motion. Always make sure that the robot is in Start pose before invoking 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 error_code global_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 source code of main_application.src - the basic template which demonstrates how the user's application and Photoneo Bin Picking API can be integrated together.


KUKA SettingUpGuideStep13.png


5. Runtime

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: ]]


Select the main_application.src from the R1/Program/ folder:


[[File: ]]


Choose if you want to run the application in T1, T2 or AUT mode and adopt the speed override if required:


[[File: ]]


Start the program on the robot controller and you should see the program pointer starting to execute program lines:


[[File: ]]


You should also 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.