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