I'm going to answer this in the context of ur_modern_driver
and universal_robot
, as those are the packages typically used -- right now -- with UR robots.
This is not something that is supported by ur_modern_driver
.
It does only upload a small urscript program when trajectories are actually being executed (this one), and that program does quit when the trajectory is finished (or at least: if you're not using ros_control
), but uploading any program to the controller will automatically shut down whatever was already running.
You could potentially achieve what you are asking by integrating the urscript program ur_modern_driver
uploads when executing trajectories into a larger urscript program but only allow actual robot control when you'd like to, but that is not something that ur_modern_driver
supports out-of-the-box (so would require custom development).
The work currently being done by FZI & UR on a new driver does support the scenario you describe, but that driver hasn't been released yet.