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

PubSub tutorial: Android device doesn't receive messages published by PC [solved]

asked 2017-10-20 09:04:46 -0500

aurora18 gravatar image

updated 2017-10-20 10:35:39 -0500

Hey Dear ROS Community, I'm currently building a custom App to control my robot. Therefore I'm testing the PubSub tutorial provided by the android_core package: https://github.com/rosjava/android_core

Now if I connect my Android device to the ROS Master running on my PC and listen to the /chatter topic on my PC I receive the incoming "Hello World" messages sent by the talker node on my android device. However, if I publish a String message on my PC to the same topic it gets only displayed on the terminal running "rostopic echo /chatter" while the RosTextView on the android device only displays the messages published by the talker node but not what is published by my PC.

Running "~ rostopic info /chatter" delivers

Type: std_msgs/String 

Publishers:  
* /rosjava_tutorial_pubsub/talker (http://192.168.1.102:57888/) 

Subscribers:  
* /android_gingerbread/ros_text_view (http://192.168.1.102:45315/)

Running ~ rosnode ping /android_gingerbread/ros_text_view  delivers

rosnode: node is [/android_gingerbread/ros_text_view] 
pinging /android_gingerbread/ros_text_view with a timeout of 3.0s 
xmlrpc reply from http://192.168.1.102:45315/   time=358.101130ms 
xmlrpc reply from http://192.168.1.102:45315/   time=124.948978ms 
xmlrpc reply from http://192.168.1.102:45315/   time=329.936981ms

So everything seems to be setup fine however the the RosTextView node doesn't react to messages published by my PC. It seems like a network issue.

Related posts suggested to create a publicly accessible nodeConfiguration via

NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress().toString(), masterUri);

which is already the case in the current pubsub tutorial.

Does somebody of you know how to fix this problem?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-10-20 09:27:09 -0500

gvdhoorn gravatar image

I'm not sure, but try setting ROS_IP=ip.of.your.pc on your PC as an environment variable. It might be that the Android device is trying to resolve the hostname of your PC and is failing, hence cannot make a connection to the PC.

But it's just a guess/stab in the dark.

edit flag offensive delete link more

Comments

Thank you so much!! Setting the ROS_IP solved my Problem! I tried that before but obviously changed to another terminal when publishing to /chatter where the environment variables weren't exported yet. Thanks!

aurora18 gravatar image aurora18  ( 2017-10-20 10:35:01 -0500 )edit

You could either make sure you have a properly working DNS setup for all involved hosts, or add the export ROS_IP=... to your .bashrc. Or use a tool such as ifdata from the moreutils Ubuntu package.

gvdhoorn gravatar image gvdhoorn  ( 2017-10-20 10:41:13 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-20 09:04:46 -0500

Seen: 317 times

Last updated: Oct 20 '17