ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
4

Using rosservice across multiple machines [closed]

asked 2011-08-31 03:54:32 -0600

DimitriProsser gravatar image

updated 2012-02-27 07:34:35 -0600

kwc gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by kwc
close date 2012-02-29 07:46:07

Comments

Did you ever figure this out? Out of curiosity, are your usernames the same on both machines? Also is passwordless ssh set up both ways?
Ibrahim gravatar image Ibrahim  ( 2012-01-11 20:06:35 -0600 )edit
Yes and yes.
DimitriProsser gravatar image DimitriProsser  ( 2012-01-12 00:51:47 -0600 )edit
Hmm, so you didn't figure out what the problem was, or did you? I was having similar problems but I think it was partly because I had different usernames on different machines, or at least making a new account with the same username fixed some problems for me.
Ibrahim gravatar image Ibrahim  ( 2012-01-12 12:24:02 -0600 )edit

Hey, 5 years later and now I have the same problem... Did you (or anyone else) find a solution in the meantime?

Felix Widmaier gravatar image Felix Widmaier  ( 2017-03-07 10:25:57 -0600 )edit

Unable to get this working, I have setup ros ip and master uri, I am able to get rospy_tutorials listener and talker working across the two computers. I can list the services also but not call them.

rudasi gravatar image rudasi  ( 2017-04-16 21:25:57 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2012-01-30 03:44:18 -0600

Running ros across multiple machines -whether you call a service or not- is actually not a big problem thanks to the rosmaster.

What we did in our lab is as follows:

on the central/host/master computer:

export ROS_MASTER_URI=http://master_machine_name:11311
export ROS_IP=master_machine_ip

on the client computer(s):

export ROS_MASTER_URI=http://master_machine_ip:11311
export ROS_IP=client_machine_ip

You may also need to add master_machine_ip master_machine_name mapping to /etc/hosts file on the client machines so that they can ping master_machine_name.

edit flag offensive delete link more
0

answered 2011-10-13 16:10:32 -0600

I'm experiencing exactly the same issue. The two machines seem to be able to communicate just fine (rostopic list/echo works fine), and the master is able to call services that are running on itself. However, an identical service call from a different machine to the master results in the error that you posted.

Have you been able to resolve the issue?

edit flag offensive delete link more

Comments

I have not been able to fix this issue yet
DimitriProsser gravatar image DimitriProsser  ( 2011-10-14 03:10:07 -0600 )edit
0

answered 2011-08-31 04:26:23 -0600

Lorenz gravatar image

Distributing services across different machines shouldn't be a problem. What's the output of rosservice info /reset_odometry and roswtf? Does it maybe give any valuable information?

edit flag offensive delete link more

Comments

I've placed the results in an edit to the original question
DimitriProsser gravatar image DimitriProsser  ( 2011-08-31 04:34:41 -0600 )edit
Which node is actually providing this service? Are you sure it didn't die with something like a segfault? In that cause, roswtf should give something like: ERROR Could not contact the following nodes: ...
Lorenz gravatar image Lorenz  ( 2011-08-31 04:43:07 -0600 )edit
Which node is actually providing this service? Are you sure it didn't die with something like a segfault? In that cause, roswtf should give something like:
Lorenz gravatar image Lorenz  ( 2011-08-31 04:43:08 -0600 )edit
I was just using that node and service as an example. I have about 6 nodes and 12 services all doing the same thing. And I know they're alived because I can echo some topics that they publish to.
DimitriProsser gravatar image DimitriProsser  ( 2011-08-31 05:01:07 -0600 )edit
0

answered 2011-08-31 04:59:46 -0600

Markus Achtelik gravatar image

you might have to add both hostname/ip cominations to each /etc/hosts file, i.e.

192.168.0.80    machine1
192.168.0.79    machine2

The problem could be that machine1 refers to 127.0.0.1 / 127.0.0.1 in machine1's hosts file. Local communication works, but when roscore tries to resolve the address when negotiating a connection between machine1 and machine2, it would still report 127.0.0.1 ...

Hope that helps! Markus

edit flag offensive delete link more

Comments

Unfortunately, that didn't help. I get the same errors.
DimitriProsser gravatar image DimitriProsser  ( 2011-08-31 05:45:23 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-08-31 03:54:32 -0600

Seen: 3,185 times

Last updated: Jan 30 '12