-
Notifications
You must be signed in to change notification settings - Fork 19
Remove tcp_nodelay and add tcp_quickack in write and read #4
base: master
Are you sure you want to change the base?
Conversation
Acording to http://man7.org/linux/man-pages/man7/tcp.7.html quickack flag is NOT permanent. As discussed in https://stackoverflow.com/questions/7286592/set-tcp-quickack-and-tcp-nodelay tcp_nodelay should not be used. In our usecase the robot did not jump with this fix and a low-latency kernel.
Hello @MaxiMaerz, thank you for your PR. However I do believe you've identified a real issue because the flags aren't being set on the critical reverse URServer connection. Regarding the TCP_NODELAY flag, it has exactly the desired behaviour because the buffer supplied to each write contains a full packet and we want to send it immediately as latency is of utmost importance. Once again, thank you for taking your time to report the issue and proposing a fix. Best regards, Simon |
Hello @Zagitta, sorry the description is just the commit msg. I have to admit, that i just added the TCP_QUICKACK without much checking if it is needed in read or write, and i will check if your solution achieves the same effect. However the TCP_NODELAY Flag has to be unset, while it is active we had major Latency Problems resulting random jitter movements. We tested on a UR 10, 5 and 3. Please check out my second link:
Additional we found, that switching to a low latency kernel can remove the last jitters which occur from time to time. Thank you for your fast response and your great work on this driver, Best, Maxi |
Hello again, Yes I've read what you posted many times but I was under the impression that each packet would be flushed before the next one because there would be 8ms between each, however this assumption is incorrect as the the positions are actually interpolated at 4x rate meaning a new packet every 2ms in which case I definitely can see another packet still being in flight. However if you have time to test the effects of the two flags I have added the small python script I used to log the jitter in my thesis called "test_jitter.py" to the root of the quickack branch. However I believe you're right about TCP_NODELAY and for now have disabled it for TrajectoryFollower on the quickack branch. Thank you for your kind words, I'm just happy to see my code being used in the wild. |
Hello @Zagitta, @MaxiMaerz, I just tested the PR and the quickack branch on our UR5 with kernel versions 4.10.0-28-generic and 4.4.0.97-lowlatency. With enabled TCP_NODELAY and QUICKACK (on every connection like in the quickack branch/PR) jitter is almost non existent. Again the low latency kernel has a small advantage in this configuration. I'm not sure why our results are so different from those of @MaxiMaerz but I assume it might be related to the system or maybe the firmware version of the robot. |
@henhenhen Thank you for taking the time to test both this PR and the quickack branch. I'm by no means a network expert and honestly on quite deep water here but it seems very strange the two of you would get such vastly different results. @henhenhen did you record the jitter using the "test_jitter.py" script I provided? If so are you able to share the data? Because I'm a bit curious and would like to see how the jitter compares to the tests I did for my thesis. |
Hey @henhenhen @Zagitta, Just for our setup: Can you make the Flags as rosparams? I will test as soon as possible using your tool. I assume it depends on the complete configuration (interface and firmware on both sides), However we once had a Robot with Controller Version < 3 which did not jitter with the original settings of the driver, unfortunately i have no access to a old controller anymore. |
Hey sorry, I've been rather busy with work+life recently and honestly forgot to get back to you. |
We've tested that ranch and it seems that it improves the situation quite a bit. I think @Zagitta you can safely merge the changes :). I have videos showing the differences and I will share it if I got the approval from the company mangement. We have no more fast and dangerous "catching up" with high speed which we experienced with the original ur_modern_driver version. However even with low-latency host kernel we still have some occasionals slow-downs (never full stops) of the arm during move-it generated position-controlled move. We are going to explore it a bit more and invest some engineering effort in improving position tracking - after looking at the code and architecture, we have some ideas on how the whole positional tracking can be improved. I will open a separate issue for that - I do not want to hijack that issue for it. UPDATE: I see that I cannot open an issue for this fork, so I will open it in the original ur_modern_driver. |
Acording to http://man7.org/linux/man-pages/man7/tcp.7.html
quickack flag is NOT permanent.
As discussed in https://stackoverflow.com/questions/7286592/set-tcp-quickack-and-tcp-nodelay
tcp_nodelay should not be used.
In our usecase the robot did not jump with this fix and a low-latency
kernel.