Skip to content
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

Support ROS 2 Easy mode #139

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

Carlosespicur
Copy link

@Carlosespicur Carlosespicur commented Mar 13, 2025

Main Changes

This PR adds support for configuring easy mode in SimpleParticipants through the YAML configuration file using a new ros2-easy-mode tag.
The option is incompatible with the transports configuration, so easy mode is only configured if it is set as default (builtin).

Merge after:

Signed-off-by: Carlosespicur <[email protected]>
Copy link
Contributor

@juanlofer-eprosima juanlofer-eprosima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we decided it would be a good idea to unset sensitive environment variables that may interfere with YAML configurations, which may be done in a generic method that could be implemented here.

@Carlosespicur
Copy link
Author

I believe we decided it would be a good idea to unset sensitive environment variables that may interfere with YAML configurations, which may be done in a generic method that could be implemented here.

Change applied on fee5466

@codecov-commenter
Copy link

codecov-commenter commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 56.00000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 38.00%. Comparing base (efc83a4) to head (56c14fb).

Files with missing lines Patch % Lines
...nts/src/cpp/participant/rtps/SimpleParticipant.cpp 40.00% 0 Missing and 3 partials ⚠️
...aml/include/ddspipe_yaml/testing/generate_yaml.hpp 0.00% 3 Missing ⚠️
ddspipe_participants/src/cpp/utils/utils.cpp 66.66% 1 Missing and 1 partial ⚠️
ddspipe_yaml/src/cpp/YamlReader_participants.cpp 0.00% 2 Missing ⚠️
...ants/src/cpp/participant/dds/CommonParticipant.cpp 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #139      +/-   ##
==========================================
+ Coverage   36.60%   38.00%   +1.40%     
==========================================
  Files         170      153      -17     
  Lines       11567     6986    -4581     
  Branches     5286     2780    -2506     
==========================================
- Hits         4234     2655    -1579     
+ Misses       4586     2938    -1648     
+ Partials     2747     1393    -1354     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

const char* env_vars[] = {
"ROS2_EASY_MODE",
"FASTDDS_ENVIRONMENT_FILE",
"ROS_DISCOVERY_SERVER"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about "ROS_SUPER_CLIENT" and "FASTDDS_BUILTIN_TRANSPORTS"? The first one should be in the list for sure, the other one could be useful though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion we decided not to block "FASTDDS_BUILTIN_TRANSPORTS" just in case we need it in the future.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes applied on f0d98af

@@ -395,6 +395,9 @@ fastdds::dds::DomainParticipantQos CommonParticipant::reckon_participant_qos_()

fastdds::dds::DomainParticipant* CommonParticipant::create_dds_participant_()
{
// Unset environment variables that conflict with YAML configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Unset environment variables that conflict with YAML configuration
// Unset environment variables that conflict with configuration

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add this to the RTPS common participant.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes applied on f0d98af


for (const char* var : env_vars)
{
#ifdef _WIN32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please double check this is the right macro or there is a more generic one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing this, we concluded that it should be the most suitable one. It is coherent with https://stackoverflow.com/questions/2989810/which-cross-platform-preprocessor-defines-win32-or-win32-or-win32

Comment on lines 121 to 143
if (!simple_configuration->easy_mode_ip.empty())
{
// This option is incompatible with transport tag configurations,
// so check that transport is set to the default value (builtin)
if (simple_configuration->transport != core::types::TransportDescriptors::builtin)
{
EPROSIMA_LOG_WARNING(SIMPLEPARTICIPANT,
"Ignoring IP value: Easy mode configuration is incompatible with transport tag configurations.");
}
else
{
// Check if the IP is a valid IPv4 address
if (!fastdds::rtps::IPLocator::isIPv4(simple_configuration->easy_mode_ip))
{
EPROSIMA_LOG_WARNING(SIMPLEPARTICIPANT,
"Ignoring Easy Mode IP value. It must be a valid IPv4 address.");
}
else
{
params.easy_mode_ip = simple_configuration->easy_mode_ip;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this logic to the is_valid method, and perhaps it would be better to fail instead of just printing a warning.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes applied on f0d98af

Signed-off-by: Carlosespicur <[email protected]>
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.

3 participants