Skip to content

Conversation

urmahp
Copy link
Contributor

@urmahp urmahp commented Oct 10, 2025

When reconnecting to RTDE it requires you to set the input and output recipes again, this is now done properly.

When reconnecting to RTDE it requires you to set the input and output recipes again, this is now done properly.
@urmahp urmahp requested a review from a team October 10, 2025 04:39
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 42.01183% with 98 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.51%. Comparing base (d68f808) to head (2b1197e).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/rtde/rtde_client.cpp 40.38% 80 Missing and 13 partials ⚠️
include/ur_client_library/comm/producer.h 42.85% 3 Missing and 1 partial ⚠️
src/rtde/rtde_writer.cpp 80.00% 0 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
start_ursim 81.78% <ø> (-1.25%) ⬇️
ur20-latest 74.85% <41.42%> (-0.99%) ⬇️
ur5-3.14.3 74.85% <42.01%> (-1.51%) ⬇️
ur5e-10.7.0 70.18% <41.42%> (-1.61%) ⬇️
ur5e-5.9.4 74.94% <41.42%> (-1.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@urfeex urfeex added the bugfix label Oct 13, 2025
Also fixed  that we can destroy the rtdeClient while reconnecting
@urmahp urmahp requested a review from urfeex October 13, 2025 12:50
Copy link
Member

@urfeex urfeex left a 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.

Comment on lines 136 to 148
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;
}
Copy link
Member

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.

Copy link
Contributor Author

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
Copy link
Member

@urfeex urfeex left a 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

}

bool RTDEClient::negotiateProtocolVersion(const uint16_t protocol_version)
std::pair<bool, uint16_t> RTDEClient::setProtocolVersion()
Copy link
Member

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?

urmahp and others added 3 commits October 16, 2025 11:43
Co-authored-by: Felix Exner <feex@universal-robots.com>
Co-authored-by: Felix Exner <feex@universal-robots.com>
@urfeex urfeex merged commit 173e3c3 into UniversalRobots:master Oct 16, 2025
23 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants