RobotStudio event

Calculate reltool offsets between two points

Hello,

what I'm looking for is some sort of an inverse of the Reltool function.
I want to calculate the pose variables needed for a reltool movement to go from a point pA to a point pB.

For example, if I want to move from a point pA, 5 mm along the X coordinate of the tool i can find the next point with:


pB:=RelTool(pA,5,0,0 \Rx:=0,\Ry:=0,\Rz:=0);


But if I have pA and pB, how can I find the offsets? For example:


PERS pose Offset;

Offset:=myFunc(pA, pB);   ! Offset=[[5,0,0],[1,0,0,0]]


So I can do:

Xrot:=EulerZYX(\X, Offset.rot);
Yrot:=EulerZYX(\Y, Offset.rot);
Zrot:=EulerZYX(\Z, Offset.rot);

MoveL pA,vmax,fine,tool0;

MoveL RelTool(pA, Offset.trans.x, Offset.trans.y, Offset.trans.z \Rx:=Xrot \Ry:=Yrot \Rz:=Zrot),vmax,fine,tool0;


Kind regards,

Francesco

Answers

  • mandolas
    mandolas
    edited October 25
    HI ...
    If I understand correctly, you want to go from one point to another, if it is the same tool (pos:=pA.trans-pB.trans) with a digest tool, for that, the CalcJoint() function can help you with that
    MoveL CalcRobT(CalcJointT(pB,tool1),tool0),vmax,fine,tool0;

    Good job.
  • Hi,

    If I understand the question, try the following:

      FUNC pose myFunc (robtarget pA, robtarget pB)
          var pose poseA;
          var pose poseB;
          VAR pose result;
          
          poseA.trans:=pA.trans;
          poseA.rot:=pA.rot;
          
          poseB.trans:=pB.trans;
          poseB.rot:=pB.rot;
          result:=PoseMult(PoseInv(poseA),poseB);
          
          RETURN result;
      endfunc


    Ted