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

From 3D scanning Knowledge base - Photoneo wiki
Jump to: navigation, search
Line 5: Line 5:
 
== 2. UR Controller setup ==
 
== 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.  
+
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 Solution 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. 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 [[http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/turn-on-power/ tutorials]] on Zacobria robot community forum for UR robots prior to installing Photoneo UR interface.     
+
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 [[http://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/turn-on-power/ tutorials]] on the Zacobria robot community forum for UR robots prior to installing the Photoneo UR interface.     
  
 
=== 2.1 Network configuration ===
 
=== 2.1 Network configuration ===
  
As a first step we configure network interface. Click '''Setup Robot''' -> '''Network''' to open robot's configuration:
+
The first step is to configure the network interface. Click '''Setup Robot''' -> '''Network''' to open the configuration window:
  
  
Line 17: Line 17:
  
  
Following configuration pane should appear. Select static address network method and configure IP settings to meet your network requirements. Apply when finished.
+
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.
  
  
Line 25: Line 25:
 
== 3. Install Photoneo program ==
 
== 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:
+
The next step is to copy UR scripts from the Photoneo UR USB stick to the robot controller. It is possible to perform this operation via Ethernet or using the USB stick directly. In this tutorial both options will be covered:
  
 
=== 3.1 Copy files from USB stick ===
 
=== 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''':
+
Insert the USB stick into the slot on the back of the pendant. On the Main Robot screen, select '''Program Robot''' -> '''Load Program''':
  
  
Line 35: Line 35:
  
  
You should see robot's filesystem pane. Select '''USB''' -> '''Photoneo''' and choose '''main_module.urp'''
+
You should see the robot filesystem pane. Select '''USB''' -> '''Photoneo''' and choose '''main_module.urp'''
  
  
 
[[File:Photoneo main module load 90.png]]
 
[[File:Photoneo main module load 90.png]]
  
Click on '''File''' -> '''Save as''' for saving to robot controller
+
Click on '''File''' -> '''Save as''' to save scripts to the robot controller
  
 
Repeat the same sequence for '''calibration.urp'''
 
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.''
+
''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 ===
 
=== 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:
+
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''
 
''$ scp -r Photoneo root@XXX.XXX.XXX.XXX:/programs/Photoneo''
  
Default password is '''"easybot"'''
+
The default password is '''"easybot"'''
  
 
=== 3.3 Creating new program ===
 
=== 3.3 Creating new program ===
  
On the Main Menu screen select '''Empty Robot'''. Following screen should appear:
+
On the Main Menu screen select '''Empty Robot'''. The following screen should appear:
  
  
Line 62: Line 62:
  
  
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'''.  
+
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 following screen with empty Robot Program and BeforeStart programs now:
+
You should see the following screen with empty '''Robot Program''' and '''BeforeStart''' programs now:
  
  
Line 70: Line 70:
  
  
Copy scripts from ''Photoneo/scripts'' to '''BeforeStart''' sequence using following steps:
+
Copy the scripts from ''Photoneo/scripts'' to the '''BeforeStart''' sequence using the following steps:
  
1. Click BeforeStart na lavej liste
+
1. Click BeforeStart on the left panel
  
 
2. Select '''Structure''' in the Main Window
 
2. Select '''Structure''' in the Main Window
Line 84: Line 84:
  
  
5. Select '''Command''' tab in the Main Window
+
5. Select the '''Command''' tab in the Main Window
  
6. Choose '''File''' and '''Edit''' as shown by the figure below:
+
6. Choose '''File''' and '''Edit''' as shown in the picture below:
  
  
Line 92: Line 92:
  
  
8. Click '''Open''' and select ''photoneo_common.script'' from Photoneo/script folder:
+
8. Click '''Open''' and select ''photoneo_common.script'' from the Photoneo/script folder:
  
  
Line 104: Line 104:
  
  
If script was properly loaded, it should be visible under '''BeforeStart''' program as shown by the figure below:  
+
If the script has been properly loaded, it should now be visible under the '''BeforeStart''' program as shown in the picture below:  
  
  
Line 110: Line 110:
  
  
Repeat the same sequence for '''customer_definitions.script''' to reach following state:
+
Repeat the same sequence for '''customer_definitions.script'''. The pane should now look as follows:
  
  
Line 116: Line 116:
  
  
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.
+
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 ==
 
== 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:     
+
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''' - 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 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 an application specific settings such as gripper commands, motion speed, precision and overall bin picking sequence definition.  
+
- '''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 ===
 
=== 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.   
+
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_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.   
Line 155: Line 155:
 
=== 4.2 UR CONFIG ===
 
=== 4.2 UR CONFIG ===
  
'''customer_definitions.script''' enables user to configure several bin picking settings, including gripper command implementations, trajectory speed and precision.  
+
'''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   
 
- '''open_gripper()'''  - implement function for opening your gripper here   
Line 214: Line 214:
 
=== 4.4 MAIN PROGRAM ===
 
=== 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 - '''main_module.urp'''  and '''calibration.urp'''.     
+
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'''.     
 
   
 
   
 
==== 4.4.1 main_module.urp ====
 
==== 4.4.1 main_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.
+
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.
  
  
Line 226: Line 226:
 
==== 4.4.2 calibration.urp ====
 
==== 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.
+
'''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.
  
 
[[File: loaded_calibration.png]]
 
[[File: loaded_calibration.png]]
Line 233: Line 233:
 
== 5. Runtime ==
 
== 5. Runtime ==
  
Make sure that Bin Picking application on Vision Controller side is running and waiting for the connection:
+
Check that the Bin Picking application is running on the Vision Controller side and is waiting for the connection:
  
  
Line 239: Line 239:
  
  
Load '''main_module.urp''' program and click '''Play''' button
+
Load '''main_module.urp''' program and click '''Play'''
  
  
Line 245: Line 245:
  
  
Move manipulator to Start Position first. Use '''Auto''' or '''Manual''' button. When Start Position is reached, confirm by clicking on '''OK button'''.
+
Move the manipulator to the Start Position. Select either'''Auto''' or '''Manual'''. When the Start Position is reached, confirm by clicking '''OK'''.
  
  
Line 251: Line 251:
  
  
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.  
+
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.  
  
  
Line 257: Line 257:
  
  
You should see notification that connection between UR robot controller and Vision Controller has been successfully established:
+
You should see a notification that a connection between UR robot controller and Vision Controller has been successfully established:
  
  
Line 263: Line 263:
  
  
At this point robot should start sending requests to Vision Controller and execute bin picking movements
+
At this point the robot should start sending requests to the Vision Controller and execute bin picking movements

Revision as of 18:05, 29 March 2018

1. Prerequisities

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


Ur start 2.png


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.


Network setup.png


3. Install Photoneo program

The next step is to copy UR scripts from the Photoneo UR USB stick to the robot controller. It is possible to perform this operation 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:


Program robot.png


You should see the robot filesystem pane. Select USB -> Photoneo and choose main_module.urp


Photoneo main module load 90.png

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:


Empty program.png


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:


Before start.png


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


Add script.png


5. Select the Command tab in the Main Window

6. Choose File and Edit as shown in the picture below:


Empty script.png


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


Edit script.png


10. Hit Save and Exit:


Photoneo common load ver2.png


If the script has been properly loaded, it should now be visible under the BeforeStart program as shown in the picture below:


Photoneo common loaded ver2.png


Repeat the same sequence for customer_definitions.script. The pane should now look as follows:


Customer definitions loaded ver2.png


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

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.

4.4.1 main_module.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.


Loaded program.png


4.4.2 calibration.urp

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.

Loaded calibration.png


5. Runtime

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


Play.png


Move the manipulator to the Start Position. Select eitherAuto or Manual. When the Start Position is reached, confirm by clicking OK.


Start position.png


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.


Runtime.png


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