0
$\begingroup$

Rosanswers logo

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 [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.


Originally posted by vvyogi on ROS Answers with karma: 53 on 2018-04-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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).


Originally posted by gvdhoorn with karma: 86574 on 2018-04-16

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by vvyogi on 2018-04-17:
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.

Comment by vvyogi on 2018-04-18:
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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.