Movej in a loop within a URScript crashes robot control box requiring restart

Recently ran a program that uses movej (the URScript function moveJ, via the script feature) to rotate a wrist of the robot with varying speeds within a loop. It crashed the robot with the message NO CONTROLLER in the bottom left forcing a restart and then asking me to verify that the robot hasn’t changed position since it was last on. As nothing was done to the robot I click confirm and then the robot is able to operate as normal.

For context I used the tips here Rotate single joint from a given position by user input - 16323

and ended up with something along the lines of
mytcp = get_actual_joint_positions()
rotBool = 0
while true:
rotBool = 0.1 + rotBool
mytcp[5] = mytcp[5] + d2r(rotBool)
movej(mytcp,0.5,1,3,0)

(formatting this post is weird but everything after the while true is in the loop)

What in the world just happened and how do we prevent this?

Update to anyone who may come across this also looking to move the joints in a continuous loop, servoJ should be used for online real-time control of the joints, not moveJ.

Regardless, I’m still unsure of why this results in such a severe crash and what the long-term ramifications may be.

  1. Just to confirm, do you understand that get_actual_joint_positions() vs get_actual_tcp_pose() return different values?

  2. According to the script, Ry value keeps getting incremented but until what condition? you may want to use if the robot can reach the requested pose before moving it using is_within_safety_limits(pose, qnear) and

get_inverse_kin_has_solution(pose, qnear,
maxPositionError=1E-10, maxOrientationError=1e-10, tcp="active_
tcp")
  1. Regarding the prompt for you to confirm the robot position, in your case, happened because of the strong force inflicted on the motors.
  1. yes, in this case the goal is to rotate a specific joint… hence it makes more sense to directly increment the joint position of interest rather than get the pose and use inverse kinematics to get the joint positions. The movej script command expects joint positions AFAIK.

  2. I agree I should have a quick check to ensure it is in between ±360 to ensure safety of the joints, in this case the error was triggered while I was nowhere near the joint limits.

I appreciate you double-checking those points though as I’m still a beginner.

With that being said, The wrist was turning pretty slowly and those are the real values I was using so I’m not sure the cobot should have trouble with forces of that nature. I had a talk with the person who wrote the script and they mentioned during testing a warning about the system failing to meet real-time guarantees popped a few times but after dismissing them and adjusting the values it went away. Perhaps it has to do with how frequently I’m sending mvoej? Should be doing something to wait for the next cycle before sending another movej command similar to how in rtde people use waitPeriod?

What robot series / model are you using and what PolyScope version is installed?

the 10e with version 5.9.3. After testing out different approaches we’ve landed on an alternate implementation that doesn’t run into this issue.