# Servoj Acceleration and Velocity parameters

The script manual says to use servoj(q, a, v, t=0.002, lookahead_time=0.1, gain=300) where a and v are not used at this time. When I use movel and movej, I can set the a,v for motion control. How do I control the robot acceleration and velocity for servoj?

The purpose of the servoj command is to use it when highly dynamic changes to the target position and gain while moving are desired. It is sort of a low level command and can be used to build your own custom move command.

Velocity and Acceleration are not yet implemented but can be calculated if you know your desired path.

@m.birkholz I was wondering if you would have any insight into an issue we are seeing with a servoj. We are building a custom move command and have implemented acceleration and deceleration independently. We are doing this for linear motion where we want to accelerate quickly but may want to decelerate at a different speed. We are calculating the distance traveled from the start of the motion based on the starting speed and acceleration, we are then using a pose interpolation to get the point on the path between the two points where we should be at the end of each time slice, this is working correctly and we are getting back the correct distance from the formula. The issue we are seeing is a pretty large lag in the actual position of the robot. For instance, when using a=1.2, d=1.2 and v=0.25 for a total move distance of 0.25m we should move approximately 0.125 m during the acceleration phase of the move, and then begin slowing down to reach a final speed of 0mm/s at the end of our 25mm travel distance.

What we actually see is a total actual move during the time allotted for acceleration (0.144 s) of only 3-4mm, not the 12.5 mm we expect. Have you ever encountered anything like this. What did you do to correct? I have tried playing with the lookahead time and the gain and neither seem to really make a difference.

Hi @mbush,
your task sounds more likely that speedl should be the right thing to solve this. I‘ve been using servoj for tasks with dynamic target positions on runtime, like a cartesian freedrive function or a weaving algorithm. I‘m currently on vacation and don‘t have any robot available to test with. I‘ll get back to this in january😉

I agree about the speedl, the challenge though is the next step is to add dynamic motion at run time. I’m trying to get the simple case to work correctly before I try to add in the next case. I may have to do some more noodling in the meantime.

Hi, @mbush did you find a solution?

@m.birkholz I did and funny enough we went back to using a movel for now. What we were able to determine is that UR is using the pose_dist to determine how the torch moves so when there is rotation you do not really see the commanded speed in x,y,z translation speed. To get around this we take the ration of the pose_dist and the point_dist and apply that ratio to the speed we want to translate the TCP in and we now get the actual speed that we want at the TCP. For now, that was the simplest solution we could come up with until we have time to spend further on the servoj commands. We were still having issues with the commanded move during each clock cycle being the actual move that was performed.

We did some background thread monitoring of a movel and what we found was that during the first few clock cycles the actual commanded distance covered since the start of the motion was off but after that it matched exactly what our formula was telling us we should have traveled at each time slice.