I use RTDE python code to communicate with the URsim simulation tool in the VirtualBox
When I send command by command with short pauses - everything goes smoothly
But if I make two minute pause between consecutive rtde_client.send(data_object) - communication fails with the
rtde.py", line 267, in __sendall
self.__sock.sendall(buf)
BrokenPipeError: [Errno 32] Broken pipe
error.
How should I connect to avoid this error?
This may happen due to the receive buffer overflow. RTDE constantly sends data packages and they are stored in the operating system receive buffer (look for a TCP Window size for more information). When the receive buffer is full, the operating system stops receiving new data, and after a while the connection breaks.
One of the possible solutions is to create a separate thread that constantly receives the data in the background and stores it in a local variable. Then this variable is read from the main thread.
1 Like