iiwa user keys

  • Hello fellas :hi-bye:,

    I am having trouble with defining user keys.
    I created own function for keys

    now here is the cache,
    If i put this function in background service, and call it from "runCyclic", I can lode code to controller. Background service start automatically (green light) but also stops automatically after approx 1s. It's obvious that service is terminated.
    but if I copy this same code to application and call this function and run it, it somehow WORKS ??? ???
    I'm using workstation 11

    any suggestion what could couse the issue ?

  • AD

  • Cyclic means that the task is started periodically. If the previous task was not finished it will be terminated. This means an endless loop should be run in a normal background task not in a cyclic one.

    Thanks for explanation :yesyesyes:. It makes sense. But it's interesting, that the sample in workstation .pdf doesn't show that....KUKA :stupid:...

  • Can someone please look at what i did here and let me know what i did wrong, somehow i can't get the user defined keys to be published!
    so i added the definition to a function and i'm trying to run it from the background application to make sure it runs all the time and i can access it at any time?

    public class LiveByteBackgroundTask extends RoboticsAPICyclicBackgroundTask
    Controller kUKA_Sunrise_Cabinet_1;

    public void initialize()
    // initialize your task here
    initializeCyclic(5000, 50, TimeUnit.MILLISECONDS, CycleBehavior.BestEffort);

    protected EolIOGroup ioPLC;
    protected AppControlIOGroup ioAppControl;
    protected ObjectFrame BaseFrame;
    protected ObjectFrame ToolFingerTCP;
    protected boolean initialized;
    String lastException = "";
    boolean x = true;

    public void runCyclic()

    if (AppSingleton.getInstance().initialized)
    ioPLC = AppSingleton.getInstance().ioPLC;
    ioAppControl = AppSingleton.getInstance().ioAppControl;
    BaseFrame = AppSingleton.getInstance().BaseFrame;
    ToolFingerTCP = AppSingleton.getInstance().ToolFingerTCP;


    ioPLC.setOut_AtsPositionX((int) Math.round(BaseFrame.transformationTo(ToolFingerTCP).getX()));
    ioPLC.setOut_AtsPositionY((int) Math.round(BaseFrame.transformationTo(ToolFingerTCP).getY()));
    ioPLC.setOut_AtsPositionZ((int) Math.round(BaseFrame.transformationTo(ToolFingerTCP).getZ()));
    catch (Exception ex)
    if (!lastException.equals(ex.getClass().toString()))
    StringWriter errors = new StringWriter();

    ex.printStackTrace(new PrintWriter(errors));
    lastException = ex.getClass().toString();
    while (true)

    private void userkeyss()
    IUserKeyBar functionbar = getApplicationUI().createUserKeyBar("funcbuttons");

    IUserKeyListener clickfuncbuttonslistener = new IUserKeyListener()
    public void onKeyEvent(IUserKey key, UserKeyEvent event)
    // TODO Auto-generated method stub
    //key.setLED(UserKeyAlignment.BottomMiddle, UserKeyLED.Green, UserKeyLEDSize.Small);
    if (event == UserKeyEvent.KeyDown)
    key.setText(UserKeyAlignment.TopMiddle, "Test");

    IUserKey key = functionbar.addUserKey(0, clickfuncbuttonslistener, true);
    key.setLED(UserKeyAlignment.BottomMiddle, UserKeyLED.Green, UserKeyLEDSize.Small);


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now