Could you perform a check at Start of Program? I’m thinking something like below:
Current_Pose:=get_actual_tcp_pose()
Positional_Tolerance:=0.001
Is_Home:=True
i:=0
While(i<6) {
if(norm(Current_Pose[i]-const_Home[i])>Positional_Tolerance)
Is_Home:=False
i:=i+1
}
if(Is_Home=False)
write_output_boolean_register(0,False)
// move Home code here
write_output_boolean_register(0, True)
else()
// Robot is home
write_output_boolean_register(0,True)
I’m not a great coder but I think this might be a decent duct tape and bandaid solution you can try. Note: this is off the top of my head so I’m not 100% sure it will work. You may have to play around with the tolerance variable
There may also already be a URscript function already developed for checking this as in manual mode the program wants to jog you to the start position if you are not already there. The UR dev team might have a better answer or they might be using the distance URscript function between two points to check if the robot is out of start position for the beginning of the program (I guess I could have also used that above as well or compared the joint angles with get_actual_joint_pose() as well, but oh well I’m sure there are several ways to skin this cat).
Anyways sorry for the long post, hope this helps and best of luck!