Universal Robots+

Control robot from gamepad with SpeedJ or ServoJ


I have encountered a problem. If I use the servoj script command and then speedj script command I got polyscope error: “Another thread is controlling the robot”. What is the problem? why can’t I switch from servoj to speedj?

Thanks in Advance,


i never used a switch to speedj from servoj, but a switch to movel,movep and movej. I think the servoj command is not yet completed as you’re switching. Are you using the optional t param of the speedj command? can you show a minimal example of your code?

Yes, that’s right. I have to wait until servoj complete the motion. however I don’t want to wait till the robot stops. for example if I use speedl with specific linear velocity and after that with another speedl command. the arm will complete the first velocity command then stops and after that initiate another velocity command. I want to execute a siries of velocity commands so the arm will execute smooth trajectory. Do you know how can I manage to do that with speedl or any other velocity control method?

Thanks in advance

which velocity command is suitable highly depends on your application. If you want a dynamic change of the motion on runtime, servoj is best. If your path is pre-defined and does not have too narrow waypoint distances, i would recommend using movej with high blend settings. Can you describe your application?

1 Like

I want to control the robot via logitech gamepad with velocity commands in operational space. I have tried speedl, but I must wait until the arm reaches the defined linear velocity and then stop. after that the arm executes the next velocity command. servoj gets a joints input and I want to send velocity commands.

Thanks for the help.


interesting task :slight_smile: i would love to try that too…
you can generate a pose and use servoj with the inverse kinematics of that pose:
I would try generating waypoints depeding on your analog sticks direction and position.

thanks, my problem is that it is not smooth. I can send commands, but it completes the commands one at a time, it makes not a smooth motion. I mean if I give one position commands it stops not smoothly in the end of the motion.

thanks for the support.


what are your servoj parameters and your target position data update cycle?

Hey I have managed to control the arm with gamepad + ros (I will share the code once it will work with ros). However, I need to disable the ros controller first otherwise the controller brings it back to initial position, before the gamepad manipulation. I struggle to disable the controller because once I disable it. the communication drops down.