Universal Robots Forum

Trajectory planning with joint position, velocity and acceleration data

Hi, I am trying to do a trajectory planning with ur5 robot.
I have already recorded joint position, velocity and acceleration values by moving the robot in freedrive mode.
Does anyone know how I can use the values of joint position, velocities and accelerations of joints which are each 6 dimensional vectors in servoj function (a,v parameters are 1d constant value) …servoj(q, a, v, t=0.008, lookahead time=0.1, gain=300) , so that I can plan a smooth trajectory?

or is there any other function or method I can use for the same?

If you have recorded an array of joint values at 8ms interval you’ll be able to play this back with the servoj command (8ms is not critical, but it’s the default 125Hz update rate of the UR, at least for CB3, i think e-series are higher, anyway it’s probably overkill for a move recorded over freedrive)

What you’d do is first do a movej to the timestep 0, so that you can position the arm in the start position, then iterate over your array by repeatedly sending servoj commands while incrementing the timestep, going through your array, so something like

movej([0,0,0,0,0,0], 0.1, 0.1, 0, 0)
servoj([0.1,0,0,0,0,0], 0.008, 0.1, 300)
servoj([0.2,0,0,0,0,0], 0.008, 0.1, 300)
servoj([0.3,0,0,0,0,0], 0.008, 0.1, 300)
servoj([0.4,0,0,0,0,0], 0.008, 0.1, 300)
servoj(…)
stop()

This works fine for short paths but you’re literally sending 125 commands per seconds so your program length will grow fast above something practical… Then you’d want to move over streaming the joint array over ethernet if you want to have long path recordings.

Hi,
While trying to implement the method you have described, i found that velocity and acceleration parameters cannot be left blank, but all the functions you have specified doesn’t seem to contain velocity or acceleration.
I was hoping to ask if you can give me some clarity into how I can use velocity and acceleration profiling too using servoJ function or some other function.

Hey, true I omitted these, from the script manual these are not implemented yet, so you can leave them to 0 like:

servoj([0.0.0.0.0.0],0,0,0.008,0.1,300)

If you want to use your velocity and acceleration values i guess you’d have to implement your own control loop with speedj. I think the ROS UR driver might allow you to do that already but I’m not knowledgeable enough on that.

Thank you, I will search on these lines.