Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using rosservice across multiple machines

I am attempting to distribute my graph across multiple machines, M1 and M2. The IP of M1 is 192.168.0.80 and the IP of M2 is 192.168.0.79.

In the /etc/hosts file on M1, I have set:

192.168.0.79    machine2

And in the /etc/hosts file on M2, I have:

192.168.0.80    machine1

I am able to ping machine1 from machine2 and vice versa.

So then, I set up my launch file to use multiple machines with the following .machine file:

<launch>
   <machine name="M1" address="machine1" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m1user" default="true"></machine>
   <machine name="M2" address="machine2" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m2user">
   <env name="ROS_MASTER_URI" value="http://machine1:11311" />
   </machine>
</launch>

When I launch, everything connects fine, all of the nodes launch correctly, and I am able to do 'rostopic list' and 'rosservice list' to see all topics and services. Additionally, I am able to 'rostopic echo' any topic that is running in the graph.

The problem that I am having is that I am only able to call a service from a node that is running on the master machine, i.e. M1. For example, a service named "enable_teleop" is running in my robot_teleop node on the master machine, and I can call this service from either machine. However, if I try to call a service that is from a node on the second machine using either machine, I receive the following error:

> rosservice call /reset_odometry
> ERROR: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:56068]

I have tried setting the ROS_IP and/or ROS_HOSTNAME environment variables of both machines in every combination that I can think of, and still no luck. So my question is, how do I get around this problem? Does ROS require that all services be on the same machine as the roscore?

~ Brian

Using rosservice across multiple machines

I am attempting to distribute my graph across multiple machines, M1 and M2. The IP of M1 is 192.168.0.80 and the IP of M2 is 192.168.0.79.

In the /etc/hosts file on M1, I have set:

192.168.0.79    machine2

And in the /etc/hosts file on M2, I have:

192.168.0.80    machine1

I am able to ping machine1 from machine2 and vice versa.

So then, I set up my launch file to use multiple machines with the following .machine file:

<launch>
   <machine name="M1" address="machine1" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m1user" default="true"></machine>
   <machine name="M2" address="machine2" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m2user">
   <env name="ROS_MASTER_URI" value="http://machine1:11311" />
   </machine>
</launch>

When I launch, everything connects fine, all of the nodes launch correctly, and I am able to do 'rostopic list' and 'rosservice list' to see all topics and services. Additionally, I am able to 'rostopic echo' any topic that is running in the graph.

The problem that I am having is that I am only able to call a service from a node that is running on the master machine, i.e. M1. For example, a service named "enable_teleop" is running in my robot_teleop node on the master machine, and I can call this service from either machine. However, if I try to call a service that is from a node on the second machine using either machine, I receive the following error:

> rosservice call /reset_odometry
> ERROR: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:56068]

I have tried setting the ROS_IP and/or ROS_HOSTNAME environment variables of both machines in every combination that I can think of, and still no luck. So my question is, how do I get around this problem? Does ROS require that all services be on the same machine as the roscore?

EDIT:

The output of 'rosservice info /reset_odometry' is as follows:

Node: /locator
URI: rosrpc://machine2:42244
ERROR: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:42244]

The output of roswtf is:

* service [/reset_odometry] appears to be malfunctioning: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:42244]

~ Brian

Using rosservice across multiple machines

I am attempting to distribute my graph across multiple machines, M1 and M2. The IP of M1 is 192.168.0.80 and the IP of M2 is 192.168.0.79.

In the /etc/hosts file on M1, I have set:

192.168.0.79    machine2

And in the /etc/hosts file on M2, I have:

192.168.0.80    machine1

I am able to ping machine1 from machine2 and vice versa.

So then, I set up my launch file to use multiple machines with the following .machine file:

<launch>
   <machine name="M1" address="machine1" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m1user" default="true"></machine>
   <machine name="M2" address="machine2" ros-root="$(env ROS_ROOT)" ros-package-path="$(env ROS_PACKAGE_PATH)" user="m2user">
   <env name="ROS_MASTER_URI" value="http://machine1:11311" />
   </machine>
</launch>

When I launch, everything connects fine, all of the nodes launch correctly, and I am able to do 'rostopic list' and 'rosservice list' to see all topics and services. Additionally, I am able to 'rostopic echo' any topic that is running in the graph.

The problem that I am having is that I am only able to call a service from a node that is running on the master machine, i.e. M1. For example, a service named "enable_teleop" is running in my robot_teleop node on the master machine, and I can call this service from either machine. However, if I try to call a service that is from a node on the second machine using either machine, I receive the following error:

> rosservice call /reset_odometry
> ERROR: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:56068]

I have tried setting the ROS_IP and/or ROS_HOSTNAME environment variables of both machines in every combination that I can think of, and still no luck. So my question is, how do I get around this problem? Does ROS require that all services be on the same machine as the roscore?

EDIT:

The output of 'rosservice info /reset_odometry' is as follows:

Node: /locator
URI: rosrpc://machine2:42244
ERROR: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:42244]

The output of roswtf is:

* service [/reset_odometry] appears to be malfunctioning: Unable to communicate with service [/reset_odometry], address [rosrpc://machine2:42244]

~ Brian