Set up Universal Robots Controller

This section describes the preparations and settings required to control a UR robot with Mikado.

System requirements

The Mikado connection for Universal Robots is compatible with UR robots of the CB3-series from V3.7 and the e-series from V5.1.

Network configuration

A network connection between the two systems is required for communication between the robot controller and Mikado Controller. To do this, first connect an Ethernet port of the Universal Robots Controller to an Ethernet port of the Mikado Controller. A fixed IP address and a corresponding subnet mask must then be set for both the Mikado Controller and the robot controller. The network configuration of the Mikado Controller is explained in more detail in section Network adapter.

The IP address of the UR controller can be accessed via the Settings menu (list icon at the top right) of the Polyscope interface. An IP address can be assigned there under the heading System → Network → Static IP address.

Make sure that the IP addresses of the Mikado Controller and Universal Robots Controller are in the same address space and that the subnet masks match. The IP addresses of the devices must not be identical.

Warning

In the Installation area, the Fieldbus → Ethernet/IP interface must not be activated as it interferes with the network connection to the Mikado controller.

Then enter the IP address of the robot controller in the Mikado Assistant under “Robot” -> “Connection” in the corresponding field and save the settings.

Setting up the communication program

In order for the robot to be controlled by Mikado, a communication program must be copied to the Universal Robots Controller and set up there. To do this, carry out the following steps:

  • Copy the URCap “ExternalControl” program to a USB stick. You can find the program via the button in the Mikado Assistant (“Parameters” -> “Robot” -> “Open directory”) or directly in the following directory: /opt/isys-vision/mikado/share/ur_robot_driver/resources/externalcontrol-X.X.X.urcap

  • Install URCap on the UR controller:

    • CB3: Setup Robot → URCaps → + button → select externalcontrol-X.X.X.urcap → Restart

    • e-series: Top right on the menu icon → Settings → System → URCaps → + button → select externalcontrol-X.X.X.X.urcap → Restart

  • Configure URCap

    • Program Robot → Installation → External Control

    • Enter the IP of the Mikado controller

  • Create new UR program

    • Node “External Control” (listed under Structure) insert

    • Save program (e.g. under the program name mikado)

  • PolyScope 5.x: Activate Remote Control Mode

    • Top right on the menu icon → Settings → System → Remote Control → Enable

    Settings for remote control mode

    Settings for remote control mode

    • Exit → Switch mode from Local to Remote Control at the top right

    Switch between *Local* and *Remote Control* mode

    Switch between Local and Remote Control mode

  • PolyScope 5.10 and newer: activate services

    • In newer PolyScope versions on factory settings, multiple services that are necessary for Mikado to connect to the UR robot are deactivated

    • To reactivate these, so the robot state can be visualized in mikado:

      1. Hamburger menü (upper right) → Settings

      2. Security → Services

      3. Unlock menu with admin password. (default: “easybot”, this might need to be changed beforehand under Password → Admin)

      4. Activate Dashboard Server, Primary Client Interface, Secondary Client Interface and Real-Time Data Exchange (RTDE)

      5. Lock menu and Exit

    PolyScope 5.23 Services

    PolyScope 5.23 Services

Set up autostart

Autostart can be activated so that Mikado can control and move the robot directly when the application is started. In this case, Mikado triggers the UR so that the communication program is also started when the robot axes are enabled.

Set up and configure Autostart:

  • On the UR Controller under Installation → Startup → Check Load default program → Select communication program (e.g. mikado.urp)

  • Save installation

  • Open the autostart program in local mode. This program will be loaded automatically on future restarts.

  • Activate Remote Control Mode

  • If necessary, adjust the following parameters in the corresponding cell in the launch/manipulator.launch.xml file:

    <param name="enable_autostart" value="true"/>
    <param name="autostart_ur_program_name" value="mikado.urp"/>
    
    • enable_autostart: Enable/disable the autostart function. Mikado waits at program start until a robot status could be read and only then triggers the communication program. (default value: 10s)

    • autostart_ur_program_name: Program name of the autostart program (usually name of the communication program including .urp extension) (default value: mikado.urp)

  • Now Mikado will automatically start the autostart program on Mikado startup.

Hint

UR offers the option of energizing and enabling the robot directly after the controller start via digital inputs. Use this function (can be found under Installation → Startup) to boot the system into an operational state.

Joint angle limits

The Mikado path planning supports joint angle ranges of up to 360°. As a UR has spinning joints, the value range in the robot controller (Polyscope) must be reduced. You can define limits for the Joints in the robot safety settings. Use the same value ranges here as you have set in the configuration (joint_limits.yaml) of Mikado. This prevents you from accidentally teaching robot poses that are outside the limits.

