ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ezra's profile - activity

2023-04-26 10:47:22 -0500 marked best answer 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?

2021-03-31 21:24:09 -0500 received badge  Good Question (source)
2020-10-28 00:28:39 -0500 received badge  Nice Question (source)
2020-09-29 12:33:53 -0500 received badge  Nice Question (source)
2019-09-15 01:22:25 -0500 received badge  Favorite Question (source)
2019-04-04 03:47:50 -0500 received badge  Famous Question (source)
2019-03-28 18:18:06 -0500 received badge  Famous Question (source)
2019-01-20 13:42:38 -0500 received badge  Notable Question (source)
2019-01-02 10:40:16 -0500 received badge  Student (source)
2019-01-02 10:39:29 -0500 received badge  Popular Question (source)
2018-12-24 15:23:33 -0500 asked a question How to launch a node with a parameter in ROS2?

How to launch a node with a parameter in ROS2? Migrating ros1 package to ros2 and couldn't figure how to launch with a p

2018-10-21 09:10:40 -0500 received badge  Notable Question (source)
2018-10-19 12:08:19 -0500 received badge  Supporter (source)
2018-10-19 08:47:52 -0500 received badge  Popular Question (source)
2018-10-18 17:20:12 -0500 asked a question ros1 and ros2 linting

ros1 and ros2 linting What's the ros way of linting ros code? For ros1 I have found roslint but it is unclear to me if