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

From 3D scanning Knowledge base - Photoneo wiki
Revision as of 12:05, 28 March 2018 by Durovsky (talk | contribs)

Jump to: navigation, search

1. Prerequisities

Photoneo UR Interface is compatible with Universal robots versions 1.8 and higher.

2. UR Controller setup

Following tutorial gives a step by step guide how to configure your UR controller and install all necessary UR scripts to get the robot interface for Photoneo Binpicking Solution running.

This tutorial was originally written using the latest UR v.3.5.1, however it should be compatible with older versions with minor changes. It is assumed that a user has a basic knowledge of UR system and its configuration. In case you have never used this robot before, it is highly recommended to read basic [tutorials] on Zacobria robot community forum for UR robots prior to installing Photoneo UR interface.

2.1 Network configuration

As a first step we configure network interface. Click Setup Robot -> Network to open robot's configuration:


Ur start 2.png


Following configuration pane should appear. Select static address network method and configure IP settings to meet your network requirements. Apply when finished.


Network setup.png


3. Install Photoneo program

As a next step we need to copy UR scripts from Photoneo UR USB stick to the robot controller. It is possible to perform this operation via Ethernet or using USB stick directly. In this tutorial both options will be covered:

3.1 Copy files from USB stick

Insert USB stick to the slot on the back side of the pendant. On the Main Robot screen select Program Robot -> Load Program:


Program robot.png


You should see robot's filesystem pane. Select USB -> Photoneo and choose photoneo_module.urp


Photoneo main module load 90.png

Click on File -> Save as for saving to robot controller

Repeat the same sequence for calibration.urp

NOTE: If compatibility error occurs during program loading, it is recommended to create new program first. See section 3.3 for further information.

3.2 Copy files via Ethernet SCP

It is also possible to copy files to UR Controller using remote access directly from PC. Browse to the folder containing Photoneo UR scripts and copy the whole folder using following command:

$ scp -r Photoneo root@XXX.XXX.XXX.XXX:/programs/Photoneo

Default password is "easybot"

3.3 Creating new program

On the Main Menu screen select Empty Robot. Following screen should appear:


Empty program.png


Photoneo UR module consists of two main parts: BeforeStart and Robot Program. In order to enable BeforeStart Sequence it is necessary to check this option at the bottom of this pane.

You should see following screen with empty Robot Program and BeforeStart programs now:


Before start.png


Copy scripts from Photoneo/scripts to BeforeStart sequence using following steps:

1. Click BeforeStart na lavej liste

2. Select Structure in the Main Window

3. Choose Advanced tab

4. Select Script code


Add script.png


5. Select Command tab in the Main Window

6. Choose File and Edit as shown by the figure below:


Empty script.png


8. Click Open and select photoneo_common.script from Photoneo/script folder:


Edit script.png


10. Hit Save and Exit:


Photoneo common load ver2.png


If script was properly loaded, it should be visible under BeforeStart program as shown by the figure below:


Photoneo common loaded ver2.png


Repeat the same sequence for customer_definitions.script to reach following state:


Customer definitions loaded ver2.png


All files Photoneo UR interface files are now available within the system. You are ready to start editing the main robot program using Photoneo UR API.

4 Photoneo UR API

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

- UR API - set of UR requests (or procedures) used to control the bin picking sequence. Requests are defined in photoneo_common.script and used within photoneo_module.urp

- UR CONFIG - customer_definitions.script holds an application specific settings such as gripper commands, motion speed, precision and overall bin picking sequence definition.

4.1 UR API

Following API describes functionality of requests provided by Photoneo UR Interface. They are intended for high level control of bin picking sequence and usually called in photonoe_module.urp.


pho_request_init(pho_start_pose, pho_end_pose) - request to initialize bin picking application on the Vision Controller side. Start and End Pose defined by the operator on the UR side are transferred to the Vision Controller and used in the trajectory planning pipeline as a start and terminus points.

