I don't think you can easily bring the robot to home position when the robot is not. You could probably do that by monitoring the robot from ousite and execute a program to move the robot at home position if the robot program is stopped.
However you can move the robot to home position using a if continuous check statement and request the robot to move if the digital input is at True. You can use regular nodes to do that, you don't need to use scripting.
Scripting open more possibility but it is not so easy to debug.
I am working on a program sequence for our UR5e robot. When the program is interrupted or stopped, or after digital input 1 (button for program stop) is activated, the robot should be driven to the safe home position upon activation of digital input 2 (button for home travel).
I have already tried it with URScript and the following code:
URScript program to drive to safe home position after program stop or digital input interruption Define the safe home position home_pose = p[0.1, -0.5, 0.3, -1.57, 0, 0]
Wait for program stop or activation of digital input 1 while True: if not is_program_running() or get_digital_in(1): break sleep(0.1)
Wait for activation of digital input 2 while True: if get_digital_in(2): break sleep(0.1)
Drive to the safe home position movej(home_pose, a=1.2, v=0.25)
However, there is always a syntax error...
Does anyone have any ideas or are there other possibilities?
Thank you very much!