Skip to content

Improve socket connection robustness in external_control.urscript#453

Open
srvald wants to merge 9 commits intoUniversalRobots:masterfrom
srvald:socket_improvement
Open

Improve socket connection robustness in external_control.urscript#453
srvald wants to merge 9 commits intoUniversalRobots:masterfrom
srvald:socket_improvement

Conversation

@srvald
Copy link
Contributor

@srvald srvald commented Mar 3, 2026

Summary
This PR strengthens the socket connection logic in external_control.urscript to make driver startup more reliable and fault‑tolerant.
Issue related: #439

What’s changed

Added a connect_socket_with_retry() helper with configurable attempts and delay.
Enforced the required connection order:

  • trajectory_socket
  • script_command_socket
  • reverse_socket (must be last)

Implemented a loop that retries only the sockets that are not yet connected (no redundant reconnects).
Added a popup notification when any connection attempt fails.

Why

Ensures stable behavior during driver startup under transient network conditions.
Avoids unnecessary reconnection attempts once a socket is successfully established.
Avoids the program to run although the sockets haven't been connected.

Testing
Manual tests were performed using netcat to simulate the three server endpoints:

  • When the first socket fails to connect after 5 attempts, a popup appears as expected.
  • Selecting Stop program terminates the script cleanly.
  • Selecting Continue, then enabling the first socket via netcat, results in a successful connection.
  • Upon the second popup (second socket still down), enabling that socket confirms the code does not attempt to - reconnect the already‑connected first socket.
  • After enabling all three sockets, the loop exits as intended and the script prints the success messages indicating all sockets are connected.

Notes

The logic explicitly prevents reverse control from opening before the other two sockets are established.
Popup messaging provides clear operator feedback without spamming unnecessary retries.


Note

Low Risk
The provided diff contains no code changes, so there is no functional or security risk. Verify the PR includes the intended commit(s) before merging.

Overview
This PR appears to be a no-op: the provided git diff is empty (shows only +++ /dev/null).

If the intent was to improve socket connection robustness in external_control.urscript, the expected changes are not present in this diff and should be rechecked before review/merge.

Written by Cursor Bugbot for commit 59db585. This will update automatically on new commits. Configure here.

Sergi Romero Valderas and others added 9 commits February 25, 2026 16:33
More documented error popup depending on the socket failing

Co-authored-by: Felix Exner <feex@universal-robots.com>
Remove textmsg as external control active message will appear after sockets have been connected successfully

Co-authored-by: Felix Exner <feex@universal-robots.com>
This way we avoid getting into a situation where things might restart while attempting to connect to one of the sockets.
@cursor
Copy link

cursor bot commented Mar 3, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 20.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@urfeex urfeex linked an issue Mar 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

External Control program doesn't fail if opening the sockets fail

2 participants