UniversalRobots / RTDE_Python_Client_Library

RTDE client library and examples
BSD 3-Clause "New" or "Revised" License
100 stars 35 forks source link

is_connected method is not working #11

Closed sri331 closed 11 months ago

sri331 commented 1 year ago

Hi

is_connected() returns a wrong state if no other methods are called on the rtde connection. In below example, it is retuning true. but it is actually disconnected. It is not cross checking with the controller and returning the object state.

I would like to handle issue 6 with a getConnection method which returns existing connection and if it is not available, it will create a new connection.

rtde.connect() time.sleep(11) Print(str(rtde.is_connected()))

michal-milkowski commented 11 months ago

It looks like there is no easy way to tell if socket is connected: https://stackoverflow.com/questions/48024720/python-how-to-check-if-socket-is-still-connected Just catch exception on send or receive