Universal Robots Forum

Servoj trajectory following RTDE

Hi,
I made a script using Python that calculate trajectory between two points:
p_start = [-0.4470, -0.3102, 0.3025, -0.0574, -3.1340, -0.0071]
p_desired = [-0.3353, -0.5233, 0.1373, -0.0574, -3.1340, -0.0071]

The trajectory supposes to bring the robot from one point to another within 5 seconds.
I collect points that create the trajectory and save it in CSV file, and I obtained in this case 277739 points, so it’s much more than if i would have sampled it to calculate points every 0.002 sec, in my case I sample the trajectory every 0.000018 seconds.

I then send the points (converted to joint values) to the Polyscope and use servoj(joints), but the robot doesn’t move. The code keeps running but the robot is not following the desired trajectory.

  1. Should I use sync() after servoj()? (with or without it, it doesn’t work, but it would be good to know for the future)
  2. When collecting the data points for a trajectory is it ok to collect them more often than every 0.002 sec? (like I did)

Here is polyscope scope (code written based on @dalvarez concept, so credit for him :slight_smile: )

Any help will be much appreciated @Ebbe @ajp

Sampling trajectory closer to 0.002 per time step solved the problem,
I am wondering though, why when I uncomment sync() under servoj() command it will cause violation?

Also, anyone knows if I can customize the popup message somehow?

From my experience, telling the main thread to give up it’s thread time with sync() after a servoj causes really jerky motion. servoj usually needs to be decelerated with a stopj or stopl after it’s last call as well.

Also, how smooth does this code run? Apparently RTDE updates at 125Hz and servoj’s default ‘t’ value is 8ms between points which puts it right at 125Hz. Just curious, have never tried that.

Also, have you played with custom popups yet?
You can also send the popup command over the dashboard to the robot if it’s on your network. Makes a good prank for your colleagues.

From my experience, telling the main thread to give up its thread time with sync() after a servoj causes really jerky motion. servoj usually needs to be decelerated with a stopj or stopl after its last call as well

In my case there is no need for deceleration because I used min-jerk trajectory when designing the path, therefore it takes care of acceleration at the beginning and deceleration at the end.

Also, how smooth does this code run? Apparently RTDE updates at 125Hz and servoj’s default ‘t’ value is 8ms between points which puts it right at 125Hz. Just curious, have never tried that.

After sampling the trajectory every 0.002 sec I got perfectly smooth motion. I changed in the rtde script the frequency of update to 500HZ and therefore the 0.002 i.e. 500HZ works

Also, have you played with custom popups yet?
You can also send the popup command over the dashboard to the robot if it’s on your network. Makes a good prank for your colleagues

Thanks a lot, will try that.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.