<machine> tag

The <machine> tag declares a machine that you can run ROS nodes on. You do not need this tag if you are launching all the nodes locally. It is mainly used to declare SSH and ROS environment variable settings for remote machines, though you can also use it to declare information about the local machine.

Attributes

  • name="machine-name"

    • Name to assign to machine. This corresponds to the name used for the machine attribute for <node> tags.

    address="blah.willowgarage.com"

    • Network address/hostname of machine.

    env-loader="/opt/ros/fuerte/env.sh" New in Fuerte

    • Specify environment file on remote machine. Environment file must be a shell script that sets all required environment variables, then runs exec on the provided arguments. For an example file, see the env.sh that is provided with debian installs of ROS Fuerte. See below for an example env-loader.

    default="true|false|never" (optional)

    • Sets this machine as the default to assign nodes to. The default setting only applies to nodes defined later in the same scope. NOTE: if there are no default machines, the local machine is used. You can prevent a machine from being chosen by setting default="never", in which case the machine can only be explicitly assigned.

    user="username" (optional)

    • SSH user name for logging into machine. May be omitted if not required.

    password="passwhat"(strongly discouraged)

    • SSH password. It is highly recommended that you configure SSH keys and SSH agent instead so you can login with certificates instead.

    timeout="10.0" (optional)

    • Number of seconds before a roslaunch on this machine is considered as having failed to launch. By default, this is 10 seconds. While you can use this setting to allow for slower connections, needing to change this parameter is generally a symptom that your overall ROS graph will have communication issues.

The following attributes are available in ROS Electric and earlier:

  • ros-root="/path/to/ros/root/" (optional)

    • ROS_ROOT for machine. Defaults to the ROS_ROOT set in the local environment.

    ros-package-path="/path1:/path2" (optional)

    • ROS_PACKAGE_PATH for machine. Defaults to the ROS_PACKAGE_PATH set in the local environment.

Elements

Electric and earlier only: You can use the following XML tags inside of a <machine> tag:

  • <env>

    • Set an environment variable on all processes launched on this machine.

Examples

The syntax of the <machine> tag is very different in ROS Electric, so please pay attention to the version indicator in the examples below.

Basic (ROS Electric and Previous Only)

The following example below shows configuring a node "footalker" to run another machine. In addition to overriding the ROS_ROOT and ROS_PACKAGE_PATH that the machine will use, the example also sets a LUCKY_NUMBER environment variable on the remote machine.

<launch>
  <machine name="foo" address="foo-address" ros-root="/u/user/ros/ros/" ros-package-path="/u/user/ros/ros-pkg" user="someone">
    <env name="LUCKY_NUMBER" value="13" />
  </machine>

  <node machine="foo" name="footalker" pkg="test_ros" type="talker.py" />

</launch>

Basic (ROS Fuerte and later) using env-loader

New in Fuerte

The following example below shows configuring a node "footalker" to run another machine. It uses the default env-loader file that comes with Fuerte.

<launch>
  <machine name="foo" address="foo-address" env-loader="/opt/ros/fuerte/env.sh" user="someone"/>

  <node machine="foo" name="footalker" pkg="test_ros" type="talker.py" />

</launch>

Here is an example env-loader script. Replace /opt/ros/fuerte/setup.sh with a different setup file if you wish to use a different environment configuration:

#!/bin/sh

. /opt/ros/fuerte/setup.sh
exec "$@"

Alternatively, if you prefer to source from a rosws workspace:

#!/usr/bin/env bash

source /home/username/path/to/workspace/setup.bash
exec "$@"

Wiki: roslaunch/XML/machine (last edited 2013-01-30 00:48:51 by AcornPooley)