Difference between revisions of "Bin Picking Tutorial: Setting up Photoneo Bin Picking Studio with UR robots"
(→4.3 UR ERROR HANDLING)
(→4.4 MAIN PROGRAM)
|Line 211:||Line 211:|
=== 4.4 MAIN PROGRAM ===
=== 4.4 MAIN PROGRAM ===
Following section provides detail explanation of '''photoneo_module.urp''' - a
Following section provides detail explanation of '''photoneo_module.urp''' - a where user's application and Photoneo Bin Picking API are integrated together.
. '''main '''is to bin picking to and .
==== 4.4.2 calibration.====
. is to the . .
Revision as of 13:17, 12 February 2018
- 1 1. Prerequisities
- 2 2. UR Controller setup
- 3 3. Install Photoneo program
- 4 4 Photoneo UR API
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:
Following configuration pane should appear. Select static address network method and configure IP settings to meet your network requirements. Apply when finished.
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:
You should see robot's filesystem pane. Select USB -> Photoneo and choose photoneo_module.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:
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:
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
5. Select Command tab in the Main Window
6. Choose File and Edit as shown by the figure below:
8. Click Open and select photoneo_script.script from Photoneo/script folder
10. Hit Save and Exit
If script was loaded successfully it should be visible under BeforeStart program as shown by the figure below:
Repeat the same sequence for customer_definitions.script to reach following state:
All files necessary for Photoneo UR interface should be available within the system. You are now 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_script.script and used within photoneo_module.urp
- RAPID 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 UR 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 photoneo_module.urp and calibration.urp - a program where user's application and Photoneo Bin Picking API are integrated together.
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.
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.