[Documentation] [TitleIndex] [WordIndex

Running on Multiple Machines

If loading all of the nodes required for your simulation to operate slows down your machine to an unbearable speed then you might want to consider distributing the nodes among different machines on the network. Similar to the way you can distribute the computing when running on the PR2 robot by editing the associated prx.machine launch file, you can achieve the same result by setting up your sim.machine file in pr2_machine package.

To do so, you want to make sure that your ROS_MASTER_URI environment variable specifies the correct computer network address (this may or may not necessarily be 'localhost').

Then, since ROS will be creating ssh connections with them, you must add them to your ssh authorized_keys file (~/.ssh/authorized_keys).

Next, edit your pr2_machine/sim.machine file such that the 'address' field points to the corresponding computer network addresses. Note that it is easiest to start the gazebo node on the localhost, otherwise you'll need to have logged into an active X session on the remote machine and disable xhost by issuing

xhost -

on the remote machine, or start gazebo headless 1. An example sim.machine file could potentially look like this:

<launch>
  <machine name="realtime" address="localhost" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" />
  <machine name="two" address="localhost" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)"  default="true"/>
  <machine name="three" address="machine1.domain.com" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" />
  <machine name="four"  address="machine2.domain.com" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" />
  <machine name="five" address="machine3.domain.com" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" />
</launch>

Finally, add a machine attribute to every <node> started by your launch file(s) and set it equal to the machine name that you want the node to run on. For example, to start the laser_scan_assembler_srv node on machine four, specify:

  <node pkg="laser_assembler" type="laser_scan_assembler_srv" output="screen"  name="plugs_laser_scan_assembler" respawn="true" machine="four">
    ...
  </node>
  1. If running gazebo headless, image sensor generations are not available. (1)


2024-10-26 14:42