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

Passing all command-line arguments to Property Object #33

Closed
David-Estevez opened this issue Feb 8, 2016 · 7 comments
Closed

Passing all command-line arguments to Property Object #33

David-Estevez opened this issue Feb 8, 2016 · 7 comments

Comments

@David-Estevez
Copy link
Contributor

When extracting a group from a Resource Finder, only arguments coming from the config file are passed to the Property Object. Command-line arguments are ignored, and this may cause problems in the future.

Possible solutions:

  • Append command line arguments to group arguments coming from the file as a new group in the Property Object
  • Add support in YARP for extracting parameters depending on the origin of them (either command-line or file)
@PeterBowman
Copy link
Member

PeterBowman commented Oct 7, 2018

For instance, let's take oneCanBusOneWrapper.ini. The name property to the [wrapper0] group is set to /wrapper0 in the .ini file. I'd expect that the following command would override the default value and pick /myPort instead (given also a default context and .ini config file, therefore no --context nor --from are shown here):

$ oneCanBusOneWrapper --wrapper0::name /myPort

The custom port is correctly parsed by yarp::dev::ResourceFinder, but dismissed during the initialization by yarp::os::Property::fromString().

Edit: tested on YARP 2.3.70.2.

@PeterBowman
Copy link
Member

Relevant lines upstream: ResourceFinder.cpp. I'd deem that placing the call to yarp::os::Property::fromConfigFile() last would give precedence to command-line user arguments over --from.

@PeterBowman
Copy link
Member

Add support in YARP for extracting parameters depending on the origin of them (either command-line or file)

Compare:

...and others.

@PeterBowman
Copy link
Member

PeterBowman commented Oct 7, 2018

Looks like the ResourceFinder mechanism works as intended, i.e. it correctly merges both command-line and config file properties and gives more precedence to the former (via find). However, we need to use Property::fromString here which, in turn, picks the latter. Compare docs for fromConfigFile and fromString.

@PeterBowman
Copy link
Member

Reported upstream at robotology/yarp#1889.

@PeterBowman PeterBowman changed the title [launchManipulation] Passing all command-line arguments to Property Object Passing all command-line arguments to Property Object Dec 30, 2019
@PeterBowman
Copy link
Member

Reported upstream at robotology/yarp#1889.

The former launchManipulation app has been improved and renamed to launchCanBus in #20. Also, the .ini parse system has been fully revamped (#237) and there is currently no urgent need to accept additional command line arguments in our CAN-based tools. Therefore, I'm marking this as invalid and superseded by the upstream issue.

@PeterBowman
Copy link
Member

Add support in YARP for extracting parameters depending on the origin of them (either command-line or file)

See yarp::os::ResourceFinderOptions and related methods at yarp::os::ResourceFinder.

@PeterBowman PeterBowman closed this as not planned Won't fix, can't repro, duplicate, stale Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants