The first Robotics API program

In your first Robotics API program, you will let the KUKA Light Weight Robot perform some simple motions. These motions will be defined in joint space, thus you will specify goal values for each single joint.

In order to run the program, you have to embed it in a executable Java application that is configured to use the Robotics API as a library. To create such an application, please refer to the instructions provided on the Robotics API website (

Include the following method in one of your application’s classes and make sure it gets called:

public void firstRoboticsAPIApplication() { 
  try { 
    // every Robotics API application has to load a configuration file 
    // first 
    // simple access by name, defined in configuration file 
    LWR lwrLeft = RoboticsRegistry.get("LbrLeft", LWR.class); 
    // access the LWR's motion interface 
    MotionInterface lwrMotion = lwrLeft.use(MotionInterface.class); 
    // move the LWR around 
    lwrMotion.ptp(new double[] { 0, .2, 0, -.2, 0, 0, 0 }).execute(); 
    lwrMotion.ptp(new double[] { 0, -.2, 0, .2, 0, 0, 0 }).execute(); 
  } catch (MultipleIllegalConfigurationsException e) { 
    for (int i = 0; i < e.getErrors().size(); i++) { 
  } catch (RoboticsException e) { 
  } finally { 

For executing this example, you need a Robotics API configuration file named ’config.xml’. Create this file in the root of your Java project and fill it with the following content:

<?xml version="1.0" encoding="UTF-8"?> 
<RobotApplication xmlns=""> 
  <Object type="org.roboticsapi.runtime.softrobot.SoftRobotRuntime" id="softrobot"> 
    <Parameter name="uri" value="" /> 
  <Object id="LwrLeft" type="org.roboticsapi.robot.kuka.lwr.LWR"> 
    <Parameter name="runtime" ref="softrobot" /> 
    <Parameter name="driver" 
        <Parameter name="runtime" ref="softrobot" /> 
        <Parameter name="jointCount" value="7" /> 
      <Parameter name="deviceName" value="LwrLeft" /> 
  <Object type=""> 
    <Parameter name="from" ref="Worldorigin"/> 
    <Parameter name="to" ref="LwrLeft" parameter="base" /> 

Make sure that you are running the SoftRobotRCC on your PC. Then start the program as Java application. If the robot drives are enabled, it will execute the three motions defined in the program. To get visual feedback, you can run the Robotics API Visualization as explained on the Robotics API website.

In this simple application, you have already used several concepts of the Robotics API: You accessed a Device, used a DeviceInterface of that device and also executed Activities created by that interface. Those concepts will be explained in detail in the next sections.