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

Make Component Manager public #1065

Merged
merged 9 commits into from
Apr 16, 2020
Merged

Make Component Manager public #1065

merged 9 commits into from
Apr 16, 2020

Conversation

Karsten1987
Copy link
Contributor

@Karsten1987 Karsten1987 commented Apr 14, 2020

closes #1010

The first commit d81d494 basically just turns the component manager into public API.

The second commit 156ff16 is enhancing the CMake macros for registering nodes with a new option RESOURCE_INDEX to specify under which index the file should be written.

With respect to the upcoming work in ros-control (ros-controls/roadmap#7) that enables to not duplicate the CMake macros to adopt to ros-controls, but simply call the existing rclcpp_components macros with a proper resource index, e.g.:

rclcpp_components_register_node(timers_library
  PLUGIN "demo_nodes_cpp::OneOffTimerNode"
  EXECUTABLE one_off_timer
  RESOURCE_INDEX "some_proper_index")

The controller manager can then look into this exact index to only fetch controllers and no other components.

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987 Karsten1987 marked this pull request as ready for review April 15, 2020 01:36
Copy link
Contributor Author

@Karsten1987 Karsten1987 left a comment

Choose a reason for hiding this comment

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

As I follow up, I would like to modify the ros2component API similarly to take an optional resource index parameter. That way, a ros-control cli could reuse the same API for things like (component types).

set(resource_index ${ARGS_RESOURCE_INDEX})
message(STATUS "Setting component resource index to non-default value ${resource_index}")
endif()

set(component ${ARGS_PLUGIN})
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 didn't want to pollute the changes any further, but I think the two args (PLUGIN and EXECUTABLE) could be checked for empty strings.

Copy link
Member

Choose a reason for hiding this comment

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

Feel free to add it, or we can address it in a follow-up Issue/PR.

Comment on lines 18 to 19
#message(WARNING "registered index: ${resource_index}")
#message(WARNING "content for index: ${_RCLCPP_COMPONENTS_${resource_index}__NODES}")
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'll remove these lines before merging. I let them in for now in case the interested reviewers wants to debug ;-)

Copy link
Member

Choose a reason for hiding this comment

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

Reminder to remove before merging.

@@ -57,31 +62,34 @@ class ComponentManager : public rclcpp::Node
using ComponentResource = std::pair<std::string, std::string>;

ComponentManager(
std::weak_ptr<rclcpp::executor::Executor> executor);
std::weak_ptr<rclcpp::executor::Executor> executor,
std::string node_name = "ComponentManager");
Copy link

Choose a reason for hiding this comment

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

Would it not make sense to have also a constructor that forwards the namespace and node options arguments?

Copy link
Member

Choose a reason for hiding this comment

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

I agree that would probably make sense in this case to make it general purpose.

@mjcarroll
Copy link
Member

It won't let me comment since it's not a changed line, but does it make sense for the component_manager to remain STATIC here: https://github.com/ros2/rclcpp/pull/1065/files#diff-a31ef69821be6f5f4a19e0bf26f36fa1R24

In the case that it is changed to SHARED, I believe that you would also have to add the visibility macros.

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987
Copy link
Contributor Author

First round of CI (build up to demo_nodes_cpp, testing rclcpp_components & demo_nodes_cpp):

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

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

LGTM pending removing commented lines.

set(resource_index ${ARGS_RESOURCE_INDEX})
message(STATUS "Setting component resource index to non-default value ${resource_index}")
endif()

set(component ${ARGS_PLUGIN})
Copy link
Member

Choose a reason for hiding this comment

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

Feel free to add it, or we can address it in a follow-up Issue/PR.

Comment on lines 18 to 19
#message(WARNING "registered index: ${resource_index}")
#message(WARNING "content for index: ${_RCLCPP_COMPONENTS_${resource_index}__NODES}")
Copy link
Member

Choose a reason for hiding this comment

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

Reminder to remove before merging.

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987
Copy link
Contributor Author

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

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987
Copy link
Contributor Author

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

Signed-off-by: Karsten Knese <karsten@openrobotics.org>
@Karsten1987
Copy link
Contributor Author

CI rebuilding up to tf2_ros as it's using the second macro which hasn't been CI'ed before:

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

Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

Looks good. This assumes that the list of targets is always the last set of arguments. It could be switched to a multiValueArg at some point in the future, but I agree with not breaking the CMake "api" right now.

@Karsten1987 Karsten1987 merged commit 50d500e into master Apr 16, 2020
@delete-merged-branch delete-merged-branch bot deleted the public_component_manager branch April 16, 2020 02:08
@nuclearsandwich
Copy link
Member

I've traced four new failed tests in last night's builds to this PR. ros2/build_farmer#272

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.

[rclcpp_components] Make component manager public
4 participants