Ask Your Question
0

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

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

Joy16 gravatar image

updated 2020-02-27 16:12:10 -0500

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 -0500

bob-ROS gravatar image

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

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 -0500 )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 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 26 times

Last updated: Feb 28