Hello,
I am looking to make a routine using RAPID programming to modify the TCP of the robot relative to a known point. The robot is an ABB with an IRC5 controller
We use a stationary pointer to verify the TCP of one of our robot tools. Occasionally after maintenance is done to the tool, the tip is off by a couple millimeters. If the tip is not aligned with the pointer, I would like to jog the robot to realign it, then run a TCP update routine to modify the tooldata so that it aligns with the pointer without changing the original robtarget.
I am using the CRobT function with a variable robtarget to get the new robot position and subtracting the pos data from the original point to get the difference. To get the orient data, I am converting to Euler angles and doing the subtraction, then converting back to quaternion. I am having an issue when it comes to modifying the data of the tool. The data in the robtargets are relative to the work object. Is there a way that the calculated difference can be aligned robot tool? Or a way to align the tooldata and wobjdata? I have tried using PoseMult, but didn't get the results that I am looking for. PoseMult is a new function for me, so I may not have been using it correctly
Here is my code for a better description:
!Tip position. Made with tool0 and wObj0 for calculation purposes
MoveJ pTCPcheck10, v50, fine, tool0\WObj:=wobj0;
!This is a separate routine. The above is to show the point for calculation
PROC rUpdateTCP()
CalculationPoint:=CRobT(\Tool:=tool0,\WObj:=wobj0);
!Convert from quaternions to Euler angles
Check_Anglex:=EulerZYX(\X,pTCPcheck10.rot);
Check_Angley:=EulerZYX(\Y,pTCPcheck10.rot);
Check_Anglez:=EulerZYX(\Z,pTCPcheck10.rot);
Calc_Anglex:=EulerZYX(\X,CalculationPoint.rot);
Calc_Angley:=EulerZYX(\Y,CalculationPoint.rot);
Calc_Anglez:=EulerZYX(\Z,CalculationPoint.rot);
!Calculate Angle Difference
AngleDifferencex:=Calc_Anglex-Check_Anglex;
AngleDifferencey:=Calc_Angley-Check_Angley;
AngleDifferencez:=Calc_Anglez-Check_Anglez;
!Calculate position difference
Xdiff:=CalculationPoint.trans.x-pTCPcheck10.trans.x;
Ydiff:=CalculationPoint.trans.y-pTCPcheck10.trans.y;
Zdiff:=CalculationPoint.trans.z-pTCPcheck10.trans.z;
!Calculate Tool Euler Angles
ToolAnglex:=EulerZYX(\X,tMyTool.tframe.rot);
ToolAngley:=EulerZYX(\Y,tMyTool.tframe.rot);
ToolAnglez:=EulerZYX(\Z,tMyTool.tframe.rot);
!Apply angle difference to the tool
UpdatedToolAnglex:=ToolAnglex-AngleDifferencex;
UpdatedToolAngley:=ToolAngley-AngleDifferencey;
UpdatedToolAnglez:=ToolAnglez-AngleDifferencez;
!Make pose out of the difference for frame manipulation
pose_FrameDifference.trans.x:=XDiff;
pose_FrameDifference.trans.y:=YDiff;
pose_FrameDifference.trans.z:=ZDiff;
pose_FrameDifference.rot:=OrientZYX(AngleDifferencez,AngleDifferencey,AngleDifferencex);
!attempted, but did not work
!tMyToolUpdated.tframe:=PoseMult(tMyTool.tframe,pose_FrameDifference);
!Convert Euler angles to quaternions and change the data in the updated tool
tMyToolUpdated.tframe.rot:=OrientZYX(UpdatedToolAnglez,UpdatedToolAngley,UpdatedToolAnglex);
tMyToolUpdated.tframe.trans:=tMyTool.tframe.trans+pose_FrameDifference.trans;
!Copy the load data of the tool
tMyToolUpdated.tload:=tMyTool.tload;
ENDPROC