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 namespace and node name wildcards #1280

Closed
wants to merge 3 commits into from

Conversation

rpaaron
Copy link
Contributor

@rpaaron rpaaron commented Aug 18, 2020

Addresses #1265
I'd like to add tests but adding wildcards to params via arguments returns an error. Alternative is to add a .yml file, but im not sure about adding a filesystem dependency to the tests

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.

besides inline comment, it would be nice to do test with possible combination.

Alternative is to add a .yml file, but im not sure about adding a filesystem dependency to the tests

test_resources_path / "test_parameters.yaml").string();

declare_parameter_with_cli_overrides test uses 'test_parameters.yaml, i think that you can refer to.

rclcpp/src/rclcpp/node_interfaces/node_parameters.cpp Outdated Show resolved Hide resolved
@rpaaron
Copy link
Contributor Author

rpaaron commented Aug 19, 2020

besides inline comment, it would be nice to do test with possible combination.

Alternative is to add a .yml file, but im not sure about adding a filesystem dependency to the tests

test_resources_path / "test_parameters.yaml").string();

declare_parameter_with_cli_overrides test uses 'test_parameters.yaml, i think that you can refer to.

thats great, thank you kindly

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.

LGTM, but like to hear from others about design.

namespace_wild: "namespace_wild"

ns:
"*":
Copy link
Collaborator

@iuhilnehc-ynos iuhilnehc-ynos Aug 28, 2020

Choose a reason for hiding this comment

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

Even if * without double quotes in YAML is invalid, I still think the node wildcards without (") here should be supported, just like the namespace, such as (/*).

ns:
  /*:           # "*" can be also supported, but I think users like this style.
    ros__parameters:
      node_wild_in_ns: "node_wild_in_ns" 

It should be discussed with the maintainer. rcl_yaml_param_parser should be updated if the above suggestion is accepted.

Copy link
Member

Choose a reason for hiding this comment

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

Supporting both /* and "*" makes sense to me 👍

Copy link
Member

Choose a reason for hiding this comment

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

I take back my previous comment. Name tokens separated by a YAML colon (:) should be treated as if they are separated with a slash (/). Therefore, the example:

ns:
  /*:
    ros__parameters:
      ...

Should resolve to the name /ns//*, which is invalid. The correct way to write it would be:

/ns/*:
  ros__parameters:
    ...

@clalancette
Copy link
Contributor

The same comment as #1265 (comment) applies to this PR.

@mabelzhang mabelzhang added the more-information-needed Further information is required label Oct 1, 2020
@mabelzhang
Copy link

@rpaaron Friendly ping. Have you had a chance to look into the design raised in the previous comment?

namespace_wild: "namespace_wild"

ns:
"*":
Copy link
Member

Choose a reason for hiding this comment

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

Supporting both /* and "*" makes sense to me 👍

ros__parameters:
full_wild: "full_wild"

/*:
Copy link
Member

Choose a reason for hiding this comment

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

I think we should have another test case for matching namespaces with multiple tokens. Following the design doc:

  • /* should match exactly one token (e.g. /foo or /bar, but not /foo/bar or /)
  • /** should match zero or more tokens (e.g. /foo or /bar or /foo/bar or /)

Signed-off-by: Aaron Lipinski <aaron.lipinski@roboticsplus.co.nz>
Signed-off-by: Aaron Lipinski <aaron.lipinski@roboticsplus.co.nz>
Signed-off-by: Aaron Lipinski <aaron.lipinski@roboticsplus.co.nz>
@rpaaron
Copy link
Contributor Author

rpaaron commented Oct 11, 2020

@rpaaron Friendly ping. Have you had a chance to look into the design raised in the previous comment?

thanks @mabelzhang can you advise what I need to change here?

@clalancette
Copy link
Contributor

thanks @mabelzhang can you advise what I need to change here?

Essentially this comment: #1265 (comment) . That is, some updates to the design document so that we are all on the same page.

@fujitatomoya
Copy link
Collaborator

@rpaaron can you rebase this on master?

@fujitatomoya
Copy link
Collaborator

fujitatomoya commented Dec 17, 2021

@rpaaron sorry for the confusion, i need to take back the previous request. could you help the review on #1839 instead, if you are available. (please see #1839 (review))

@fujitatomoya
Copy link
Collaborator

I will go ahead to close this one in favor of #1839.
CC: @rpaaron @iuhilnehc-ynos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed Further information is required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants