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

rosjava android - phone sends localhost

asked 2011-10-27 00:35:59 -0600

gimili gravatar image

updated 2011-10-27 19:23:10 -0600

Hello eveyone!

We installed rosjava and we want to publish and subscribe messages between a PC and an android-phone.

  • roscore is running on the PC
  • there is a publisher and a subscriber on the phone and/or pc
  • ROS_MASTER_URI is set on the phone to the PC's IP

This works:
- subscribe messages on the phone, which were published on the phone
- subscribe messages on the phone, which were published on the PC
- subscribe messages on the PC, which were published on the PC

This does not work:
- subscribe messages on the PC, which were published on the phone

Our guess:
We think that the phone sends a wrong name ("") of itself to the core:
- rxgraph shows for the phone-publisher: "ERROR: Communication with node[] failed!
- rxgraph shows for the phone-subscriber: "ERROR: Communication with node[] failed!

-> We already tried to change the phone's name via setprop net.hostname (which changes net.hostname, but does not change the situation at all)
-> We tried to define the name in the phones /etc/hosts file; with no result

What are we doing wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-10-27 13:15:21 -0600

Chad Rockey gravatar image

This is probably not your answer but is similiar in that sometimes communication will fail if you're not tethering with USB because of the line


You need to change it to get an IP address, not a host name. Otherwise, external devices will have a difficult time resolving the Android hostname if the Android device is not doing the DNS lookups for it.

edit flag offensive delete link more


Thank you; this works! We were so blinded by getting the IP responding to the hostname and dns settings that we did not see the "newPrivate" in our code we used from the pubsubtutorial, where everything runs on the phone!
gimili gravatar image gimili  ( 2011-10-27 23:30:23 -0600 )edit

answered 2011-10-27 06:47:37 -0600

ICodeRaven gravatar image

updated 2011-10-27 06:47:55 -0600

Use a NonLoopback server address when you create one. You could use something like

Roscore _core = RosCore.newPublic(11411);
edit flag offensive delete link more

Question Tools


Asked: 2011-10-27 00:35:59 -0600

Seen: 1,285 times

Last updated: Oct 27 '11