UniversalRobots / Universal_Robots_Client_Library

A C++ library for accessing the UR interfaces that facilitate the use of UR robotic manipulators by external applications.
Apache License 2.0
117 stars 88 forks source link

reconnect the robot after connection dropped down. #156

Open ZhengHaichao opened 1 year ago

ZhengHaichao commented 1 year ago

Hi Team,

A OEM customer is using this library in their product, a disconnection issue affects their development, so a method of reconnecting the robot is needed.

They are using the method in example/full_driver.cpp to create the connection, but when the connection dropped down, how to reconnect the robot in another thread? without closing their main program.

Thanks.

fmauch commented 1 year ago

If the connection is dropped, this is usually due to a non-realtime communication between the control pc and the robot controller. Our current suggestion is to use a real-time-patched kernel or at least a lowlatency kernel on the control pc side and a dedicated network connection (direct cable between the control pc and the robot controller, no switch).

We plan to release a version with options for a less restrictive communication requirements, but for now a stable and steady communication is required.

Depending on the use case you can also drop the requirements manually, by calling setKeepaliveCount(5) on the driver object, as recently updated in the example:

https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/57c1a6a4bca78c36ac652b6d3bf43dd56fb38862/examples/full_driver.cpp#L113-L114

However, this has the side effect that the robot will extrapolate on its own, when no updates from the pc side come in. So, when relying on setpoint streaming, this is not recommended.

Kellen2021 commented 1 year ago

If the connection is dropped, this is usually due to a non-realtime communication between the control pc and the robot controller. Our current suggestion is to use a real-time-patched kernel or at least a lowlatency kernel on the control pc side and a dedicated network connection (direct cable between the control pc and the robot controller, no switch).

We plan to release a version with options for a less restrictive communication requirements, but for now a stable and steady communication is required.

Depending on the use case you can also drop the requirements manually, by calling setKeepaliveCount(5) on the driver object, as recently updated in the example:

https://github.com/UniversalRobots/Universal_Robots_Client_Library/blob/57c1a6a4bca78c36ac652b6d3bf43dd56fb38862/examples/full_driver.cpp#L113-L114

However, this has the side effect that the robot will extrapolate on its own, when no updates from the pc side come in. So, when relying on setpoint streaming, this is not recommended.

Hello, I have used this library in my software, but I am experiencing a remote connection disconnect issue. The specific error is as follows: Failed to read from stream, reconnecting in 32 seconds.... Is it possible to achieve a reconnection without restarting the software using this library? I noticed that the DashboardClient class has connect and disconnect methods. Can reconnection for communication on other ports be achieved using a similar approach?

fmauch commented 1 year ago

Automatic re-connection is partly built-in and is on our schedule, but not at highest priority at the moment.