Saturday, January 10, 2015

Robot Programming using Kuka | prc

NOTE: This post contains information on the PREVIOUS version of KUKA|Prc. 

Please see Robot Programming with Kuka|prc for information on the latest version (v2). 

For information on the older version see below...

This post provides general information on setting up a Grasshopper definition for using Kuka|prc with the Agilus Workcell in the Taubman College Fab Lab.

KUKA|prc is a set of Grasshopper components that provide Procedural Robot Control (thus the name prc) for KUKA robots. These components are very straightforward to use and it's actually quite easy to program the robots using them.


Before we begin discussing KUKA|prc it's important to clarify some terminology that will be used in this topic.

  • Work Cell: All the equipment needed to perform the robotic process (robot, table, fixtures, etc.)
  • Work Envelope: All the space the robot can reach.
  • Degrees of Freedom: The number of movable motions in the robot. To be considered a robot there needs to be a minimum of 4 degrees of freedom. The Kuka Agelis robots have 6 degrees of freedom. 
  • Payload: The amount of weight a robot can handle at full arm extension and moving at full speed.
  • End Effector: The tool that does the work of the robot. Examples: Welding gun, paint gun, gripper, etc.
  • EOAT: End Of Arm Tooling. This is everything bolted to the end of the tool plate. An example is a transformer bolted to the tool plate but not actually the end effector. The transformer only supports the operation of the end effector.
  • Manipulator: The robot arm (everything except the EOAT).
  • TCP: Tool Center Point. This is the point (coordinates) that we program in relation to.
  • Positioning Axes: The first three axes of the robot (1, 2, 3). Base / Shoulder / Elbow = Positioning Axes
  • Orientation Axes: The other joints (4, 5, 6). These joints are always rotary. Pitch / Roll / Yaw = Orientation Axes.

Rhino File Setup

When you work with the robots using KUKA|prc your units in Rhino must be configured for the Metric system using millimeters. The easiest way to do this is to use the pull-down menus and select File > New... then from the dialog presented chose "Small Objects - Millimeters" as your template.

The KUKA|prc User Interface

When installed KUKA|prc has a user interface (UI) much like other Grasshopper plug-ins. The UI consists of the palettes in the KUKA|prc menu.

There are four palettes which organize the components. These are:
  • 01 | Core: The main Core component is here (discussed below). There are also the components for the motion types (linear, spline, etc.). 
  • 02 | Toolpath: Approach and Retract components are here (these determine how the robot should move after a toolpath has completed). There are also components for dividing up curves and surfaces and generating robotic motion based on that division. 
  • 03 | Virtual Robot: The various KUKA robots are here. We'll mostly be using the the KUKA gelis KR6 R900 component as those are what's used in the Agelis workcell. 
  • 04 | Virtual Tools: The tools (end effectors) are here. We'll mostly be using the Custom Tool component.  
  • 05 | Utility: The components dealing with input and outputs are stored here. These will be discussed in detail later. 


The component you always use in every definition is called the Core. It is what generates the KUKA Robot Language (KRL) code that runs on the robot. It also provides the graphical simulation of the robot motion inside Rhino. Everything else gets wired into this component.

The Core component takes five inputs. These are:
  • SLIDER - This is a numeric value. Attach a default slider with values from 0.00 to 1.00 to control the simulation. 
  • COMMAND - This is the output of one of the KUKA|prc Command components. For example a Linear motion command could be wired into this socket. 
  • COLLISION - This is an optional Mesh which represents the collision geometry, e.g. the workcell.
  • DEFAULT TOOL - This is the tool (end effector) to use. It gets wired from one of the Tool components available in the Virtual Tools panel. Usually you'll use the KUKA|prc Custom Tool option and wire in a Mesh component will show the tool geometry in the simulation.  
  • ROBOT - This is the robot to use. The code will be generated for this robot and the simulation will graphically depict this robot. You'll wire in one of the robots from the Virtual Robot panel. For the Agelis Workcell you'll use the Agelis KR6 R900 component.  

The right-click context menu for the Core component gives you access to its settings. Choose KUKA|prc Settings from the menu:

The settings are organized in a floating dialog with a hierarchy of options on the left side. You click on an option in the list and settings for it appear on the right side. These settings will be covered in more detail later.

Basic Wiring Setup