Please note: Give the joint limits in the controller a little more leeway (+/- 4°), as a safety stop can be triggered earlier and the Freedrive counteracts before the limits are reached. Example: Configuration Mikado: from -180° to 180° → Configuration Polyscope: from -184° to 184°

Hint

If you want to go beyond the joint angle value range for certain applications, you can also move the value range. You just need to make sure that the joint angle limits on the controller and the Mikado configuration match.

It is also possible to use a native robot program to enable rotations beyond the limits. For example, you can use the task “Execute robot program” for certain movements in your application and then return control to Mikado.

Speed and acceleration

Make sure that you always set a sufficiently low speed/acceleration in Mikado so that the robot cannot exceed the maximum speed/acceleration set in the UR controller. If the UR controller has to limit the speed, this can lead to the error message “Goal distance too high” and the robot may stop before it reaches the planned goal. In this case, you must either increase the limits in the UR controller or reduce the values in Mikado on the Robot control page.

Extracting and using robot calibration data

All UR robots are calibrated at the factory before delivery to compensate for inaccuracies in the robot kinematics. This factory calibration can be extracted and used by Mikado to calculate the inverse kinematics. In this way, inaccuracies are also compensated for when the robot is controlled by Mikado.

The use of the robot calibration data for Mikado is not mandatory, but is strongly recommended, as the position of the end effector may otherwise deviate by several centimetres.

The following steps are necessary for this:

  1. Start the UR robot and ensure that there is a network connection to the Mikado controller (see Network configuration)

  2. Open the console window on the Mikado controller and execute the following command. Here, <ROBOTER IP> and <ZELLNAME> must be replaced by the IP address of the robot and the name of the Mikado cell to be used. This command is used to read out the calibration of the robot and save it in the specified file:

    roslaunch ur_calibration calibration_correction.launch robot_ip:=<ROBOTER IP> target_filename:="${HOME}/mikado/cells/<ZELLNAME>/config/ur_calib_data.yaml"
    

    The name of the target file can be freely selected if required. However, this must be taken into account accordingly in the following steps.

  3. The calibration data is now available as a file and needs to be linked to the robot cell. To do this, open your cell in the Mikado-Assistant and switch to the Cell → Cell Model page. Select Show Urdf and then the world.xacro file. Now replace the path to the calibration file (kinematics_parameters_file) as shown in the following example. <CELLNAME> must also be replaced here with the name of your Mikado cell:

    <xacro:ur10e_robot kinematics_parameters_file="$(find ur_description)/config/ur10e/default_kinematics.yaml" prefix="${arm_prefix}"/>
    

    is replaced by:

    <xacro:ur10e_robot kinematics_parameters_file="$(find <ZELLNAME>)/config/ur_calib_data.yaml" prefix="${arm_prefix}"/>
    
  4. Furthermore, open the file launch/manipulator.launch.xml in the cell directory and replace the line:

    <arg name="kinematics_config" default="$(find ur_description)/config/ur10e/default_kinematics.yaml" ... />
    

    with:

    <arg name="kinematics_config" default="$(arg project_dir)/config/ur_calib_data.yaml" ... />
    
  5. Now check whether the changes were successful by starting Mikado. If the calibration data is correctly integrated, the following message will appear in the logs when you start Mikado: Calibration checked successfully.

    If an error occurs, the message The calibration parameters of the connected robot do not match those in the specified kinematics configuration file [...] appears.

Hint

The hand-eye-calibration should be repeated after the robot calibration data has been applied. The calibration data allows to locate the camera position more precisely.

Warning

Take care to always update both files that mention the new calibration data:

  • launch/manipulator.launch.xml

  • urdf/world.xacro

Optional: Execute native robot program

Native programs can be executed on the controller using the “Execute robot program” task.

The following steps are necessary for this:

  • Create a new UR program using the teach pendant

  • If you want to transfer variables to the program, create the corresponding installation variables:

    • These can be found under Program Robot → Installation → General → Variables

    • Do not forget to save the installation configuration with the installation variables as well

    UR Installationsvariablen

    UR Installationsvariablen

  • Insert the UR command Stop at the end of your UR program. At this point, the UR program stops and returns control to Mikado.

    Example of a native UR program

    Example of a native UR program

  • Once you have completed and tested your UR program, load and start the control program again

  • Now you can use the task “Execute robot program” in Mikado to integrate your native UR program into the process

    Example Mikado program with task ":ref:`tasks_run_robot_program`"

    Example Mikado program with task “Execute robot program”

Hint

In the currently available Mikado version, you do not have the option of returning a return value to Mikado. By default, you will receive the value 0 as the return value of the task.

Using UR robots

