How to set NodeOptions for a ComposableNode in a .launch.py file?
I'm modifying a ROS2 node to be a component, and I'm trying to set additional node options when launching this node. Here is a snippet from a genericized but representative launch file:
def generate_launch_description():
container = ComposableNodeContainer(
name='test_container',
namespace='/',
package='rclcpp_components',
executable='component_container',
composable_node_descriptions=[
ComposableNode(
package='my_package',
plugin='my_package::MyComponentNode',
name='test_node',
extra_arguments=[{'use_intra_process_comms' : True, 'automatically_declare_parameters_from_overrides': True, 'allow_undeclared_parameters': True}]),
],
)
return LaunchDescription([container] )
In my node's constructor I'm querying the options that were passed in:
class MyComponentNode : public rclcpp::Node
{
public:
MyComponentNode(const rclcpp::NodeOptions& options) : rclcpp::Node("test_node", options)
{
RCLCPP_INFO_STREAM(LOGGER, "use_intraprocess_comms: " << get_node_options().use_intra_process_comms() << " allow undeclared params: " << get_node_options().allow_undeclared_parameters() << " auto declare params: " << get_node_options().automatically_declare_parameters_from_overrides());
}
}
I can see that use_intra_process_comms
is being set correctly (and I can toggle it between True and False by changing my launch file), but automatically_declare_parameters_from_overrides
and allow_undeclared_parameters
are not set to True like I would expect:
[component_container-4] [INFO] [1616010417.606922763] [test_node]: use_intraprocess_comms: 1 allow undeclared params: 0 auto declare params: 0
What is the correct way to do this?