Can I launch multiple instances of the same node in a launch file?
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?
Asked by Joy16 on 2020-02-27 17:11:59 UTC
Answers
Here is an example of it being done with two nodes of the type ekf_localization_node:
<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.
Asked by bob-ROS on 2020-02-27 17:56:30 UTC
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.
Asked by gvdhoorn on 2020-02-28 08:00:44 UTC
Good point, I will fix this on the other answers as well.
Asked by bob-ROS on 2020-02-28 09:25:58 UTC
Comments