Turning on the robot

  • Start Mikado and robot controller

  • Energize and unlock the robot

  • Make sure that the Remote Control mode is selected on the teach pendant at the start time of Mikado

    The *Remote Control Mode* can be selected at the top right of the UR Teach Pendant

    The Remote Control Mode can be selected at the top right of the UR Teach Pendant

  • Load and start the Mikado program on the UR Controller

    • A connection to Mikado is established. If this is not successful, an error message appears. In the event of an error, check the network connection and start the Mikado interface.

    • The execution of movements can now be stopped or paused on the teach pendant. However, this can lead to timeouts occurring in Mikado and thus tasks being aborted due to the timeout.

Hint

  • Note that the Mikado communication program is terminated as soon as you move the robot manually. Restart the program as soon as you want to return control to Mikado.

  • You can optionally use an autostart for the UR program (see Set up autostart).

Using URCap grippers

To use additional URCaps, e.g. for gripper control:

  • the ExternalControl URCap has to be executed permanently, so Mikado can control the robot

  • to additionally e.g. control a gripper using URCaps, the program can reacto to Events or run an additional Thread to perform additional actions depending on robot outputs.

Using Events the program could for example look like this:

URCap Gripper Events

URCap Gripper Events for one gripper

It is possible to control multiple grippers, when the currently used gripper is indicated by a digital output. In the following example digital output 5 and 6 are used to activate the respective gripper.

URCap Gripper Events for multiple grippers

URCap Gripper Events for multiple grippers

For just two grippers this can be simplified, so e.g. just the two states of one digital output can be used to choose between the two grippers.

When using one Thread instead of Events, the program could look like this:

Hauptprogramm
  ExternalControl

Thread:
  if Output[0] == True:
    schließe Greifer
    Wait until Output[0] == False

  if Output[1] == True:
    öffne Greifer
    Wait until Output[1] == False

  Script: sync()

Parameters and controls

  • Speed - Acceleration:

    Two input fields allow you to set the speed and acceleration factor for robot movements. Please note that maximum values are stored in the System configuration so that you may not be able to exceed a limit value.

Other notes

  • Teaching position:

    • You can teach positions using either buttons on the teach pendant (polyscope) of the robot or the Freedrive mode.

    • Click on “Accept current robot pose” in Mikado.

    • Note that you must restart the UR communication program after manual robot movements so that Mikado can send commands to the robot again.

