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

conditional node running in a launch file

asked 2012-04-18 10:47:50 -0500

I have a system that consists of quite a few nodes that are simultaneously started. I use a launch file to start them all. Sometimes I have a couple of extra nodes that I want to run as well. The extra nodes have required nodes that overlap with the first launch file nodes. The ideal behavior would be to only launch the "overlapping" nodes if the nodes are not already running. That way the same two launch files could both be used standalone or simultaneously regardless of launch order. For example, I want the following functionality

<group if="$(find IS_NODE_RUNNING)">
    <node pkg="wiimote" type="">

Is something like this possible? I know I could accomplish this with environment variables. Is that the best way?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-19 03:30:07 -0500

DimitriProsser gravatar image

I do not know of any way to do this outside of environment variables. The arg tag requires that you specify the argument in the launch file, which you cannot do if you have to check for a node's existence.

edit flag offensive delete link more


That's what I was afraid of. It seems like a useful feature. Now I'm thinking the easiest way will be to write multiple launch files, and then automatically choose the correct launch file using a shell script... not really ideal

jarvisschultz gravatar image jarvisschultz  ( 2012-04-19 11:46:49 -0500 )edit

Question Tools


Asked: 2012-04-18 10:47:50 -0500

Seen: 1,213 times

Last updated: Apr 19 '12