LBR iiwa - start/resume application by gesture control

  • Hello,


    I am new to this forum and hope to obtain some good ideas and suggestions here. I am currently working with a KUKA LBR iiwa and I am learning the ropes of operating and programming the robot. I already use the manual to look up information and examples :icon_smile:.


    I would like to program the following program sequence:
    The robot should detect a collision (e.g. hand) and stop. Then the application should be resumed by a gesture.


    This is what I have tried so far:



    In case of collision the method triggerWhen(...) is called and the action is programmed in onTriggerFired(…).
    The problem here is that the paused motion can only be resumed via the Start key on the smartPAD. I would like to resume the application by gesture control (see Video 1). Another questions is how can the application be started in general by a gesture (see video 2)?


    1) https://youtu.be/90sS-sxEZm8?t=2m45s at 2:45
    2) https://youtu.be/sJBgEk96igk?t=20s at 0:20



    Thanks and regards
    robotneuling

  • Hi,


    Here are the steps:
    - Start your motion:
    - Use "Breakwhen" when you detect a force
    - Get into "PosHold" and wait until there's an external force.


    I'd like to post the code, but I don't have time, check the keys words in bold in the doc :winking_face:


    good luck

  • edit2: How can I check if a certain frame ("/Frame_Z2") has been reached in order to terminate the while loop?


    This is what I have programmed so far:



    :merci:



    edit: I think it works now but not perfect :icon_smile:. I'll keep you posted


    Hi kiiwa,


    how do you proceed once you are in positionHold?
    How can the motion be resumed by an external force?


    Thank you!


  • Hi Robotneuling,


    For checking if you have reached a certain Frame (assuming you know the Frame the Robot should reach) you can use Frame1.isCloseTo(Frame2, maxDist, maxRot). You just get the current cartesian Position, save it in Frame1 and save your Destination in Frame2.MaxDist is the Maximum Deviation you want to allow.


    For the second part, what you have should work already, because you just want to terminate the Position hold with a breakWhen(externalForce) like you have. However, I wouldn't execute the PositionHold asynchronous because you want those to be blocking statements and in your case the execution of the program goes on after the Position hold is called.


    Hope this helps, kiwi

  • edit:
    It works now.
    I used moveAsync instead of move ....


    Code
    lbr.moveAsync(positionHold(controlMode, -1, TimeUnit.SECONDS).breakWhen(collision));



    Hi kiwi8,


    thanks for your help.


    I don't get the loop stopped by using "Frame1.isCloseTo(Frame2, maxDist, maxRot)".


    The code:


    Code
    while (true){
    			lbr.move(ptp(getApplicationData().getFrame("/Frame_Z2")).breakWhen(collision));		
    			lbr.move(positionHold(controlMode, 3, TimeUnit.SECONDS));		
    			lbr.move(positionHold(controlMode, -1, TimeUnit.SECONDS).breakWhen(collision));
    
    			Frame Frame1 = lbr.getCurrentCartesianPosition(lbr.getFlange());
    			if (Frame1.isCloseTo(getApplicationData().getFrame("/Frame_Z2"), 2, 2))
    			{ break; }
    		}


    The loop doesn't stop once I have reached the specified frame (/Frame_Z2) ...
    Any idea how to fix this? :hmmm:

  • If you stop a motion by 'breakwhen', you need to handle trivial details to resume the motion because there are several kinds of motions with different parameters.
    But by the following pair of methods you can actually freeze and unfreeze the robot.

    Code
    getApplicationControl().setApplicationOverride(0)
    getApplicationControl().setApplicationOverride(1)
  • Hi greengrape83,


    So you would integrate that pair of methods into the while loop?
    For what reason?
    I haven't really used setApplicationOverride so far that's why I am asking.



    If you stop a motion by 'breakwhen', you need to handle trivial details to resume the motion because there are several kinds of motions with different parameters.
    But by the following pair of methods you can actually freeze and unfreeze the robot.

    Code
    getApplicationControl().setApplicationOverride(0)
    getApplicationControl().setApplicationOverride(1)
  • The 'while' loop is a good idea for the application containing only one motion.
    But I'm not sure it can handle a normal robot application case.
    A normal robot application always contains a set of motions. And collision pause/resume should be applied to most of the motions.


    The following is the way that I have used to handle the similar situation. I wish it be helpful.



    Hi greengrape83,


    So you would integrate that pair of methods into the while loop?
    For what reason?
    I haven't really used setApplicationOverride so far that's why I am asking.

  • Hi,


    I know it's a while ago but I don't get the robot stopped and resumed smoothly.
    I tried to use a collisionObserver as explained by greengrape83.
    I don't get the application resumed once the robot is freezed and the ApplicationOverride stays at 0.
    The robot should detect a collision (e.g. hand) and stop. Then the application should be resumed by a gesture (like in this video:

    External Content youtu.be
    Content embedded from external sources will not be displayed without your consent.
    Through the activation of external content, you agree that personal data may be transferred to third party platforms. We have provided more information on this in our privacy policy.
    at 2:45).


    Any idea how to fix this or is there another way?


    Thank you :merci:.

  • Hi robotneuling,


    I've tested the code snippet on my iiwa.
    The robot motions are frozen when I press on the robot and the motions are resumed when I remove the press.
    Maybe you can provide the task log about your app running for analysis.

  • Hi greengrape83,


    I want to stop/freeze the robot once a collision is detected and the robot should stay in that position [like motion.breakWhen(condition...);].
    The robot should resume its motion as soon as a "new" collision is deteced (e.g. hand gesture like in the video).


    Thank you.



    Hi robotneuling,


    I've tested the code snippet on my iiwa.
    The robot motions are frozen when I press on the robot and the motions are resumed when I remove the press.
    Maybe you can provide the task log about your app running for analysis.

  • It is easy to simply realize the function that first collision to freeze, second to resume, third to freeze... by changing several code lines as following.
    However, if the force wobble and user friendliness is considered, much more is needed to make a precise judgement when collision happens and when resume collision happens.

Advertising from our partners