I don't know of any environment variable (or a similar piece of infrastructure) that you could use for this, but perhaps using the support for loading roscore.xml
from /etc/ros
could be used for this.
roscore
will try to load that file from /etc/ros
first, and if that fails, default to the file in the roslaunch
package (which will be in /opt/ros/$distro/share
). See ros/ros_comm/tools/roslaunch/src/roslaunch/config.py, lines 78 to 84.
I've not tested this, but you could copy the default file to /etc/ros
and then add the parameter there.
Edit: apparently the value of ROS_ETC_DIR
on my machine (Xenial, Kinetic) is /opt/ros/kinetic/etc/ros
instead of /etc/ros
.
In any case: adding a parameter to /opt/ros/kinetic/etc/ros/roscore.xml
makes it part of the 'default' set of parameters that get set for every roscore
launch. Do read the wiki page I linked in my comment for some more information about that file though.
It would have been ideal if /etc/ros
was also searched, as that would allow per-machine or per-deployment configuration. I seem to remember some discussion a few years ago about exactly this, but can't find it right now.
I'm confused: are you starting multiple masters?
No, but I can see my title wasn't chosen well. Sorry.
I just want this parameter to be set no matter which roslaunch file I run, for any rostest etc., without having to define it multiple places.
Updated your title. Couldn't really come up with something 'catchy', but this at least covers the question better I believe.
As to the question I don't believe that is currently supported. Not officialy anyway.
Edit: you might take a look at wiki/roscore. Editing
roscore.xml
might be a way to get this in there, but that file is managed by your pkg manager by default. I don't .... know whether you can provide an override for it. See ros/ros_comm/tools/roslaunch/resources/roscore.xml for the default contents.