Hi I have made my own HOME position and would like to signal my PLC that the ROBOT is at HOME.
I do not have WORLD ZONE package and wrote the code below.
Code
VAR robtarget pCurrentPosition;
VAR robtarget Differnce;
VAR num val;
GetSysData tCheck\ObjectName:=stToolName;
GetSysData wobjCheck\ObjectName:=stWobjName;
pCurrentPosition:=CRobT(\Tool:=tCheck\WObj:=wobjCheck);
!val :=pCurrentPosition.trans.x;
!val := Round(val\Dec:=2);
IF HOME = pCurrentPosition THEN
SetDO doRobotAtHome,1;
ELSE
SetDO doRobotAtHome,0;
ENDIF
Display More
The issue with the above code is that the current position might have a few decimal places values different then HOME values.
Is there are any other more efficient solution to trigger Signal when robot at HOME Position?