Author Topic: FRI changing stiffness in JointImpedanceControlMode  (Read 227 times)

0 Members and 1 Guest are viewing this topic.

Offline g.dechambrier

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
FRI changing stiffness in JointImpedanceControlMode
« on: October 22, 2018, 03:19:29 PM »
I have the following code:

JointImpedanceControlMode ctrlMode = new JointImpedanceControlMode(200, 200, 200, 200, 200, 200, 200);
ctrlMode.setDampingForAllJoints(0.7);

PositionHold posHold = new PositionHold(ctrlMode, -1, null);

while(running){
  lbr.moveAsync(posHold.addMotionOverlay(jointOverlay));
}


I would like to the change the stiffness parameter of the ctrlMode. I have tried to call ctrlMode.setStiffnessForAllJoints() after the lbr.moveAsync with no effect.
I have the feeling that once lbr.moveAsync has been called it is no longer possible to change its parameters. I guess I would have to interrupt the motion somehow and start it again with new stiffness values.

Would anyone know how to interrupter the motion problematically without having to press stop on the smart pad ? Any help is much appreciated.



Offline NullReference

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 10
  • Posts: 59
Re: FRI changing stiffness in JointImpedanceControlMode
« Reply #1 on: October 22, 2018, 07:17:59 PM »
Get the execution service from the controller. The controller object can be obtained via dependency injection. Call the the canceAll() method in the execution service. Don't forget to cast the returned object from the controller, see below
Code: [Select]
SunriseExecutionServcice executionService = (SunriseExecutionServcice)myInjectedController.getExecutionService();
Also, I don't think you have to call moveAsync inside the forever loop, I believe calling it once before the loop is enough.

Offline DrG

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 25
Re: FRI changing stiffness in JointImpedanceControlMode
« Reply #2 on: October 23, 2018, 02:56:07 PM »
Hello G.dechambrier


I would like to the change the stiffness parameter of the ctrlMode. I have tried to call ctrlMode.setStiffnessForAllJoints() after the lbr.moveAsync with no effect.
I have the feeling that once lbr.moveAsync has been called it is no longer possible to change its parameters. I guess I would have to interrupt the motion somehow and start it again with new stiffness values.


You can change the parameters of the Motion to become executed on the Robot ONLY BEFORE calling "move/moveAsync".
After "move/moveAsync" - as you already observed - there is NO consequence on the current Motion execution .


Advice/Comment on your program: Avoid calling moveAsync in an endless Loop without further synchronization. This will lead to uncool side effects.

You could do s.th. like:


JointImpedanceControlMode ctrlMode = new JointImpedanceControlMode(200, 200, 200, 200, 200, 200, 200);
ctrlMode.setDampingForAllJoints(0.7);
PositionHold posHold = new PositionHold(ctrlMode, -1, null);

/* Keep the motionContainer for later cancel */
IMotionContainer motionContainer=lbr.moveAsync(posHold.addMotionOverlay(jointOverlay));

while (running) {
/* Wait on e.g. an external Event to Change the Parameters */
 ctrlMode=blockingWaitOnChangeRequestForStiffnessParameters();
/* Exchange the Parameters on the positionHold Motion Command */
   posHold.setMode();
/* send to the realtime System */
  IMotionContainer motionContainerNew=lbr.moveAsync(posHold.addMotionOverlay(jointOverlay));
/* Kill the old Motion - from that Point on, the new CTRL-Setting is actively executed */
  motionContainer.cancel();
motionContainer=motionContainerNew;
}


DrG

Offline g.dechambrier

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 18
Re: FRI changing stiffness in JointImpedanceControlMode
« Reply #3 on: October 26, 2018, 01:27:50 PM »
Thanks for your help guys.. I can now change both stiffness and damping parameters  (via TCP). Can now easily switch between joint impedance and gravity compensation by change these values.

 :respect: