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