Universal Robots+

Jogging a single joint using URscript and primary interface

Hi all,
I’m trying to implement some software on a PC that would control a UR5e over the primary interface. I would like to add the ability to “jog” the robot using buttons on the PC as if it were the pendant. I able to use the speedl() command with a return time of 0 in a loop to jog the robot in cartesian coordinates but would now like to jog each individual joint. I assumed that the speedj() command would do this but when I make the return time 0 I do not get any motion at all.
Am I using the right function for this? If I am, is there a reason why the exact same structure would work for speedl() but not speedj()?

I’ve included the two scripts that my PC is sending over. The idea is to continue moving at that speed until I switch a bit over RTDE. As I mentioned, this structure is working with the speedl() but not speedj().

def jog_linear():
while (read_input_boolean_register(64) == True ):

def jog_joint():
while (read_input_boolean_register(64) == True ):


I played around with this some more and found that if I made the return time on the speedj command non-zero it works. I guess there is something different in the way those two are implemented. As a result my linear jog script is like the one I listed above and but my joint jog script has a return time of 0.001 seconds.