Integration Guide Universal Robots
Note: It is strongly recommended to read the Robot communication overview prior to this integration guide.
Note 2: It is strongly recommended to use the latest version of the integration guide included in the latest available version of the robot module. To download the robot module, please visit the official Photoneo website.
Contents
1 Prerequisites
Prior to the setup, please ensure that your robot controller meets the following criteria:
E-series controller, software version 5.10 or higher
UR-series controller - software version support is yet to be determined based on future testing
CB-Series - not officially supported anymore
This version of the robot interface was developed and tested using Universal Robots E-Series v5.22 and v5.11.


2 Robot Controller Setup
This chapter describes the network configuration, robot module file transfer, TCP setup and State Server configuration required for the robot controller to communicate with Bin Picking Studio.
2.1 Network Configuration
The first step is to configure the IP address of the Robot Controller port used for communication with the Photoneo Vision Controller.

Note: Subnet mask 255.255.255.0 equals the 24-bit subnet mask representation. See this table for more combinations: https://dnsmadeeasy.com/support/subnet
An example of a matching network configuration on the Vision Controller side:
Vision Controller IPv4 Address: 192.168.1.1 / 24
Robot Controller IPv4 Address: 192.168.1.2 / 24 (as configured in the previous step)




For more details please see the Network page documentation.
2.2 Enabling Real-Time Data Exchange (RTDE)
The State Server functionality (calibration and robot visualization) requires the Real-Time Data Exchange (RTDE) service to be enabled and running on the robot side.

2.3 Loading of Robot Module Files
The Photoneo UR robot interface consists of 2 script files and several URP template programs:
photoneo_scripts
photoneo_common.script
customer_definitions.script
photoneo_examples
pho_main_basic.urp
pho_main_basic_hand_eye.urp
pho_main_basic_multi_vs.urp
pho_main_change_env.urp
pho_main_change_solution.urp
pho_main_get_object_pose.urp
pho_main_get_status.urp
pho_main_multiview_dynamic.urp
pho_main_multiview_static.urp
pho_main_reuse_scan.urp
pho_calibration_basic
pho_calibration_auto
pho_change_bounding_box.urp
Only URP programs need to be copied - the required scripts are already included in the URP templates!
There are two ways to copy the files to the robot controller:
USB flash drive
File transfer protocols such as SCP, FTP or SFTP
USB flash drive




File transfer protocol
It is possible to copy files to the UR Controller using remote access directly from a PC. Use WinSCP, FileZilla or another SFTP/FTP client. When creating the connection use the following configuration:
Protocol: SFTP
Host: Robot IP address
Port: 22
User: root
Password: easybot
Alternatively, when a command line interface is preferred, use the following scp command to copy files:
$ scp -r Photoneo root@XXX.XXX.XXX.XXX:/programs/BPS 1.12
The default password is “easybot”.
2.4 Tool TCP Setup
Warning: In hand-eye configurations, Bin Picking Studio temporarily overrides the active TCP pose during the Scan Regular request. Specifically, the robot sets its TCP to the tool flange pose for the duration of the scan request and then reverts to the previously active TCP.
Note: This behavior may lead to inconsistencies when calling get_actual_tcp from parallel threads. Developers should account for this temporary TCP override to avoid unexpected results in multi-threaded applications.

2.5 State Server
If the RTDE service on the UR robot is enabled, Bin Picking Studio connects to RTDE port 30004 and reads the current joint poses and Cartesian tool position from the Universal Robots controller. Joint poses are used for robot visualization purposes, while the Cartesian TCP data is essential for calibration as well as all hand-eye scan requests.

If the State client is connected to the robot, the current joint and tool data is being streamed from the robot to Bin Picking Studio at 125 Hz or 500 Hz. Visualization of the robot pose on the Environment page as well as calibration should now work correctly.