Troubleshooting Universal Robot

  • The robot cannot be moved via Mikado

    • Check whether there is a connection to the robot

    • Are the axles energized?

    • Is the communication program running on the Teach Pendant?

    • Is the UR in remote control mode?

    • Has the communication program entered the address of the Mikado controller as the IP?

  • The UR communication program cannot be started and displays the error message``The connection to the remote PC could not be established``

    • Has the communication program entered the address of the Mikado controller as the IP?

    • Are the IP addresses of the robot and Mikado controller correctly configured and in the same subnet?

  • The Mikado system status for the robot is red

    • Check whether the axes are energized and the communication program has started successfully

  • A native program cannot be started.

    • Check the program name, variable names and the existence and data type of the installation variables.

    • Important: The system connects to the UR Controller during the start-up process of the Mikado interface. At this point, the Remote Control Mode must be selected on the teach pendant.

    • If a robot movement is to be executed in the native program, the first waypoint must match the current robot position. Otherwise you will receive an error.

  • Autostart of the Mikado communication program does not work

    • The system connects to the UR Controller during the start-up process of the Mikado interface. At this point, the autostart program needs to be the current program and the Remote Control Mode must be selected on the teach pendant

  • No connection to the robot possible and the Mikado console reports: Variable 'tool_digital_output_mask' is currently controlled by another RTDE client.

    • Make sure that no other UR program besides the URCap “ExternalControl” uses RTDE (Real-time Data Exchange).

    • When the resource conflict is caused by a required URCap (e.g. for a gripper), the Mikado UR driver has to be modified, to give up control over the resources used by multiple URcaps:

      • the file rtde_input_recipe.txt has to be made writeable and the modified:

        roscd ur_robot_driver/resources
        sudo chmod 777 ./rtde_input_recipe.txt
        kate ./rtde_input_recipe.txt
        
      • in the file rtde_input_recipe.txt the following lines have to be removed, as they are used by another URCap:

        tool_digital_output_mask
        tool_digital_output
        
      • See also https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/issues/239

  • No connection to the robot possible and the Mikado console reports: Variable 'speed_slider_mask' is currently controlled by another RTDE client.

  • A previously working OnRobot URCap stops working, e.g. with a message “Waiting for valid … timed out. Program halted”

    • Navigate to Installation → URCaps → OnRobot to change the offsets of the used RTDE registers to remove the resource conflict of the URCaps.

  • After updating the mikado-robots-ur package, the Mikado cell no longer starts and displays an error message in the console, usually resource not found: ur_e_description. This situation occurs when the Mikado cell was originally created with an older version of the UR driver and is now no longer compatible with the newly installed driver version. The manual adjustments listed below are necessary to make the Mikado cell functional with the current driver.

    Please note: The following changes are all shown using an ur10e as an example. If a different robot is used in the cell, the examples must be adapted to the model actually used.

    • urdf/world.xacro

      The following lines:

      <xacro:include filename="$(find ur_e_description)/urdf/ur10e.urdf.xacro"/>
      <xacro:ur10e_robot joint_limited="true" kinematics_file="${xacro.load_yaml('$(find ur_e_description)/config/ur10e_default.yaml')}" prefix="${arm_prefix}"/>
      

      must be replaced by these lines:

      <xacro:include filename="$(find ur_description)/urdf/inc/ur10e_macro.xacro"/>
      <xacro:ur10e_robot kinematics_parameters_file="$(find ur_description)/config/ur10e/default_kinematics.yaml" prefix="${arm_prefix}"/>
      
    • launch/trajectory_execution.launch.xml

      The following line:

      <rosparam unless="$(arg simulated_robot)" file="$(find ur10_e_moveit_config)/config/controllers.yaml"/>
      

      must be replaced by this line:

      <rosparam unless="$(arg simulated_robot)" file="$(find ur10e_moveit_config)/config/ros_controllers.yaml"/>
      
    • launch/manipulator.launch.xml

      The following section:

      <group unless="$(arg sim)">
        <arg name="kinematics_config" default="$(find ur_e_description)/config/ur10e_default.yaml" doc="Kinematics config file used for calibration correction. This will be used to verify the robot's calibration is matching the robot_description."/>
      
        <arg name="max_joint_difference" default="0.0001" doc="Minimal accuracy of each joint of robot"/>
        <arg name="controller_config_file" default="$(find ur_robot_driver)/config/ur10e_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/>
        <arg name="use_tool_communication" default="false" doc="On e-Series robots tool communication can be enabled with this argument"/>
        <arg name="headless_mode" default="false" doc="Automatically send URScript to robot to execute. On e-Series this does require the robot to be in 'remote-control' mode. With this, the URCap is not needed on the robot."/>
        <arg name="limited" default="true" doc="Use the description in limited mode (Every axis rotates from -PI to PI)"/>
        <include file="$(find ur_robot_driver)/launch/ur_common.launch">
            <arg name="use_tool_communication" value="$(arg use_tool_communication)"/>
            <arg name="controller_config_file" value="$(arg controller_config_file)"/>
            <arg name="kinematics_config" value="$(arg kinematics_config)"/>
            <arg name="robot_ip" value="$(arg robot_ip)"/>
            <arg name="limited" value="$(arg limited)"/>
            <arg name="headless_mode" value="$(arg headless_mode)"/>
            <arg name="max_joint_difference" value="$(arg max_joint_difference)" />
        </include>
      </group>
      

      must be replaced by this section:

      <group unless="$(arg sim)">
        <arg name="kinematics_config" default="$(find ur_description)/config/ur10e/default_kinematics.yaml" doc="Kinematics config file used for calibration correction. This will be used to verify the robot's calibration is matching the robot_description."/>
        <arg name="max_joint_difference" default="0.001" doc="Maximum allowed difference between target and actual joint positions for low bandwidth trajectory follower"/>
        <arg name="controller_config_file" default="$(find ur_robot_driver)/config/ur10e_controllers.yaml" doc="Config file used for defining the ROS-Control controllers."/>
        <arg name="use_tool_communication" default="false" doc="On e-Series robots tool communication can be enabled with this argument"/>
        <arg name="headless_mode" default="false" doc="Automatically send URScript to robot to execute. On e-Series this does require the robot to be in 'remote-control' mode. With this, the URCap is not needed on the robot."/>
        <arg name="ur_hardware_interface_node_required" default="false" doc="Shut down ros environment if ur_hardware_interface-node dies."/>
        <include file="$(find ur_robot_driver)/launch/ur_common.launch">
            <arg name="use_tool_communication" value="$(arg use_tool_communication)"/>
            <arg name="controller_config_file" value="$(arg controller_config_file)"/>
            <arg name="kinematics_config" value="$(arg kinematics_config)"/>
            <arg name="robot_ip" value="$(arg robot_ip)"/>
            <arg name="headless_mode" value="$(arg headless_mode)"/>
            <arg name="max_joint_difference" value="$(arg max_joint_difference)" />
            <arg name="ur_hardware_interface_node_required" value="$(arg ur_hardware_interface_node_required)"/>
        </include>
      </group>
      
    • launch/planning_context.launch.xml

      The following line:

      <rosparam command="load" file="$(find ur10_e_moveit_config)/config/kinematics.yaml"/>
      

      must be replaced by this line:

      <rosparam command="load" file="$(find ur10e_moveit_config)/config/kinematics.yaml"/>