Hello,

I’m using *servoj* for online real-time control of joints position, but I can’t reach the desired result.

With Matlab I have generated a path at frequency **F** in order to reproduce a normal *movej* path (

trapezoidal speed profile with the time for acceleration and deceleration equal to 1/3 of the time of the entire move) .

When I pass the points at the *servoj* function,I obtain a different patch, whit different speed and acceleration profile. The last one, in particular, have a lots of peaks.

The result gets better if change the 3 parameters of *servoj*:

1 t=1/**F**,

2 lookahead_time in the range: [0.03,0.2],

3 gain in the range: [100,2000];

as it’s written in the “scriptManual”; but the profiles is still very far from the profiles generated by *movej* function, and the robot does’t reach the final position.

Are there more documentations about *servoj* ?

For example, can I know the best combination of the 3 parameters in order to have good profiles without execute dozens and dozens of test?

Thank you.

hi @guido.saccon,

servoj is targeting to be as close to the joint positions as possible, so the error is only considered at the discrete points in time. In the theory higher *frequency*, lower *lookahead_time* and higher *gain* will reduce that error. But will result in huge acceleration peaks.

In your case it sounds like servoc is a better choice because it will be easier to predict the speed and acceleration. So please take a look at that function. There is a little more description of the functionality here

hi @Ebbe,

*servoc* doesn’t seem to work well with many nearly points.

The movement starts only after seconds and acceleration has peaks near 40 rad/s^2, so the robot with high frequency points goes to emergency stop.

Could you suggest me something else to try?

Thank you.

Hi @guido.saccon,

to “reconstruct” a movej, you need to slice your path in time windows, calculated with the desired joint speed, e.g. 60 deg/s on the fastest joint. as you generate the path with a fixed frequency other than using the robot controller clock (2ms on e-Series) i would suggest to keep the lookahead_time high to smoothen the path. The higher your frequency, the closer the servoj path gets to the movej path, but without using the controller frequency it would never be the same