Do argument parsing outside of node constructor
@mjcarroll is already working on this.
Since Jan 22, 2019.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
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 https://github.com/ros2/rclcpp/blob/8f793fdb4aa6d21ea2442a31547546a3c90692a5/rclcpp/include/rclcpp/node.hpp#L94-L101
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 (ros2/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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.