There is a common set of components used in nearly all definitions for use with the Agelis Workcell. Not surprisingly, these correspond to the inputs on the Core component. Here is a very typical setup:

  • SLIDER: The simulation Slider goes from 0.00 to 1.00. Dragging it moves the robot through all the motion specified by the Command input. It's often handy to drag the right edge of this slider to make it much wider than the default size. This gives you greater control when you scrub to watch the simulation. You may also want to increase the precision from a single decimal point to several.
  • COMMAND: The components which gets wired into the COMMAND slot of the Core is really the heart of your definition and will obviously depend on what you are intending the robot to do. In the example above a simple Linear Move component is wired in.
  • DEFAULT TOOL: We normally use custom tools with the Agelis Workcell. Therefore a Mesh component gets wired into the KUKA|prc Custom Tool component (labelled TOOL above). This gets wired into the DEFAULT TOOL slot of the Core. The Mesh component points to a mesh representation of the tool drawn in the Rhino file.
  • ROBOT: The robots we have in the Agelis Workcell are KUKA KR6 R900s. So that component is chosen form the Virtual Robots panel. It gets wired into the ROBOT slot of the Core.

Robot Position and Orientation

The workcell has two robots named Mitey and Titey. Depending on which one you are using you'll need to set up some parameters so your simulation functions correctly. These parameters specify the location and orientation of the robot within the workcell 3D model.


Mitey is the name of the robot mounted in the table. Its base is at 0,0,0. The robot is rotated about its vertical axis 180 degrees. That is, the cable connections are on the right side of the robot base as you face the front of the workcell.

To set up Mitey do the following:

Right-click on the Core component, chose Settings from the context menu, then select the Base Settings choice on the left side of the dialog. The dialog is shown below:

You specify the X, Y, and Z offsets in the Base X, Base Y, and Base Z fields of the dialog. Again, for Mitey these should all be 0. In order to rotate the robot around the vertical axis you specify 180 in the Base A field. You can see that the A axis corresponds to vertical in the diagram.
  • Base X: 0
  • Base Y: 0
  • Base Z: 0
  • Base A: 180
  • Base B: 0
  • Base C: 0
After you hit Apply Settings the robot position will be shown in the viewport. You can close the dialog with the [X] in the upper right corner.

The upper robot hanging from the fixture is named Titey. It has a different X, Y and Z offset values and rotations. Use the seeings below when your definition should run on Titey.

Note: These values are all in millimeters.

  • Base X: 1102.51
  • Base Y: 0
  • Base Z: 1125.66
  • Base A: 90
  • Base B: 180
  • Base C: 0

Code Output

The purpose of KUKA|prc is to generates the code which runs on the robot controller. This code is written in the Kuka Robot Language (KRL). You need to tell KUKA|prc what directory and file name to use for its code output. Once you've done this, as you make changes in the UI, the output will be re-written as necessary to keep the code up to date with the Grasshopper definition settings.

To set the output directory and file name follow these steps:

  • Right -click on the Core component. 
  • Choose Settings from the context menu. 
  • Select the Output settings on the left of the dialog. 

  • Check the Save File box. 
  • Click the Set Output Directory button and select a path from the Browse for Folder dialog presented. 
  • Enter the File Name you wish to use in the Project/File Name box. 
  • Press the Apply Settings button and close the dialog. 

That's all you need to do to generate code.

Note: If you check the Automatic File Numbering for Mass Customization check box KUKA|prc will generate a new file every time you change something inside Grasshopper. This can easily generate hundreds or even thousands of files - so be aware of that before you check it!

See the topic Taubman College Agilus Workcell Operating Procedure for details on how to get the code onto the robot and run it.

Start Position / End Position

The program needs to know where to begin before it runs. That is, where and how is the tool positioned before the motion starts. Also, where should the tool move to when the programmed motion completes.

You specify these values in the Settings of the Core. Bring up the settings dialog and choose the Advanced Settings section on the left.

Under the Start and End sections you enter the axis values for A1 through A6. This of course begs the questions "how do I know what values to use?".

You can read these directly from the robot pendant (smartPAD). That is, you jog the robot into the start position and read the values from the pendant. Enter the values into the dialog. Then do the same for the End values.

See the section Jogging the Robot in topic Taubman College Agilus Workcell Operating Procedure.

Motion Types

Note: The information in this section contains material excerpted from the KUKA documentation. 

KUKA|prc provides several motion types. These are:

PTP: Point to Point

You get this motion type by using the KUKA|prc PTP Movement component

The robot guides the TCP along the fastest path to the end point. The fastest path is generally not the shortest path and is thus not a straight line. As the motions of the robot axes are rotational, curved paths can be executed faster than straight paths. The exact path of the motion cannot be predicted.

LIN: Linear

You get this motion type by using the KUKA|prc Lin Movement component. 

The robot guides the TCP at a defined velocity along a straight path to the end point. This path is predictable.

CIRC: Circular

You get this motion type by using the KUKA|prc Circ Movement component. 

The robot guides the TCP at a defined velocity along a circular path to the end point. The circular path is defined by a start point, auxiliary point and end point.

SPLINE: Smooth Spline 

You get this motion type by using the KUKA|prc Spline Movement component. 

The robot will move along the positions in a smooth spline movement.