Set up KUKA Controller

The following describes how the robot-side preparation for Mikado works, in particular the use of the various KRL scripts. Two interpreters run on the robot: The submit interpreter (C:\KRC\ROBOTER\KRC\R1\System\mik_service_sps.sub and mik_status_sps.sub) and the robot interpreter (C:\KRC\ROBOTER\KRC\R1\Program\mikado.src). The submit interpreter is usually started automatically and then runs in the background, the robot program must be selected. These both communicate with the Mikado controller via EthernetKRL.

System requirements

Mikado communicates with the KUKA controller via EthernetKRL and uses splines for movement commands. Therefore, at least KSS 8.3 must be installed as well as the additional package EthernetKRL 2.2 or higher. Since two submit programs are running for performance reasons, the MultiSubmit extension must be installed for KSS 8.3 and 8.4; from KSS 8.5 onwards this is standard.

Network configuration

A network connection must be established for communication between the Mikado controller and the robot controller. By default, the KLI interface (KUKA Line Interface) of the robot controller with the following connections is intended for this purpose:

  • KR C4: X66

  • KR C5: XF5

Warning

Without additional option packages, these network connections must be used. Other RJ45 connectors on the robot controller do not work at all for communication with Mikado (e.g. KSI) or must be activated using additional option packages. Alternative connection options available with option packages are explained in more detail below.

Define a fixed IP address and an associated subnet mask for both the Mikado controller and the robot controller. The network configuration of the Mikado controller is explained in more detail in the Network adapter section.

Information on the network configuration of the KUKA controller can be found in the manufacturer’s user manual.

The IP address of the robot controller must then be stored in the Mikado cell. To do this, navigate to Parameters → Robot in the Mikado Assistant and enter the IP address of the robot controller in the corresponding field.

Hint

Make sure that the IP addresses of the Mikado Controller and KUKA Controller are in the same address space and that the subnet masks match. If, as recommended, a separate network connection is used for the camera, this must be in a different address space in order to avoid ambiguous packet transmission.

The IP address of the KLI interface of the robot controller must not be within the following ranges reserved by KUKA:

  • 192.168.0.0 - 192.168.0.255

  • 172.16.0.0 - 172.16.255.255

  • 172.17.0.0 - 172.17.255.255

Alternative connection options:

If the above-mentioned default network connections for the KLI interface are otherwise occupied (e.g. by the robot’s Profinet communication), the following alternatives can be considered:

  • An external ethernet switch can be used on XF5 (KR C5) or X66 (KR C4) to increase the number of available connectors for the KLI interface.

  • KR C5 controllers have an internal network switch for the KLI interface, whose connections can be activated using option packages.

    • KUKA.EtherNetSwitch Dual-Port: connector XF6 can also be used in addition to XF5

    • KUKA.EtherNetSwitch Quad-Port: connectors XF3, XF4 and XF6 can also be used in addition to XF5

  • Depending on the configuration, KR C4 controllers may also have a switch for the KLI interface. If present, these are the connections X67.1, X67.2, and X67.3. However, depending on the configuration of the controller, these connectors can also be used for other optional interfaces and are not always clearly assigned to the KLI interface.

    To find out whether these connections can be used for KLI, please consult the manual for your specific configuration.

  • The KUKA.OptionalNetworkInterface option can be used to activate the KONI interface (XF7) on KR C5 controllers. This can also be used for communication via Ethernet KRL. In contrast to the KUKA.EtherNetSwitch options for the KLI interface, KONI offers an additional, completely independent network interface that can be configured independently (own IP address, subnet, etc.). This makes it possible, for example, to use different network interfaces for Ethernet KRL communication and Profinet communication of the robot. This can prevent communication problems when Profinet communication traffic is very high, see Troubleshooting.

    KONI configuration: Ports 54600, 54601, and 54602 must not be listed in the list of ports under Network Configuration → KONI → Advanced → NAT. These ports are required for communication with Mikado and must therefore not be used for any other purpose.

  • Depending on the configuration, KRC4 controllers may also have a KONI interface for configuring a standalone network interface that is separate from the KLI interface. If available, these are the X64.1, X64.2, and X64.3 connections.

    To find out whether KONI is available, please consult the manual for your specific configuration variant.

Prepare KRC