pho_wait_for_server() - function to establish connection to the Vision Controller. Blocking function, program does not continue until connection is established properly. If server running on Vision Controller side is not running or not responding, en error is raised and UR program is terminated.

pho_request_scan() - request to trigger next scan and localization. Non-blocking request, UR program continues immediately at next line

pho_wait_for_scan_completition() - function to wait for scan to be finished. Should be called after triggering the scan, but not immediately

pho_request_trajectory() - request to start trajectory planning for current goal. Non blocking function, UR program continues immediately at the next line

pho_receive_trajectory() - function to receive requested bin picking trajectory (consists sequence of trajectory and gripper operations). This is usually called inside pho_bin_picking() function by default. Blocking function - waits for motion data to be received.

pho_request_scan_and_traj() - function to trigger scan, localization and trajectory planning in a single shot. Blocking function, handy for initial bin picking experiments. For actual production it is more convenient to split this sequence into particular actions and call them accordingly (pho_request_scan & pho_request_trajectory).

pho_request_calib_add_point() - request to add calibration point - scan is triggered and calibration is recalculated. Blocking request, program does not continue until calibration result is recalculated and received by the robot controller.

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

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

pho_bin_picking() - request to execute bin picking operation. It usually receives requested trajectory and perform motion execution. Blocking function, program does not continue until the whole sequence is finished. Always make sure that robot is in pho_start_bin_picking_pose before calling this function.


4.2 UR CONFIG

customer_definitions.script enables user to configure several bin picking settings, including gripper command implementations, trajectory speed and precision.


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

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

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

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

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

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

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

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

- binpicking_settings() - specify speed and precision settings for bin picking trajectories. Adopt number of trajectories to meet your bin picking setup. (by default 4 trajectories are used)

- pho_bin_picking_simple() - the very basic bin picking sequence (for experimental purposes)

- pho_bin_picking() - standard bin picking sequence. It is flexible, operation based implementation which allows performing bin picking sequences, which consist of various numbers of operations. Do not edit !!!


4.3 ERROR HANDLING

Photoneo BP solution provides basic error handling. If an error occurs during bin picking operation PHO_OCCURED_ERR flag is set to true. PHO_ERR_CODE variable contains code of specific error, which 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_LONG_TRAJECTORY = 6 - Communication failure due to socket timeout.

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

PHO_COLLISION_DETECT = 205 - Collision has been detected

PHO_UNKNOWN_ERR = 299 - Unspecified internal error


4.4 MAIN PROGRAM

Following section provides detail explanation of two robot programs which must be adopted by user before running binpicking for the first time - photoneo_module.urp and calibration.urp.

4.4.1 photoneo_module.urp

This is a basic bin picking template. The main program loop is defined here. User is expected to reteach bin picking start and end positions, set IP Address and Port of Vision Controller and adopt placing part of the code to meet specific workcell and application requirements here.


Loaded program.png


4.4.2 calibration.urp

Reteach calibration positions and call pho_request_calib_add_point() request after reaching each calibration pose. It is recommended to run calibration in slow motion step by step to have a full control over the process. Always make sure that robot does not collide with the workcell during transitions between specific waypoints.

Loaded calibration.png


5. Runtime

Make sure that Bin Picking application on Vision Controller side is running and waiting for the connection:


[[File: ]] (Tu asi pride screenshot z webu)


Load photoneo_module.urp program and click Play button


Play.png


Move manipulator to Start Position first. Use Auto or Manual button. When Start Position is reached, confirm by clicking on OK button.


Start position.png


After Start Position has been confirmed click Play button again. Photoneo Module should start running now. If pho_wait_for_server() returns error, check connection and network configuration.


Runtime.png


You should see notification that connection between UR robot controller and Vision Controller has been successfully established:


[[File: ]] (Tu asi pride screenshot z webu)


At this point robot should start sending requests to Vision Controller and execute bin picking movements