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

Rosjava subscriber doesn't get any data

asked 2019-07-02 15:41:02 -0500

luischd gravatar image

updated 2019-07-04 04:41:11 -0500

gvdhoorn gravatar image

I'm trying to use a rosbag as a topic publisher to receive the data on my phone and update the info I have on my app. I've been looking around and I think the main issue is this console output:

E/UpdatePublisherRunnable: java.lang.RuntimeException: Unable to resolve host "mypcname": No address associated with hostname

Im playing a rosbag from my pc and made sure the topic is working. I used the debug of android studio and the subscriber gets setted properly, but when I should receive the message the onNewMessage never triggers. I have setted up the ROS_MASTER_URI, ROS_IP and ROS_HOSTNAME correctly on my pc.

Not sure what to do to solve this and couldn't find a proper answer anywhere. Thanks in advance.

edit retag flag offensive close merge delete


I do not have a solution but have you...

[1] a 'IsPortOpen' before the error exception. [2] ...called addMessageListener(MessageListener<t!> { ... prior to onNewMessage ?

Tav_PG gravatar image Tav_PG  ( 2019-07-02 23:49:14 -0500 )edit

Please post your EDIT as an answer and accept your own answer.

gvdhoorn gravatar image gvdhoorn  ( 2019-07-04 04:03:40 -0500 )edit

I can't accept my own answer, a pop-up says 10 points are required

luischd gravatar image luischd  ( 2019-07-04 04:39:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-04 04:37:50 -0500

luischd gravatar image


My code was all good and the network configuration before roscore too. The only problem was that I didn't know you had to set up the ROS_MASTER_URI, ROS_IP and ROS_HOSTNAME on every console you are using for Ros. I was playing the rosbag on a different console (not on the roscore one) and the subscriber was publishing on localhost -> mypcname, which is the default value. To see if you have setted up your network values try echo $ROS_MASTER_URI.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-07-02 15:41:02 -0500

Seen: 312 times

Last updated: Jul 04 '19