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

Unable to publish to subscriber running on android

asked 2018-04-16 14:20:18 -0500

vvyogi gravatar image

updated 2018-04-16 14:21:33 -0500

I am trying to debug a pub-sub node pair implemented on android (ROS-android). Following are the details:

ROS-Core is running locally on android. A publisher and a subscriber are also running on the android phone (no emulator).

On PC side the following settings are made ROS_IP=pc_ip, ROS_HOSTNAME=android_ip, ROS_MASTER_URI =android_ip

All nodes are visible when I run rostopic list Able to echo the published topic. (std_msgs.String)
Not able to send data to the subscriber. Then I looked into the TCP packets (using wireshark) and it appears the following transactions are happening:

  1. get pid (method call) - result : success
  2. register service - result : success
  3. Some broken message passing <irrelevant as="" the="" appearance="" of="" this="" packet="" exchange="" is="" random=""> [FIN,ACK] [ACK]
  4. register publisher - result : success RETURNS the right address of the subscriber

The ROS-master running on android is sending the correct address yet the android application is crashing with following message:

04-17 00:49:10.604 2563-3001/com.example.vivek.sampleb I/HttpMethodDirector: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
04-17 00:49:10.605 2563-3001/com.example.vivek.sampleb I/HttpMethodDirector: Retrying request
04-17 00:49:10.608 2563-3001/com.example.vivek.sampleb I/HttpMethodDirector: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
04-17 00:49:10.609 2563-3001/com.example.vivek.sampleb I/HttpMethodDirector: Retrying request
04-17 00:49:10.613 2563-3001/com.example.vivek.sampleb I/HttpMethodDirector: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
    Retrying request

Wireshark packets

I hope someone here can help me with this issue.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-04-16 14:53:23 -0500

gvdhoorn gravatar image

updated 2018-04-18 13:43:25 -0500

On PC side the following settings are made [..], ROS_HOSTNAME=android_ip [..]

this makes no sense to me. Why did you set ROS_HOSTNAME to the IP of the android device?


Edit:

The ROS master is running on the android phone thus I set HOSTNAME to android_ip. Is that wrong?

yes, that is not correct. ROS_IP ~= ROS_HOSTNAME: both store information about the local machine, not something remote. Only ROS_MASTER_URI ever points to a remote IP / host.

Please note that only one of them is needed. If you set ROS_IP, you don't need ROS_HOSTNAME and the other way around.

Or to be more precise: don't fill in the same information in the two. ROS_HOSTNAME should be set to hostnames, and things will only work if you've got a working DNS for all involved hosts (note: both forward and reverse lookups need to work).

If you set ROS_IP, set it to an IP, not a hostname. If you do this, you don't need DNS, but it's obviously less flexible in the face of (frequent) IP changes of the involved hosts (such as with an 'overactive' DHCP server).

edit flag offensive delete link more

Comments

The ROS master is running on the android phone thus I set HOSTNAME to android_ip. Is that wrong? Moreover, As I was able to receive (rostopic echo) the data coming from the android phone I thought these settings are correct.

vvyogi gravatar image vvyogi  ( 2018-04-17 00:27:08 -0500 )edit

Understood (Thank you). It works with the HOSTNAME set to PC's IP address. I am however getting another ()error while closing the connection to master . Would you please take a look

vvyogi gravatar image vvyogi  ( 2018-04-18 12:53:13 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-16 14:20:18 -0500

Seen: 839 times

Last updated: Apr 18 '18