Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with UR robots
NOTE: Users are strongly recommended to read the general introduction to robot interfaces prior to installing specific robot modules.
- 1 1. Prerequisities
- 2 2. UR Controller setup
- 3 3. Install Photoneo program
- 4 4 Photoneo UR API
- 5 5. Runtime
Photoneo UR Interface is compatible with Universal robots versions 1.8 and higher.
2. UR Controller setup
The following tutorial provides a step by step guide to configure your UR controller and install all necessary UR scripts to get the robot interface for Photoneo Binpicking Studio up and 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. Users are assumed basic knowledge of the UR system and its configuration. If you have never used this robot before, it is strongly recommended that your read the basic [tutorials] on the Zacobria robot community forum for UR robots prior to installing the Photoneo UR interface.
2.1 Network configuration
The first step is to configure the network interface. Click Setup Robot -> Network to open the configuration window:
The following configuration pane should appear. Select the static address network method and configure the IP settings to meet your network requirements. Click Apply when finished.
3. Install Photoneo program
The next step is to copy UR scripts from the Photoneo UR Module archive to the robot controller. You should receive this archive (.zip) file as a part of Binpicking Studio. If you havn't received this file, please contact your supplier.
It is possible to copy files from Photoneo UR Module archive to robot controller via Ethernet or using the USB stick directly. In this tutorial both options will be covered:
3.1 Copy files from USB stick
Insert the USB stick into the slot on the back of the pendant. On the Main Robot screen, select Program Robot -> Load Program:
You should see the robot filesystem pane. Select USB -> Photoneo and choose main_module.urp
Click on File -> Save as to save scripts to the robot controller
Repeat the same sequence for calibration.urp
NOTE: If a compatibility error occurs during program loading, it is recommended to create a 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 the UR Controller using remote access directly from your PC. Browse to the folder containing Photoneo UR scripts and copy the whole folder using the following command:
$ scp -r Photoneo root@XXX.XXX.XXX.XXX:/programs/Photoneo
The default password is "easybot"
3.3 Creating new program
On the Main Menu screen select Empty Robot. The following screen should appear:
The 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 the following screen with empty Robot Program and BeforeStart programs now:
Copy the scripts from Photoneo/scripts to the BeforeStart sequence using the following steps:
1. Click BeforeStart on the left panel
2. Select Structure in the Main Window
3. Choose Advanced tab
4. Select Script code
5. Select the Command tab in the Main Window
6. Choose File and Edit as shown in the picture below:
8. Click Open and select photoneo_common.script from the Photoneo/script folder:
10. Hit Save and Exit:
If the script has been properly loaded, it should now be visible under the BeforeStart program as shown in the picture below:
Repeat the same sequence for customer_definitions.script. The pane should now look as follows:
All of the 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
The Photoneo UR interface was designed to be easily integrated into existing application written in ur script code. It provides users with two options for determining the final robot behavior:
- UR API - a 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 application specific settings such as gripper commands, motion speed, precision and overall bin picking sequence definition.
4.1 UR API
The following API describes the functionality of requests provided by Photoneo UR Interface. They are intended for high level control of the bin picking sequence and are usually called in main_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 the 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 Studip 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
The following section provides a detailed explanation of two robot programs which must be adopted by the user before running binpicking for the first time - main_module.urp and calibration.urp.
This is a basic bin picking template. The main program loop is defined here. The 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.
Reteach calibration positions and call pho_request_calib_add_point() request after reaching each calibration pose. Users are recommended to run calibration in slow motion step by step to maintain full control over the process. Users should always ensure that the robot does not collide with the workcell during transitions between specific waypoints.
Check that the Bin Picking application is running on the Vision Controller side and is waiting for the connection:
[[File: ]] (Tu asi pride screenshot z webu)
Load main_module.urp program and click Play
Move the manipulator to the Start Position. Select eitherAuto or Manual. When the Start Position is reached, confirm by clicking OK.
After the Start Position has been confirmed click Play again. The Photoneo Module should now start running. If pho_wait_for_server() returns error, check the connection and network configuration.
You should see a notification that a connection between UR robot controller and Vision Controller has been successfully established:
[[File: ]] (Tu asi pride screenshot z webu)
At this point the robot should 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.