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

add use_global_arguments for node options of component nodes #1776

Merged
merged 2 commits into from
Jan 19, 2022
Merged

add use_global_arguments for node options of component nodes #1776

merged 2 commits into from
Jan 19, 2022

Conversation

gezp
Copy link
Contributor

@gezp gezp commented Sep 16, 2021

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 setting false)

.use_global_arguments(false)

according to @wjwwood opinion( #978 (comment) ), allow_undeclared_parameters and use_global_arguments shouldn't be a parameter, but the use_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)

Copy link
Collaborator

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

Copy link
Collaborator

@SteveMacenski SteveMacenski left a 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?

@fujitatomoya
Copy link
Collaborator

@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.

Copy link
Collaborator

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

Copy link
Contributor

@hidmic hidmic left a 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") {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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
Copy link
Contributor Author

gezp commented Oct 14, 2021

i add some test for use_global_arguments , please review again. @fujitatomoya @hidmic

@SteveMacenski
Copy link
Collaborator

Any update?

@fujitatomoya
Copy link
Collaborator

I am good to go, https://github.com/ros2/rclcpp/pull/1776/files#r722910471 also makes sense though.

@fujitatomoya
Copy link
Collaborator

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@SteveMacenski
Copy link
Collaborator

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;

@gezp
Copy link
Contributor Author

gezp commented Oct 29, 2021

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>
@ros-discourse
Copy link

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

@SteveMacenski
Copy link
Collaborator

@fujitatomoya @hidmic can we run CI again to merge it?

@fujitatomoya
Copy link
Collaborator

CI retry:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ros-discourse
Copy link

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

Copy link
Contributor

@hidmic hidmic left a 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);
Copy link
Contributor

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.

Copy link
Contributor Author

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") {
Copy link
Contributor

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.

@SteveMacenski
Copy link
Collaborator

@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>
@SteveMacenski
Copy link
Collaborator

SteveMacenski commented Dec 16, 2021

@hidmic is this ready to review again?

@hidmic
Copy link
Contributor

hidmic commented Jan 12, 2022

@hidmic is this ready to review again?

Argh. This fell through the cracks again. Sorry about that.


Last CI (hopefully):

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@hidmic
Copy link
Contributor

hidmic commented Jan 19, 2022

Alright, going in.

@hidmic hidmic merged commit bca3fd7 into ros2:master Jan 19, 2022
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.

5 participants