How to launch a node with a parameter in ROS2?
Migrating ros1 package to ros2 and couldn't figure how to launch with a paramter in ros2.
With ros1 I have a launch file that refers to a config file and from cpp code I use node.getParam
launch file:
<launch>
<arg name="node_name" default="collector" />
<arg name="config_file" default="" />
<node name="$(arg node_name)" pkg="collector" type="collector" respawn="true">
<rosparam if="$(eval config_file!='')" command="load" file="$(arg config_file)"/>
</node>
</launch>
config file:
my_param: 5
cpp code:
double my_param = 0;
n.getParam("my_param", my_param);
My question is how would that translate to ROS2?