3 Robot Module
The Robot module is designed to be easily integrated into existing applications.
Note: It is strongly recommended to read the Photoneo robotic API and Action requests prior to this section.
3.1 Connection procedures
Note: This procedure establishes the connection to the Action Request Server running on the Vision Controller side at the beginning of the program. Requests can be sent only after a successful connection has been established. Defined in photoneo_common.script - do not edit!
Request |
Script definition |
Input |
Populates |
|---|---|---|---|
Connect to Action Request Server (Vision Controller) |
|
server_ipport (default 11003)max_attempt (default 1) |
|
3.2 Request List
This section describes available API calls provided by the Robot module. These procedures are intended for high-level control of the bin picking application.
Note: These procedures are defined in the photoneo_common.script API section and must not be edited!
Calibration requests
Request |
Script definition |
Input |
Populates |
|---|---|---|---|
Calibration Start |
|
solution_idvision_sys_id |
|
Calibration Add Point |
|
— |
|
Calibration Save |
|
— |
PHO_ERR_CODEpho_calib_acc - calibration accuracypho_camera_pose |
Calibration Stop |
|
— |
|
Bin picking requests
Request |
Script definition |
Input |
Populates |
|---|---|---|---|
Initialize |
|
pho_start_posepho_end_posevision_sys_id [optional, default 1]timeout [optional, default -1 - infinite] |
|
Scan Regular |
|
|
PHO_ERR_CODENote: The response is received by the Wait For Scan procedure.
|
Scan Meshing |
|
vision_sys_idtcp_pose [optional; when not provided, resolves to get_actual_tool_flange_pose()] |
|
Reuse Scan |
|
|
PHO_ERR_CODENote: Runs localization again on the last acquired scan without triggering a new scan.
|
Wait For Scan |
|
— |
|
Trajectory |
|
|
Note: The response is received by the Trajectory Receive procedure.
|
Trajectory Receive |
|
|
PHO_ERR_CODEpho_tool_point_invariancepho_gripping_point_idpho_gripping_point_invariancepho_dimension_x (non CAD)pho_dimension_y (non CAD)pho_dimension_rot (non CAD)pho_nn_label (AI Solutions)pho_max_z_height (Layer Solution)pho_tilt (Layer Solution) |
Get Object Cartesian Pose |
|
|
PHO_ERR_CODEpho_object_posepho_dimension_x (non CAD)pho_dimension_y (non CAD)pho_dimension_rot (non CAD)pho_nn_label (AI Solutions)pho_max_z_height (Layer Solutions)pho_tilt (Layer Solutions) |
Pick Failed |
|
|
|
Get Vision System Status |
|
|
PHO_ERR_CODEpho_num_localizedpho_num_readypho_process_state |
Change Bounding Box |
|
vision_sys_idbbox_id |
|
Change Environment Scene |
|
|
|
Solution requests
Request |
Script definition |
Input |
Populates |
|---|---|---|---|
Change Solution |
|
|
|
Start Solution |
|
|
|
Stop Solution |
|
— |
|
Get Running Solution |
|
— |
PHO_ERR_CODEpho_running_solution |
Get Available Solutions (Deprecated) |
|
— |
PHO_ERR_CODEpho_available_solutions |
Other requests
Request |
Script definition |
Input |
Populates |
|---|---|---|---|
Communication Check |
|
— |
|
3.3 Bin Picking procedures
Note: These procedures are defined in the customer_definitions.script API section. Do not edit the pho_bin_picking() function itself - only the gripper procedures should be edited by the user according to their requirements.
Bin picking procedure |
Description / Usage |
|---|---|
Execute bin picking routine
pho_bin_picking(pho_start_position = pho_start_pose,vision_sys_id = PHO_VISION_ID_DEFAULT) |
Description
Predefined procedure for the execution of the bin picking trajectory. This procedure must not be edited directly - to adapt the execution settings please read 3.4 Bin Picking movement parametrization.
Input parameters:
Note: To execute the bin picking trajectory, make sure the PATH PLANNING TYPE setting on the Bin Picking Studio Settings page is set to PLAN JOINT AND LINEAR TRAJECTORIES. Warning: When using multiple start poses (different for multiple vision systems) be extra careful to be in the correct one before executing this procedure. The start pose is an input parameter in case the robot was not in that pose already (it will move there before the execution of the bin picking routine). |
Gripper attach
gripper_attach() |
Description
A user-defined procedure. Typically it is the attach procedure used when the picked object is grasped in the Grasp waypoint.
Usage
It is automatically executed when the waypoint of the grasping method is configured to execute the Attach procedure when it is reached.
|
Gripper detach
gripper_detach() |
Description
A user-defined procedure. Typically it is the detach procedure used when the picked object is placed during the placing routine defined by the robot operator.
Usage
It is automatically executed when the waypoint of the grasping method is configured to execute the Detach procedure when it is reached.
Note: Typically this procedure is not configured to be executed automatically in a waypoint - it should be called during placing which is implemented by the robot operator. |
Gripper user-defined 1
gripper_user_1() |
Description
A user-defined procedure.
|
Gripper user-defined 2
gripper_user_2() |
Description
A user-defined procedure.
|
Gripper user-defined 3
gripper_user_3() |
Description
A user-defined procedure.
|
3.4 Bin Picking movement parametrization
Bin Picking Studio supports up to 10 trajectory segments per single bin picking trajectory. The default number of segments is 4; if needed, additional segments can be configured on the Grasping method page of the BPS solution.
Depending on the amount of joint waypoints in each trajectory segment, the pho_bin_picking() procedure switches between ServoJ and MoveJ based motion execution:
ServoJ: used when the trajectory segment has three or more points.
MoveJ: used when the trajectory segment has only two points (Path Planning off, too high linear sampling on short segments, etc).
In order to change individual segment speeds, change the appropriate value in the array. For example, to increase the “Start to Approach” segment speed for ServoJ execution, decrease the first index in the servo time array. On the other hand, to slow down the “Approach to Grasp” segment speed for MoveJ execution, decrease the second index of the pho_vel array.
Users can find three basic speed parameter sets (SLOW, MEDIUM and FAST) for the default ServoJ motion execution in customer_definitions.script. In order to specify the desired speed for individual trajectories, uncomment the relevant group of parameters. By default the MEDIUM parameter speed set is selected.
#-------------------------------------------------------------------------
#------------------- BIN PICKING SPEED SETTINGS --------------------------
#-------------------------------------------------------------------------
# If PATH PLANNING TYPE = PLAN JOINT AND LINEAR TRAJECTORIES then uncomment one of the groups of parameters
# slow
# pho_servo_time = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
# pho_lookahead_time = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
# pho_servo_gain = [120, 120, 120, 100, 100, 100, 100, 100, 100, 100]
# medium speed
pho_servo_time = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
pho_lookahead_time = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
pho_servo_gain = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
# fast speed
# pho_servo_time = [0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05, 0.05]
# pho_lookahead_time = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]
# pho_servo_gain = [75, 75, 75, 75, 75, 75, 75, 75, 75, 75]
# If PATH PLANNING TYPE = PATH PLANNING OFF then the following parameters control the movements
pho_acc = [1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4]
pho_vel = [2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0]
pho_time = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # if time is specified (pho_time > 0) pho_acc and pho_vel parameters are ignored
pho_blend = [0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02]
Warning: Exercise caution when enabling the blending option for the MoveJ instruction (PATH PLANNING OFF option). If a waypoint falls within the blending region of the preceding or following waypoint, the movement to this waypoint will not be executed. This can pose problems for precise waypoints, such as those required for grasping, where exact positioning is critical. If the MoveJ command used to reach the previous waypoint has a blending region that encompasses the next precise waypoint, the movement to this precise waypoint will be skipped. To avoid this issue, ensure that the blending region is always smaller than the distance between the waypoints.
3.5 Example Programs
There are several URP template programs available in the Photoneo UR module that demonstrate how to properly use the requests listed in 3.2 Request List for various use cases:
URP example |
Description |
|---|---|
pho_main_basic
pho_main_basic_hand_eye
|
This basic example demonstrates the basic workflow: it shows how to initialize the system, send a scan request, request a trajectory, receive the trajectory as joint waypoints, and execute the resulting motion path. The example also demonstrates error handling, as each function returns an error value assigned to Note: Ensure that the Start and End waypoints are configured in the |
pho_calibration_basic
pho_calibration_auto
|
The basic calibration examples. Requirements: Make sure RTDE is enabled - see 2.2 Enabling Real-Time Data Exchange (RTDE). Initial calibration of the Vision System must be started and confirmed manually by the user on the Bin Picking Studio side. Calibration steps
Important: The calibration object (either a ball or marker pattern) must remain in its original position to ensure successful automatic recalibration. |
pho_main_basic_multi_vs |
Same as pho_main_basic, but with switching between two Vision Systems. The |
pho_main_change_env |
Same as pho_main_basic but with switching between two environment states. It utilizes the |
pho_main_change_solution |
Same as pho_main_basic but with all solution-switching related requests. It shows how to activate different solutions using |
pho_main_get_object_pose |
Similar to pho_main_basic, but instead of requesting a trajectory, the robot retrieves the Cartesian pose of the object. This is useful for applications such as pick verification, slip sheet detection and basic picking tasks. Note: The system returns the raw Cartesian pose from localization. The origin is defined by the object’s STL file - no gripping points or invariance transformations are applied. The result is stored in |
pho_main_get_status |
Same as pho_main_basic, but with |
pho_main_multiview_static |
Static meshing example. This process demonstrates stitching multiple scans together before initiating localization, which is particularly useful for complex scenes or large objects. It uses a static approach, where the robot pauses at each scanning position to trigger and capture a scan. Requirements: State Server must be operational throughout the process; Procedure: the robot stops at each designated scanning location to trigger and capture a scan; after each scan, |
pho_main_multiview_dynamic |
Dynamic meshing example. This setup leverages Photoneo Instant Meshing technology together with the Parallel structured light technique provided by MotionCam-3D. Dynamic Meshing cannot be used with standard PhoXi 3D Scanners. Requirements: ![]() Procedure: capturing is initiated while the robot moves through predefined start/end waypoints (Motion Cam triggers scans at the |
pho_main_reuse_scan |
Same as pho_main_basic_multi_vs, but introduces the |
pho_change_bounding_box |
Same as pho_main_basic, but with switching between two bounding boxes. The |
3.6 Error handling
If an error occurs during the execution of the operation requested by the sent request the global variable informing about an error occurrence is set to true (PHO_OCCURED_ERR) and the error code is stored in the global variable PHO_ERR_CODE. It is recommended to implement adequate error handling for your particular application after each synchronous request and response receiving procedure.
Error codes together with their description and troubleshooting can be found here.
The most important error codes are defined as constants in the system module photoneo_common.script. These error codes are:
Error code |
UR Script constant |
|---|---|
No error (0) |
PHO_NO_ERROR = 0 |
Service error (1) |
PHO_SERVICE_ERR = 1 |
Communication error (3) |
PHO_COM_FAILURE = 3 |
Bad data (4) |
PHO_BAD_DATA = 4 |
Timeout (5) |
PHO_TIMEOUT = 5 |
Path planning failed (201) |
PHO_PLANNING_FAILED = 201 |
No object found (202) |
PHO_NO_PART_FOUND = 202 |
Vision system not initialized (203) |
PHO_NOT_INITIALIZED = 203 |
Empty scene (218) |
PHO_EMPTY_SCENE = 218 |
Wrong bin picking configuration (255) |
PHO_WRONG_BP_CONF = 255 |
Note: Example programs provide basic error handling.
4 Runtime
Once the solution is fully configured on the Vision Controller side, it is time to finalize the remaining steps on the robot side and proceed to executing the bin picking program.
4.1 Teach Positions

Besides these 4 local poses it is also essential to define the Start and End positions for all Vision Systems used in the current solution. These positions define the initial and final trajectory waypoints and are required by the initialization request for each Vision System. Usually they are touched up in such a way that the robot tool is located above the center of the bin.
To set the Start and End waypoints, navigate to the Vision_positions folder at the bottom of the program, select the waypoint START_VS_1, and teach it. Then repeat the process for the waypoint END_VS_1.
Note: Don’t edit the position names.
4.2 Gripper commands
Gripper procedures are empty by default and must be configured by the user to execute the appropriate gripper IO commands.
pho_bin_picking() procedure will call the gripper_attach() subprogram after reaching the Grasp waypoint.
4.3 Prerequisites
Final pre-deployment check before running the bin picking interface from the robot side. Make sure that:
The Bin Picking solution is properly configured on the Vision Controller side
Network setup on the robot side is completed and the State Server works (see 2 Robot Controller Setup)
All Vision Systems defined in the solution are calibrated
The Start and End pose for all Vision Systems have been touched up
All local poses in the main program have been touched up properly
Gripper procedures are prepared and working
4.4 Running pho_main_basic program

NOTE: It is strongly recommended to decrease the override speed to 20% before running the program for the first time.


If there is a pickable object in the scene and the trajectory for the first object has been received by the robot controller, the robot should start moving towards the first object.
If everything looks fine, keep moving the robot towards the first target and check if the path is correct. At this point, if the robot is too far from the object or pushes the object too deep, make modifications on the Bin Picking Studio Tool Point or Gripping Point pages.
If trajectories look fine, set up your own placing routine and slowly ramp up the speed back to 100%.
Congratulations, you have successfully deployed the Photoneo Universal Robots interface. You can now focus on improving your application further. Use the CheatSheet and Program Templates as your guidelines.
5 Robot module update
To update your current robot module to a version compatible with the Bin Picking Studio version you are using, please follow these steps:
Back up your custom settings - make a backup of your customer_definitions.script file, as it contains your custom settings and gripper action procedures
Remove old scripts - delete the scripts currently loaded in your main URP application, specifically photoneo_common.script and customer_definitions.script
Load new scripts - copy the new versions of photoneo_common.script and customer_definitions.script to the robot controller and load them into your main URP application, replacing the old ones
Reapply modifications - transfer your modifications from the old customer_definitions.script to the new version of the script
Review API changes - carefully read through the API changes introduced in the new version of the robot module and update your current API calls in the main program as necessary to align with these changes
To check the version of customer_definitions.script, check the script’s header and look for the Customer Definitions version. To check the version of photoneo_common.script, check the script’s header and look for the library version.
6 Contact Information
Headquarters
Zebra Technologies Slovakia s.r.o.
Plynárenská 6
821 09 Bratislava, Slovakia
|
Technical support
Contact us at the Help Center.
Visit the Photoneo support pages at www.photoneo.com/support.
Orders and inquiries:
|
