DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
kay

For remote control or visual servo application, I’d like to stream the target position every 10-50 milliseconds from my Linux PC, and each update would only change the destination around 1-100 millimeter. By doing this, I’d like to create a smooth motion. I want to realize both in Cartesian space control and in Joint space control, but let’s discuss Cartesian space first.

My problem is that the robot movement is very jittery. I’m using RTDE (real-time data exchange) and running the same urp file which you can find here: https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/real-time-data-exchange-rtde-guide-22229/
The motion I tried to create was simple: just moving up 200 millimeters toward +Z direction, then moving down 200 millimeters toward -Z direction. I was sending the target update (absolute target position in robot’s Base Frame) every 50 msec, and I was changing 10 millimeters for every update. However, the movement was very jittery or the repetition of small “start and stop” movement. The original urp file uses “MoveL” command, so I tried to tune the parameters (by changing from “Stop at this point” to “Blend with radius”), but it didn’t work. 

When I implemented the similar functionality on ABB, I could use EGM (Externally Guided Motion), which you can stream the point, and the robot follows the point it gets every update. Alternatively, when I implemented for DensoWave or Mitsubishi, I could use “Cancel” or “Skip” command for each “Move” command to override the old target. I’m wondering if there are any commands/options that I can use for Universal Robots.

Are there any ways/commands to realize above smooth real-time target-update movement?

kay

HI @matthewd92, thank you so much for your comment. I modified the code so that it wouldn't stop the execution with each update. For movel, I was using the default linear speed (=250mm/s). 

I started to experiment with servo commands. There are two servo commands available as UR API: servoc (not servol) for cartesian control and servoj for joint control. Weirdly, `servoc` doesn't have arguments like `lookahead_time` and `gain`, so it's very similar to general `movel` or `movec` commands. Here are those definitions:

  • servoc(pose, a=1.2, v=0.25, r=0) 

  • servoj(q, a, v, t=0.008, lookahead_time=0.1, gain=300) 

After I looked the past discussion in the forum, I thought there are two ways to work on this: 1. to use `servoc(target_pose_in_base_frame)` and 2. to use `servoj(get_inverse_kin(target_pose_in_base_frame))`. I quickly tried both. I sent the target update every 8msec and tried the delta size both 1-2mm and 0.1-0.5mm as you suggested.

When tried 1. to use `servoc(target_pose_in_base_frame)`, the movement was smooth, but when the robot got the point to change the direction of the movement (e.g. +z to -z direction), the robot stopped because of the safety limit. I think the reason for this is because I was using the default acceleration and velocity. I'll probably need to change acceleration and velocity dynamically, but if you know the good way to handle this, please let me know.

When tried 2. to use `servoj(get_inverse_kin(target_pose_in_base_frame))`, I didn't see any safety stop, but I noticed that the robot was always vibrating, which created the noise. I lowered the gain to 100 (min limit) and increased the lookahead_time to 0.2 (max limit), which relieved the symptom, but I still see this jittering issue. 

If you have a recommendation which way to proceed or how to improve the issues I wrote above, please let me know. 

Fadi_Raid

Br0t said:
Hoi guys, i had the same problem for quite some time and solved it by uploading a program to the robot and sending new poses via RTDE. Here's the github: https://github.com/Mandelbr0t/UniversalRobot-RealtimeControl

Hi , I am trying to control UR5 robot in real-time. I am sending servoj commands to port 30003 RTDE using the default setup and the robot freezes after the first movement.

Can you please guide me on how to use the program you provided in the link and upload it to the robot?



Fadi_Raid

Are you using port 30003 or 30004?  30003 is not the RTDE port. 
Hi Matthew, thanks for the reply

Yes my bad it is not RTDE it is port 30003 real-time. Now the robot moves from point to point but the movement is still jittery. 
I heard of the of ROS driver here that can be installed into the robot to make the movement smooth, yet I don't know how to install it. 

Following this discussion here it is mentioned that it can be used to make the movement smoother when sending position in real-time and you can use Python or C without getting into ROS completely.

I am using an old UR5 with CB2 running 1.8.4035.

Fadi_Raid

Br0t said:

@Fadi_Raid have you checked the comments here https://github.com/Mandelbr0t/UniversalRobot-Realtime-Control/blob/f86136e321fac6921f6876ad0141dc9ef597c226/URBasic/urScriptExt.py#L340
Im not sure which port is the correct one and you might have to update the code to the UR Firmware version you are using. But im sure that if you manage to upload the program and send new inputs to the input registers the code should work. Servoj gave me the same problem you are describing.
First call init_realtime_control (upload the UR program) and then call set_realtime_pose (update the registers for each pose) repeatedly.
The code is tested with UR5 and Firmware 3.2 and 3.4.

Good Luck!







Thanks for replying.
I am using C++ since I am controlling the robot using stereo camera and C++ offers better performance. Can I use this library while sending socket commands in C++?
I managed to get better results by having 2 threads one for capturing and other for sending instructions to the robot. However, a slight jitter is still there. I would like to try you library but I am still unaware on how to load it into the robot. My firmware is quite old, version 1.8.25319.

Thank you again