To be able to control the KUKA robot with Mikado Control, the corresponding robot programs must be copied to the robot controller, configured and started. The steps required for this are explained in more detail below.

Copying the files

First, the required robot programs must be copied to the robot controller. These programs can be found on the Mikado controller under:

/opt/isys-vision/mikado/robot_programs/kuka/`

or using the button in the Mikado Assistant (Parameters → Robot → Open directory). There are three subfolders within the directory, each of which corresponds to a folder on the robot controller:

  • EthernetKRL/* → C:\KRC\ROBOTER\Config\User\Common\EthernetKRL\*

  • Program/* → C:\KRC\ROBOTER\KRC\R1\Program\* or KRC:\R1\Program\*

  • System/* → C:\KRC\ROBOTER\KRC\R1\System\* or KRC:\R1\System\*

You will find the network settings in the EthernetKRL folder. Since a KUKA controller can have several network connections, the IP of the connection used for communication with Mikado must be stored in the configuration files (the IP address of the robot controller, not that of the Mikado controller!) To do this, you must enter the IP address of the KUKA controller in line 12 of the files MikadoXmlService.xml, MikadoXmlStatus.xml and MikadoXmlTraj.xml. This can be done quite easily with the text editor Kate, for example, after you have copied the files from the above-mentioned directory to a USB stick (the folder /opt and all files contained therein are write-protected, which is why editing is only possible after copying). Somewhat less conveniently, the files can also be edited directly on the KUKA controller. After making changes to the EthernetKRL XML files, a restart of the KUKA controller is necessary.

The system folder contains programs that are executed by the submit interpreter (see below).

The Program folder contains programs that are executed by the robot interpreter. In particular, this is the “mikado.src” program, which in turn calls other .src files.

To copy files from the USB stick with the SmartPAD to the KUKA controller: Display → Window → Navigator. Files can be selected in the Navigator and then copied via Edit → Copy and Edit → Paste. A USB mouse on the SmartPAD simplifies operation. With sufficient user rights, the HMI interface can also be minimized and Windows Explorer can be used.

Hint

For security reasons, USB sticks may not be visible in some user groups.

Switch to at least the Expert user group if the USB stick is not shown as a storage device on the SmartPAD. If it is still not shown, use a different USB port (e.g., directly on the robot controller instead of on the SmartPad) or a different USB stick.

Submit Interpreter [S]

Select the file mik_status_sps.sub for slot EX1 in the submit interpreter. To do this, switch to T1 mode and then to the Expert user level. Then go to S → Stop, then Display/Assign and select the program. The robot should now be displayed in the correct position in Mikado Control. Also load mik_service_sps.sub into slot EX2, this controls the IOs, for example.

To ensure that the modules are also automatically selected and started when the robot controller is restarted, they must be selected in the cold start configuration. To do this, switch from the Current display/assignment tab to Cold start configuration and select the two modules for slots EX1 and EX2 there too.

Robot Interpreter [R]

Now select the main program mikado.src for the robot interpreter and start it. To do this, navigate to the “Program” folder on the SmartPAD (see above), select the program and press the Select button at the bottom of the screen. The program is now preselected for execution and must then be started as follows, depending on the operating mode:

  • Manual modes T1 / T2: Press and hold the enabling button on the back of the SmartPAD. Then press and hold the Start button. (It may be necessary to press the Start button several times until the program has started successfully). Both buttons must be held down permanently in manual modes so that the robot program is executed and Mikado can perform movements. This operating mode is therefore suitable, for example, for setup (performing calibration, teaching poses, etc.), as the robot can be stopped immediately by releasing one of the two buttons.

  • Automatic modes Auto / External: Press the Start button (several times if necessary). It is not necessary to hold the enabling switch on the back of the SmartPAD in automatic modes. The program is started and then continues to run automatically without additional user interaction (i.e. unlike manual modes, no button needs to be held down permanently).

If the robot program has started successfully, the symbol for the robot interpreter R is displayed in green at the top of the SmartPAD screen. If the symbol has a different color (e.g. orange or red), the robot program has not yet started successfully.

If you now make a small movement from axis 6 in Mikado on the robot side, for example, this should be executed by KUKA.

Optional: Execute native robot program

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

If a new program named “XYZ” is to be added, the program should be saved in the file “KRC/R1/Program/prog_<NAME>.src” with the same function name (“prog_<NAME>”). The program must then be added to the file “C:/KRC/ROBOTER/KRC/R1/Program/run_program.src” in the “run_program_impl” area. Copy and adapt either variant A for functions with arguments or variant B for procedures without arguments from the comment block.

Hint

By default, the template results in a failure being reported back. Change the line result.success = false to true to report a successful execution to Mikado. With a semicolon ; you can also comment out the error message result.errorMsg, or you can delete the line completely.

Hint

If you execute a movement in the native program, the program must be ended with a pre-run stop. This can be triggered in KUKA by a wait for true. This is the only way Mikado can plan subsequent movements with the correct starting position.

Transfer robot control

In some applications, it may be desirable for robot movements to be controlled partly by Mikado and partly by a robot program. This means that Mikado only executes part of the robot’s entire movement sequence and then transfers control so that other sequences can be executed on the robot, for example, to move to positions taught on the robot.

The robot must be in a standstill during each control transfer!

Transfer control to mikado

In order for Mikado to execute movement commands, the function mikado.src/mikado() must be executed in the KRC robot interpreter. This function starts an endless loop on the robot controller, which waits for new movement commands from Mikado and executes them.

Mikado controls the robot while this function is being executed.

Transfer control to the robot

To transfer control from Mikado to the robot controller, the following function can be called at the desired point in the Mikado sequence using a JavaScript task.

robot.triggerRobotService("/give_up_robot_control")

This call interrupts the above-mentioned infinite loop within mikado.src/mikado() and exits the function. The robot can then continue as desired.

Speed and fine-tuning

The speed at which movements are executed can be set via a number of parameters. In addition, the speed can be set on the KUKA controller/teach pendant, which is then multiplied by the Mikado values.

In general, the following parameters can be set in config/manipulator.yaml for all trips:

The parameter velocity_scaling scales the maximum speed specified in the URDF. If this is adjustable in Mikado, max_velocity_scaling sets the upper limit for the user. The value is between 0 and 1, which corresponds to the full speed or 100%%. acceleration_scaling sets the corresponding acceleration factor.

For the Cartesian (linear) part of a handle, slower movements can be defined separately in the individual .product files in the products folder. These also act as factors and therefore work in combination with velocity_scaling. ApproachVelocityScaling: 0.5 specifies the velocity factor before gripping and RetractVelocityScaling: 0.3 after gripping when lifting. To prevent Mikado from overwriting the changes, it is best to close it before adjusting the values in these .product files.

Based on the maximum speed in the URDF or joints_limits.yaml, the above factors and the possible accelerations, Mikado now calculates how long the individual sections of the journey will take. From this duration, a percentage of the maximum speed is recalculated for the KUKA. Unfortunately, this calculation generally leads to lower speeds than expected, so the result can be increased with velocity_scaling_factor, max_velocity_clipping sets an upper limit, min_velocity_clipping a lower one.

Troubleshooting

Timeouts and connection losses during high network usage

During high load on the network interface used by Mikado caused by additional communication, timeouts and connection losses caused by missing reply messages from the robot can occur.

As a real-time protocol, Profinet communication generally has a higher priority on the robot controller than the Ethernet KRL interface used for communication with Mikado. In most applications, this is not a problem.

However, if both Profinet and Mikado (Ethernet KRL) communicate via the KLI interface, a very high Profinet communication volume can ultimately result in the Ethernet KRL interface no longer being able to send or receive messages as expected due to its lower priority.

If this happens, it in turn leads to timeouts and connection interruptions on the Mikado side. These usually manifest themselves in the form of error messages of the following type:

[kuka-driver][communication][...][read] reading timed out after 300 ms!
[kuka-driver][keep_alive][...] reading timed out!

This problem seems to occur particularly with very short cycle times (transmission cycle) for the Profinet protocol.

Example: A Profinet transmission cycle of 2 ms with a KR C5 controller can place such a heavy load on the robot’s network interface that the described problem occurs.

There are two possible solutions to avoid this situation:

  • Use the KONI interface for Ethernet KRL communication to completely separate Profinet and Ethernet KRL from each other.

  • Reduce Profinet communication as much as possible to relieve the load on the robot’s network interface (e.g. by slowing down the Profinet cycle time).