How to pause and resume an movement?

I have a UR5. The UR5 talks to a PLC.
The PLC will send a command when obstacle is in UR5’s way.
What I want is to stop the UR5 smoothly when an obstacle signal is received by UR5 and then UR5 resume the movement after obstacle signal is gone.

I tried to use a thread to create a stop motion. The robot stopped but cannot resume. It gave out an error because another thread was controlling the robot.

How to solve?

The Boolean input registers can have an “action in program” assigned to them. Assign one of them to “Pause Program”, assign another one to “Start Program”, and then add the logic to your PLC to control these robot inputs.

For the start input to work, the robot will need to be in Remote Mode. This can be enabled in the settings via the Hamburger Menu.

If for some reason you absolutely can’t use remote mode, you can put your entire program inside a continuously checked If or Loop statement and use that integer register to execute/leave the If or Loop. I would advise against doing this though as finding the best stopl or stopj deceleration value may be tricky, and you also won’t be able to have other continuously checked If and Loop statements nested inside this main one.

You could try to use RTDE “speed_slider_fraction” input, gradually reducing it 0 and then back up to 1.0.
At 0 robot should pause, and then resume once value is increased.
Robot needs to be in remote mode.