Universal Robots Forum

Middle points of my linear path using servoj

I have used jerk limited velocity profile for linear path trajectory. for more understandable similar motion graph which is shown below from internet:

With this kind of motion in a while loop I used servoj. My algorithm is shown below:
///////////////////////////////////////////////////////////////////////
myPoses=[pose1,pose2,pose3…poseN]
i=1
while i<N
servoj(get_inverse_kin(poseN),0,0,t=0.08,
lookahead_time=0.03,gain=1170)
end
/////////////////////////////////////////////////////////////////////
With these lookahead_time and gain coefficients, I have reached exactly the end point with adjusting gain to 1170 value but when I watch my middle points in polysope log viewer cannot reach the desired points. Maybe 1 or 2 mm lagging happened. Do I have to change gain and lookahed_time coefficient during path? I could not fix it. I need suggestions.

Hi @mdonmez,

As long as your input is limited on jerk and acceleration. You can reduce the lookahead time and increase the gain to follow the target more aggressively and hopefully minimizing the error. Due to servoj nature it will always be lagging.
If you are testing on the simulator and adjusting to an very aggressive setup. Be aware that the real robot might act with jerk an acceleration peaks.
An alternative is to use speedl or speedj.

Ebbe

1 Like

Thanks @Ebbe
I will try my last attempts with servoj according to your advice after that I will switch my trajectory speedl and speedj functions.