Skip to content

Remote Machines Running ROS nodes

Konstantinos Panayiotou edited this page May 14, 2015 · 13 revisions

This section describes the procedures and configurations required, when a distributed system which consists of machines running ROS is developed.

In this case the remote machines can be configured to launch and run ROS-Nodes by a local invocation.

Lets assume we have a local-machine which executes "most" of the nodes, and a remote-machine which runs a node and export the information on the local-machine.

####Comments:

  1. Let the IP-address of the local-machine be: 155.207.33.185 (ROS_IP=155.207.33.185)
  2. Let the IP-address of the remote-machine be: 155.207.33.186 (ROS_IP=155.207.33.186)
  3. ROS_MASTER runs on the local-machine (ROS_MASTER_URI=http://155.207.33.185:11311)

SSH-connection configurations

The way roslaunch-nodes works, needs a valid ssh-connection between the local and the remote machines. To ensure robustness, create an authorized-key:

  1. On the local-machine, create an ssh-key:
    ssh-keygen -t rsa 
  1. Once you have entered the Gen Key command, you will get a few more questions:
    Enter file in which to save the key (/home/demo/.ssh/id_rsa):

Type the name of the key to be generated.

    Enter passphrase (empty for no passphrase):

Enter the passphrase to be used for the generated key

  1. Copy the public key into the new machine's authorized_keys file, by using the ssh-copy-id command:
ssh-copy-id -i <ssh-key> remote-machine-user@remote-machine-ip-address

The ssh-key parameter is assumed to be the name of the file you generated the ssh-key on step 2. For example id_rsa

The above procedure ensures that the ssh-connection from the local to the remote machine, is authorized

Create an env-loader Script

Due to the automated nature of ROSLaunch, it avoids executing the users .bashrc on remote nodes and requires an environment file to assign remote environment variables.

Let's assume that we need to create env-loader for a workspace located under /home/user/catkin_ws

An example of the env-loader script which is used in this case is:

#!/bin/bash

export ROS_IP=155.207.33.186
export ROS_MASTER_URI=http://155.207.33.185:11311

source /home/<user>/catkin_ws/devel/setup.bash

exec "$@"

Though the two lines, which defines the $ROS_IP and $ROS_MASTER_URI env variables can be defined in the launch file which launch the nodes on the remote machine. We will go further into this on a later section.

Finally save the above created env-loader script on the remote-machine. Let's assume that we saved the above mentioned env-loader script into /home//catkin_ws/devel/remote_env_loader.sh

Implementation of the .roslaunch file

The following example below shows configuring a node "flir_lepton_hardware_interface_node" to run on the remote machine.

<launch>
  <machine
    name="<remote-machine-name>"
    address="155.207.33.186"
    user="<remote-machine-user>"
    password="<ssh-password to the remote machine>"
    timeout="<timeout-value for the ssh-connection>"
    env-loader="/home/<remote-machine-user>/catkin_ws/devel/remote_env_loader.sh"
  />
  
  <!-- Flir Lepton Interface -->
  <node
    machine="<remote-machine-name>"
    name="flir_lepton_hardware_interface"
    pkg="flir_lepton_hardware_interface"
    type="flir_lepton_hardware_interface_node"
  />
</launch>

Save the roslaunch file. (flir_lepton_remote.launch)

Running the remote node

Like mentioned before the local-machine runs the "ROS_MASTER".

  1. Make sure that the ROS_MASTER and ROS_IP env-vars are exported on the local-machine:
    export ROS_MASTER_URI=http://155.207.33.185:11311
    export ROS_IP=155.207.33.185
  1. Run the before-created roslaunch file: execute roslaunch flir_lepton_remote.launch under the launch file directory.

ENJOY! :)

Metapackages

###pandora_audio

  • [Audio capture node](Audio Capture Node)
  • [Audio monitoring node](Audio Monitoring Node)
  • [Audio recording node](Audio Recording Node)
  • [Audio processing node](Audio Processing Node)
Clone this wiki locally