-
Notifications
You must be signed in to change notification settings - Fork 128
Fixed auto reconnection to the RTDE server. #384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When reconnecting to RTDE it requires you to set the input and output recipes again, this is now done properly.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #384 +/- ##
==========================================
- Coverage 78.22% 76.51% -1.72%
==========================================
Files 92 92
Lines 4212 4283 +71
Branches 467 482 +15
==========================================
- Hits 3295 3277 -18
- Misses 680 761 +81
- Partials 237 245 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Also fixed that we can destroy the rtdeClient while reconnecting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a race condition between destroying the RTDE client and the reconnection mechanism. E.g. when the client is destroyed right after reading failed, the reconnection mechanism is still called leaving the program hanging there.
if (stream_.getStreamType() == URStreamType::RTDE) | ||
{ | ||
if (on_rtde_reconnect_cb_) | ||
{ | ||
URCL_LOG_WARN("Failed to read from RTDE stream, invoking on reconnect callback and stopping the producer"); | ||
on_rtde_reconnect_cb_(); | ||
} | ||
else | ||
{ | ||
URCL_LOG_ERROR("Failed to read from RTDE stream without a reconnect handler stopping the producer"); | ||
} | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really like the special handling of an RTDE producer here. Couldn't we generalize this by checking whether there is a reconnection callback registered? If none then we simply do not reconnect and if yes, trigger reconnect independent of the stream type. Sorry that I just come up with this now, but that seems cleaner to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconnecting to the stream, will just not have any affect if it is a RTDE stream, but I will change the check.
Applied suggestions from code review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some nitpicky suggestions left that I can commit mys
src/rtde/rtde_client.cpp
Outdated
} | ||
|
||
bool RTDEClient::negotiateProtocolVersion(const uint16_t protocol_version) | ||
std::pair<bool, uint16_t> RTDEClient::setProtocolVersion() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we are only interested in the boolean return value, so should we reduce the signature to that one?
Co-authored-by: Felix Exner <feex@universal-robots.com>
Co-authored-by: Felix Exner <feex@universal-robots.com>
When reconnecting to RTDE it requires you to set the input and output recipes again, this is now done properly.