Skip to content

Do argument parsing outside of node constructor #492

@sloretz

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestin progressActively being worked on (Kanban column)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions