-
Notifications
You must be signed in to change notification settings - Fork 522
Description
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
rclcpp/rclcpp/include/rclcpp/node.hpp
Lines 94 to 101 in 8f793fd
| 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:
- Topic and service remap rules
- node name and namespace remap rules
__ns:=...,__node:=... - Initial parameter values
__params:=... - Log level (Command-line setting of logger level ros2#498)
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