Skip to content

URScript Module

The Pick[+] URScript module communicates with the Pick[+] server over a TCP socket connection. The robot initiates the connection outbound to the Pick[+] PC, no inbound configuration is needed on the robot side.

Robot Configuration

Before using these functions, make sure your robot is properly configured as described in Universal Robots Configuration. Set SERVER_IP and SERVER_PORT at the start of your program before calling any Pick[+] functions.


Installation

The Pick[+] module is a plain URScript file that must be loaded into your robot program. This is the first step to build the robot program for your application. Follow the instructions for your Polyscope version below.

  1. Access the Polyscope interface on the teach pendant and navigate to the Program tab.

  2. Go to the Advanced section of commands and insert a Script node into the program. Look for the File option and click Edit.

    Insert Script node

  3. Insert the pickplus.script file. Once loaded, all Pick[+] functions will be available throughout your program.

    Load pickplus.script file

Version

Requires PolyScope X 10.14.0 and above.

  1. Open Polyscope X on the teach pendant and navigate to the Programs tab.

  2. Click on the program name at the top. This opens the System Manager. Click on Script Files and add the pickplus.script file.

    Add script file in System Manager

  3. After closing the System Manager, go to the Before Start section and load a Script module. Click Set Script and choose the pickplus.script file inserted previously. Once loaded, all Pick[+] functions will be available throughout your program.

    Set script module


Functions

For the global variables updated by these functions, see the Global Variables Reference.

Process name format

The process_name must always follow the format b0_<application>, where <application> is the name of your Pick[+] process/application. For example, an application named bin_picking uses b0_bin_picking.

pick_plus_process_status

Checks the current execution mode of the Pick[+] process. Updates the PP_ROUTINE and PP_ERROR global variables. Use this to verify the system is ready before triggering.

Returns: True if the process is in execution mode (PP_ROUTINE == 2) with no error (PP_ERROR == 0); otherwise False.

Parameter Type Default Description
process_name string "b0_pickplus" The process ID associated with your Pick[+] application

pick_plus_trigger

Instructs the Pick[+] server to capture an image and initiate pick candidate detection. The current TCP pose is automatically read and included in the trigger message.

Returns: Nothing. Errors are logged via PP_ERROR.

Parameter Type Default Description
process_name string "b0_pickplus" The process ID associated with your Pick[+] application

pick_plus_config_trigger

A highly customizable trigger that filters detections by category, environment, model ID, and picking angle. Use this instead of pick_plus_trigger when filtering is required.

Returns: Nothing. Errors are logged via PP_ERROR.

Parameter Type Default Description
process_name string "b0_pickplus" The process ID associated with your Pick[+] application
categories list [] Category names to include or exclude
categories_subtract bool True If True, listed categories are excluded. If False, only listed categories are searched
environments list [] Bins Names to restrict the pick region to
environments_subtract bool True If True, listed Bins Names are excluded. If False, only listed Bins Names are searched
models_ids list [] Model IDs to include or exclude
models_id_subtract bool True If True, listed model IDs are excluded. If False, only listed model IDs are searched
max_angle float 15 Maximum picking angle in degrees. Candidates exceeding this angle are disregarded

pick_plus_output

Requests the picking pose from the Pick[+] server. Updates PP_FOUND, PP_POSE, PP_CATEGORY, PP_MODEL, and PP_PICK_ID. Call this in a loop while PP_FINDING is True.

Returns: Nothing directly. Results are written to the global variables.

Parameter Type Default Description
process_name string "b0_pickplus" The process ID associated with your Pick[+] application
retry_object bool False If True, requests the same instance as the previous pick
timeout float 5 Response timeout in seconds

Example Program

The example below shows how to integrate the Pick[+] functions into a standard pick-and-place loop. It is also provided by BitMetrics with the Pick[+] URScript module.

Before running

Make sure all move poses in the example are valid for your use case before executing it.

PolyScope 5.x example program

PolyScope X example program - Before Start

PolyScope X example program - Main Program


The example is split into two parts: a Before Start section that runs once when the program starts, and a Robot Program that loops continuously. The logic is the same on both PolyScope versions, only the way the module is loaded differs.

1. Before Start

This section prepares the connection to Pick[+]. It runs a single time before the main loop begins.

  • Load the module: the pickplus.script file is inserted first, so all Pick[+] functions are available in the rest of the program.
  • PP_POSE := p[0,0,0,0,0,0]: initializes the pose variable that will later hold the pick target.
  • SERVER_IP and SERVER_PORT: the IP and port of the Pick[+] server (for example 30040). The robot uses these to open the TCP connection.
  • proc_id := "b0_pickplus_test": the process ID of your application, following the b0_<application> format. It is stored in a variable so every function call can reuse it.

2. Wait for the application to be ready

Before triggering, the program waits until the Pick[+] application is running in Execution Mode.

  • PP_ROUTINE is reset to -1 (unknown).
  • A loop calls pick_plus_process_status(process_name=proc_id) every second until PP_ROUTINE reaches 2 (execution mode). This prevents the robot from sending requests before Pick[+] is ready.

3. Trigger a detection

Inside the main loop, the robot requests a new detection.

  • MoveJ to CamTrigrPose: moves the robot to the position where the camera captures the scene. The current pose is sent automatically with the trigger.
  • pick_plus_config_trigger(process_name=proc_id, ...): asks Pick[+] to capture an image and compute pick candidates, applying the filters (categories, environments, models, max_angle). Use pick_plus_trigger instead if no filtering is needed.
  • PP_FOUND := False and PP_FINDING := True: reset the result flags before polling for a result.

4. Retrieve the pick result

While PP_FINDING is True, the program polls the server for a candidate.

  • pick_plus_output(process_name=proc_id) is called in a loop. When a result arrives it updates PP_FOUND, PP_POSE, PP_CATEGORY, PP_MODEL, and PP_PICK_ID, and sets PP_FINDING to False to exit the loop.

5. Execute the pick

Once polling finishes, the program acts on the result.

  • If PP_FOUND is True: move the robot to PP_POSE, perform the pick (for example, close the gripper), and move to the place position.
  • If no candidate was found or PP_FAULT is set: skip the pick and start a new cycle. Errors are available in PP_ERROR.

The loop then repeats from step 3 to pick the next object.