Skip to content

Do argument parsing outside of node constructor #492

Open

Description

@sloretz

Feature request

Things that come from command line arguments should be separately passed into the node's constructor rather than passing in arguments and asking the node to do the parsing.

Feature description

Currently command line arguments may be passed to a node via an argument to the node's constructor. This separates the responsibility of parsing arguments from actually using them. An entity like ros2 launch launch composable nodes would invoke parsing of any command line arguments, and then pass the results into the node.

Implementation considerations

The current arguments passed to the node are

Node(
const std::string & node_name,
const std::string & namespace_,
rclcpp::Context::SharedPtr context,
const std::vector<std::string> & arguments,
bool use_global_arguments = true,
bool use_intra_process_comms = false,
bool start_parameter_services = true);

The information that should be passed in if not through the arguments is:

Since new features may be added as command line arguments it may be an advantage to pass rclcpp::NodeArguments() so future features don't have to change all the places where arguments are passed to a node's constructor

requires ros2/rcl#254

Activity

  1. added
    enhancement
    on Jun 5, 2018
  2. self-assigned this
    on Jan 22, 2019
  3. added
    in progress
    on Jan 22, 2019
  4. added
    in review
    and removed
    in progress
    on Feb 5, 2019
  5. removed
    in review
    on Feb 21, 2019
  6. wjwwood commented on Feb 21, 2019

    @wjwwood
    Member

    @mjcarroll is this actually done?

  7. mjcarroll commented on Feb 22, 2019

    @mjcarroll
    Member

    Ah, sorry. With a quick glance I thought this was covered with NodeOptions, but the parsing is still happening inside the node, will re-open.

  8. added
    in progress
    on Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementin progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions