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 hook to generate node options in ComponentManager #1702

Merged
merged 6 commits into from
Jul 7, 2021

Conversation

rebecca-butler
Copy link
Contributor

@rebecca-butler rebecca-butler commented Jun 25, 2021

This PR adds a new container that creates an instance of the domain bridge on startup. The user must pass in a YAML config file specifying the domain IDs and topics to be bridged.

This PR also adds an extra argument to specify domain IDs when loading in components.

Fixes ros2/domain_bridge#31

Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
@jacobperron
Copy link
Member

I don't see anything wrong in letting users configure the domain ID for individual components; but I'd like someone else to take a look, since I'm not sure if there could be any unintended consequences. The alternative is to only allow this in the domain bridge specific container.

@wjwwood
Copy link
Member

wjwwood commented Jun 25, 2021

I'm not sure it makes sense, because the components are nodes, but the domain id (AFAIK) can only be changed on the context level, as that is where it maps to a participant. @ivanpauno might have more precise input.

Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
@rebecca-butler
Copy link
Contributor Author

rebecca-butler commented Jun 30, 2021

During our offline discussion, it was decided that the functionality for setting the domain ID should not live in rclcpp_components as its use case is specific to the domain bridge. I've added a new component manager class to the domain_bridge package in the linked PR.

I was going to add setters/getters to the existing component manager so the derived class could have its own implementation of OnLoadNode (9f7cedc). After doing this, I realized that the derived class doesn't need to modify most of OnLoadNode, only the part where the node options are set. I thought it might be simpler to have a SetNodeOptions function that the derived class can easily redefine (f28a4eb). This cuts down on code duplication and doesn't require exposing any private members.

Signed-off-by: Rebecca Butler <rebecca@openrobotics.org>
Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM

@rebecca-butler rebecca-butler changed the title Domain bridge container Add hook to generate node options in ComponentManager Jul 6, 2021
@rebecca-butler
Copy link
Contributor Author

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

@rebecca-butler rebecca-butler merged commit dbb717c into master Jul 7, 2021
@rebecca-butler rebecca-butler deleted the domain_bridge_container branch July 7, 2021 12:46
*/
RCLCPP_COMPONENTS_PUBLIC
virtual rclcpp::NodeOptions
CreateNodeOptions(const std::shared_ptr<LoadNode::Request> request);
Copy link
Member

Choose a reason for hiding this comment

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

I missed this when skimming before, but can we please change this to be create_node_options? We don't use CamelCase for methods in core ROS 2 packages like this one.

Copy link
Member

Choose a reason for hiding this comment

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

Well, I just saw that more of these methods (protected ones only) are CamelCase... so I guess this can be left as-is for now... we really need to change them though.

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've opened #1716 to address these style issues.

@@ -131,6 +131,15 @@ class ComponentManager : public rclcpp::Node
create_component_factory(const ComponentResource & resource);

protected:
/// Create node options for loaded component
/*
Copy link
Member

Choose a reason for hiding this comment

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

Also, this should be /**, but this whole file is wrong...

@aprotyas
Copy link
Member

Can this be backported to Foxy without breaking ABI? I suspect not, but correct me if I'm wrong.

@jacobperron
Copy link
Member

@aprotyas I think if we drop the virtual keyword from the new method it would be ABI compliant.

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.

Integrate domain bridge with rclcpp_components
6 participants