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

rosjava android - phone sends localhost

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

gimili gravatar image

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

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 ("127.0.0.1") of itself to the core:
- rxgraph shows for the phone-publisher: "ERROR: Communication with node[http://127.0.0.1:55124] failed!
- rxgraph shows for the phone-subscriber: "ERROR: Communication with node[http://127.0.0.1:40919] 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
1

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

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

NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostName());

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

Comments

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 -0500 )edit
1

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

ICodeRaven gravatar image

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

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

Stats

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

Seen: 1,328 times

Last updated: Oct 27 '11