Ask Your Question

Revision history [back]

The roslaunch process will use the ROS_MASTER_URI settings of the environment variable as it was set in the shell that executed roslaunch. Setting it using env inside roslaunch will only affect nodes that are started up, not the roslaunch process itself. Since roslaunch is responsible for setting parameters, the shell variable, not the env tag will be used.

The roslaunch process will use the ROS_MASTER_URI settings of the environment variable as it was set in the shell that executed roslaunch. Setting it using env inside roslaunch will only affect nodes that are started up, not the roslaunch process itself. Since roslaunch is responsible for setting parameters, the shell variable, not the env tag will be used.

Edit: To explain a little more, roslaunch works as follows. It first parses a launch file and collects an ordered list of parameters to set. Then it sets all parameters on the parameter server. Finally, it starts up all nodes on the corresponding machines. For each node, it sets up the environment, i.e. it applies the env tags. That means, the env tag is only applied for newly started nodes. The roslaunch process itself however uses the shell environment in which it was started up.

I would say it is normally a bad idea to set the ROS_MASTER_URI in roslaunch files because roslaunch passes the URI setting to its nodes anyway. This also works when using roslaunch's machine tags. This page might be helpful.