Smooth TCP motion and remove jerkiness

I’m programming UR3e to perform stirring/rinsing motions. For path, I have a script to generate movel waypoints. Inside script, I have a loop where I increment circular radius, sway distance, tilt angle, and Z amplitude to generate desired trajectory using movel waypoints. I have no issues with the trajectory, however the robot TCP motion is very jerky. It feels like a stop n go kind of motion. At high acceleration, I can feel the vibrations on the base plate.

What can I do to smoothen this motion? I’m trying to mimic the fluidity of human hands performing stirring/rinsing motions. I have tried reducing acceleration, reduce blend radius in movel, and reduce angle increment but it hasn’t helped. I’d appreciate any advice if there’s a different script directory command that can help me achieve this or any other method. Thanks!

Here’s the script:

def function():

center = get_actual_tcp_pose() # start pose
radius = 0.01 # circle radius in meters
v_circ = 0.15 * 2 # speed (m/s) during circles
a_circ = 1.2 * 2 # accel for circle motions

z_amp = 0.01 * 7 # vertical oscillation amplitude (m)
tilt_amp = 0.18 # radians (~10.3°) max tilt (X/Y axes)
sway_amp = 0.012 # side-to-side sway amplitude (m)
tilt_z_amp = 3.14159/2 # radians (±90°) tilt around Z
duration_s = 30 # time duration for process

t_start = time().sec
while ((time().sec - t_start) < duration_s):

angle = 0
while (angle < 6.28):   # loop through 0 → 2π

  # vertical up/down oscillation
  z_offset = z_amp * sin(angle)
  
  # side-to-side sway added to X path
  dx = radius*cos(angle) + sway_amp*sin(2*angle)
  dy = radius*sin(angle)

  # small tilt oscillations
  tilt_x = tilt_amp * sin(angle)   # around X-axis
  tilt_y = tilt_amp * cos(angle)   # around Y-axis
  tilt_z = tilt_z_amp * sin(angle) # around Z-axis, swings ±90°

  # build pose offset
  offset = p[dx, dy, z_offset, tilt_x, tilt_y, tilt_z]
  target = pose_trans(center, offset)

  movel(target, a=a_circ, v=v_circ, r=0.001)
  angle = angle + 0.3

  # Stop if total time exceeded mid-loop
  if ((time().sec - t_start) >= duration_s):
    break
  end
end

end

stopl(2.0)

end

1 Like

Hello,

Which version of Polyscope are you using?
In the latest versions, the OptiMove function allows (in certain cases and depending on the parameters entered) for smoother movements and reduced jerkiness.