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
Add CLI args to Node constructor #461
Conversation
Adds arguments and use_global_arguments to NodeBase
@@ -84,18 +87,33 @@ NodeBase::NodeBase( | |||
} | |||
|
|||
// Create the rcl node and store it in a shared_ptr with a custom destructor. | |||
rcl_node_t * rcl_node = new rcl_node_t(rcl_get_zero_initialized_node()); | |||
std::unique_ptr<rcl_node_t> rcl_node(new rcl_node_t(rcl_get_zero_initialized_node())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this only to get rid of false positive "double free" error from cppcheck. It didn't like that it saw two delete rcl_node;
statements: one in the error handling after calling rcl_parse_arguments()
, and another in the error handling of rcl_node_init()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I believe this PR introduced some memory leaks when I ran valgrind on |
* reenable cppcheck Signed-off-by: Karsten Knese <karsten@openrobotics.org> * suppress unknown macro inline Signed-off-by: Karsten Knese <karsten@openrobotics.org>
This adds a parameter for command line arguments to
Node
, and a parameter to ignore global CLI arguments. I think roslaunch might need something like this to dynamically compose nodes without their arguments affecting other nodes, though I'm not sure if there is another strategy planned.Kind of related to ros2/examples#200 and ros2/ros2#450