-
Notifications
You must be signed in to change notification settings - Fork 427
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
add use_global_arguments for node options of component nodes #1776
Conversation
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 think this extension makes sense for use case of ComponentManager
.
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.
@fujitatomoya any other changes required?
@ivanpauno @hidmic @wjwwood there's been discussion on this via #978, what would you think? i think extending this option makes sense for user application. |
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.
im good to go.
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.
@gezp I'm onboard with this change. This patch is missing a test though.
@@ -160,6 +160,18 @@ ComponentManager::create_node_options(const std::shared_ptr<LoadNode::Request> r | |||
"Extra component argument 'use_intra_process_comms' must be a boolean"); | |||
} | |||
options.use_intra_process_comms(extra_argument.get_value<bool>()); | |||
} else if (extra_argument.get_name() == "use_global_arguments") { |
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.
@gezp meta: thinking about your use case, I wonder if it would make sense for the component_manager
node to expose, e.g. as a parameter, the default value of use_global_arguments
for the nodes it composes. Seems convenient if you're already passing a large parameter file to it.
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 agree with you, for my use case (use a large parameter file for all components), it seems better to use a parameter of component_manager
to configure all components use_global_arguments
, which we needn't set this for components one by one in launch file.
I'm not good at naming parameter, could you give me some suggestions ? @hidmic . how about use_global_arguments
(i think it's bad, because it seems that we set component_manager
nodes to use global arguments, but we want to set this for components) or component_use_global_arguments
?
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.
@gezp perhaps forward_global_arguments
? I'm not very creative either. At any rate, I won't block this patch on it.
i add some test for |
Any update? |
I am good to go, https://github.com/ros2/rclcpp/pull/1776/files#r722910471 also makes sense though. |
Build failure seems unrelated
|
23:55:16 /home/jenkins-agent/workspace/ci_linux/ws/src/ros2/rclcpp/rclcpp_lifecycle/include/rclcpp_lifecycle/state.hpp:25:16: error: using typedef-name ‘rcl_lifecycle_state_t’ after ‘struct’
23:55:16 25 | typedef struct rcl_lifecycle_state_t rcl_lifecycle_state_t; this issue was solved by #1788. i think i need rebase. |
Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com> keep use_global_arguments false default Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com> update warning message Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com> update warnning message Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com> add test Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com>
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2021-10-28/22947/1 |
@fujitatomoya @hidmic can we run CI again to merge it? |
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/ros-2-tsc-meeting-minutes-2021-11-18/23209/1 |
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.
Sorry for the delay (I was out for some time).
Overall makes sense to me. Tests could use some improvement though.
EXPECT_EQ(result->error_message, ""); | ||
std::cout << result->full_node_name << std::endl; | ||
EXPECT_EQ(result->full_node_name, "/test_component_global_arguments"); | ||
EXPECT_EQ(result->unique_id, 7u); |
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.
@gezp nit: this tests that the manager did not fail but not that it did anything about use_global_arguments
.
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.
yes, use_global_arguments
is set true in NodeOption
, but this component didn't use any global arguments, i don't know how to test for this.
@@ -160,6 +160,18 @@ ComponentManager::create_node_options(const std::shared_ptr<LoadNode::Request> r | |||
"Extra component argument 'use_intra_process_comms' must be a boolean"); | |||
} | |||
options.use_intra_process_comms(extra_argument.get_value<bool>()); | |||
} else if (extra_argument.get_name() == "use_global_arguments") { |
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.
@gezp perhaps forward_global_arguments
? I'm not very creative either. At any rate, I won't block this patch on it.
@gezp can you make the testing related changes so we can get this merged in and get dynamic composition in Nav2? 🥳 |
Signed-off-by: zhenpeng ge <zhenpeng.ge@qq.com>
@hidmic is this ready to review again? |
Argh. This fell through the cracks again. Sorry about that. Last CI (hopefully): |
Alright, going in. |
Signed-off-by: zhenpeng ge zhenpeng.ge@qq.com
related to #978.
i'm trying to implement composed bringup for Nav2, but it can't work as expected. the reason is that internal nodes (like
local_costmap
,global_costmap
) in Nav2 couldn't load parameters from param's file(use_global_arguments
is settingfalse
)rclcpp/rclcpp_components/src/component_manager.cpp
Line 164 in f30329f
according to @wjwwood opinion( #978 (comment) ),
allow_undeclared_parameters
anduse_global_arguments
shouldn't be a parameter, but theuse_global_arguments
does have a legitimate use case here (for Nav2), and i think it's useful when we have a large params file to configure all nodes (or component nodes).use_global_arguments = true
is default behavior for all other situations so its strange that we cannot set it to true at all due to "its generally bad" advise for the component container. It creates a situations where component container nodes have a different behavior from everywhere else and it silently fails if a user is clever enough to know that that is the problem.I still offer a warning to tell people not to do it but gives the flexibility to get the behavior that is expected every where else from the component container if explicitly called out in the extra parameters.
some extra details here: #978 (comment)