run a node based on logic clause on a .launch file
I am running ROS Melodic.
I have saved, through gmapping
, a map of an environment in a .yaml
file.
I would like to run the AMCL
node only if that map is present on the file system (as it can be moved, for reasons non-pertaining to this question) otherwise re-run gmapping
.
I am aware of the if-unless
logic that the .launch
file offer, but I can't figure out a way of using it in this case, admitting that it is possible.
Right now what I'm doing is very very naive, but works for the most part, and that is running a Python node that checks the FS and if it finds the map's .yaml
file, runs via subprocess.call the AMCL node or otherwise the gmapping node. Moreover, this way prevents me to add parameters directely to the call.