对于ABB机器人,若目标点不可达,则会报错,因此可以使用一个检测功能,测试该点是否可达。下面是函数实现:
FUNC bool IsReachable(robtarget pReach, PERS tooldata ToolReach, PERS wobjdata WobjReach)
! Check if specified robtarget can be reach with given tool and wobj.
!
! Output:
! Return TRUE if given robtarget is reachable with given tool and wobj
! otherwise return FALSE
!
! Parameters:
! pReach - robtarget to be checked, if robot can reach this robtarget
! ToolReach - tooldata to be used for possible movement
! WobjReach - wobjdata to be used for possible movement
VAR bool bReachable;
VAR jointtarget jntReach;
bReachable := TRUE;
jntReach := CalcJointT(pReach, ToolReach\Wobj:=WobjReach);
RETURN bReachable;
ERROR
IF ERRNO = ERR_ROBLIMIT THEN
bReachable := FALSE;
TRYNEXT;
ENDIF
ENDFUNC