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

Can I launch multiple instances of the same node in a launch file?

asked 2020-02-27 16:11:59 -0600

Joy16 gravatar image

updated 2022-01-22 16:10:23 -0600

Evgeny gravatar image

I have a launch file that launches a node. I pass two sensor names as its args. I would like to launch the same node fora different pair of sensors. But it will result in a namespace error.

1)Can I launch several instances of the same node with different args in a single launch file?

2) I think I can create different launch files and include them in one launch file too. But is there a better way to go about it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-27 16:56:30 -0600

bob-ROS gravatar image

updated 2020-02-28 08:25:19 -0600

Here is an example of it being done with two nodes of the type ekf_localization_node:

https://github.com/cra-ros-pkg/robot_...

<launch>

  <rosparam command="load" file="$(find robot_localization)/params/dual_ekf_navsat_example.yaml" />

  <node pkg="robot_localization" type="ekf_localization_node" name="ekf_se_odom" clear_params="true"/>

  <node pkg="robot_localization" type="ekf_localization_node" name="ekf_se_map" clear_params="true">
    <remap from="odometry/filtered" to="odometry/filtered_map"/>
  </node>

  <node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform" clear_params="true">
    <remap from="odometry/filtered" to="odometry/filtered_map"/>
  </node>

</launch>

Put different names on each node as seen in the example above.

What type of node are you trying to launch? Might be other conflicts.

edit flag offensive delete link more

Comments

Please do not post link-only errors.

If cra-ros-pkg ever disappears, or the file you link to gets renamed, the link will 404, and this will reduce the value of your answer.

Instead, quote the relevant parts of the file in your answer.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-28 07:00:44 -0600 )edit

Good point, I will fix this on the other answers as well.

bob-ROS gravatar image bob-ROS  ( 2020-02-28 08:25:58 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-02-27 16:11:59 -0600

Seen: 1,570 times

Last updated: Feb 28 '20