Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • ServoJ command

ServoJ command

Servoj can be used for online realtime control of joint positions.

Last modified on Jan 29, 2025

Created: July 20th, 2021.

Command structure: 

servoj(q, a, v, t=0.002, lookahead_time=0.1, gain=300)

This command and many others can be found on the Script Manual in Download section HERE

 

Servoj can be used for online realtime control of joint positions. The gain parameter works the same way as the P-term of a PID controller, where it adjusts the current position towards the desired (q). The higher the gain, the faster reaction the robot will have. The parameter lookahead_time is used to project the current position forward in time with the current velocity. A low value gives fast reaction, a high value prevents overshoot. 

Note: A high gain or a short lookahead time may cause instability and vibrations. Especially if the target positions are noisy or updated at a low frequency It is preferred to call this function with a new setpoint (q) in each time step

(Thus the default:

t=0.008 for CB3

t=0.002 for e-series)

 

You can combine with the script command get_inverse_kin() to perform servoing based on cartesian positions:

  • q = get_inverse_kin(x)
  • servoj(q, lookahead_time=0.05, gain=500)

In the example "x" is a pose variable with target cartesian positions, received over a socket or RTDE registers.

Example command:

  • servoj([0.0,1.57,-1.57,0,0,3.14], 0, 0, 0.008, 0.1, 300)

Example Parameters:

  • q = [0.0,1.57,-1.57,0,0,3.14] joint angles in radians representing rotations of base, shoulder, elbow, wrist1, wrist2 and wrist3.
  • a = 0 → not used in example
  • v = 0 → not used in example
  • t = 0.008 time where the command is controlling the robot. The function is blocking for time t [S].
  • lookahead time = .1 time [S], range [0.03,0.2] smoothens the trajectory with this lookahead time.
  • gain = 300 proportional gain for following target position, range [100,2000]

 

Several discussions are posted in the UR Forum to support users on any question that it might raise on how to use this command efficiently:

https://forum.universal-robots.com/t/servoj-urscript-abrupt-final-motion/8644

https://forum.universal-robots.com/t/servoj-function/7176

https://forum.universal-robots.com/t/how-to-decrease-error-value-of-servoj/6112

logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy