arms and hands API examples

ATTENTION!!! When planning arm movements or gesture positions, please pay attention not to hit the robot torso or both hands together. You can make sure that the gesture will not cause a collision by programming only a fraction of the gesture at a time and using slow movements. You should ALWAYS use MovePosition(...) function, which is using trajectory generators. Using direct joint value slot (val) without trajectory generator, motor will achieve the position as fast as it can. You should avoid such situations it may damaged arms or their drive mechanism.

Always start new, NO tested gesture from arms zero-position. If you wan to achieve by left arm following position:

  • q1 = 70 deg.
  • q2 = 75 deg.
  • q3 = 60 deg.
  • q4 = 100 deg.
  • q5 = 0 deg.

in 3s you can use this function:

robot.body.arm[left].hand.MovePosition(3s, 70, 75, 60, 100, 0);

If you are not sure that it is safe position start from small step:

robot.body.arm[left].hand.MovePosition(3s, 20, 20, 20, 20, 0);

then

robot.body.arm[left].hand.MovePosition(3s, 40, 40, 40, 40, 0);

finally

robot.body.arm[left].hand.MovePosition(3s, 70, 75, 60, 100, 0);

 

Adding new gesture

New positions must be added to the Arms.u file as a urbiscript function:

  function m_AMyNewGesture(side,time) {
  {
    if ((side=="left")||(side=="both")) m_APositionL(time, 
      (_Arms_ZeroPositions[0] - 70), 
      (_Arms_ZeroPositions[1] + 75), 
      (_Arms_ZeroPositions[2] + 60), 
      (_Arms_ZeroPositions[3] + 100), 
      (_Arms_ZeroPositions[4] + 0)
    );
  } & {
    if ((side=="right")||(side=="both"))  m_APositionR(time,
      (_Arms_ZeroPositions[5] - 70),
      (_Arms_ZeroPositions[6] + 75),
      (_Arms_ZeroPositions[7] + 60),
      (_Arms_ZeroPositions[8] + 100),
      (_Arms_ZeroPositions[9] + 0)
    );
  };
  }|{};

and to the robot arm structure

    do (robot.body.arm) {       
      function MoveMyNewGesture(time)   {call.m_AMyNewGesture("both",time);};
    };
 
    do (robot.body.arm[left]) { 
      function MoveMyNewGesture(time)   {call.m_AMyNewGesture("left",time);};
    };
 
    do (robot.body.arm[right]) { 
    function MoveMyNewGesture(time)   {call.m_AMyNewGesture("right",time);};
    };

The same rule is for hands.

 

 

EMYS and FLASH are Open Source and distributed according to the GPL v2.0 © Rev. 0.9.1, 15.05.2017

FLASH Documentation