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

android_core pubsub tutorial

asked 2012-09-24 02:11:14 -0500

camilla gravatar image

Hi! I would like to modify the pubsub tutorial in order to have the subscriber running on the AVD and the publisher on my PC. The pubsub tutorial without modifications works, but if I use the command "rostopic pub /chatter std_msgs/String "..."" I don't see the string on the avd screen and if I call "rostopic echo /chatter" I can't see what is published by talker.
Using "rostopic list" I get:


Using "rostopic info /chatter":

Type: std_msgs/String

 * /rosjava_tutorial_pubsub/talker (
 * /rostopic_5792_1348480888907 (http://camilla-TECRA-A5:35002/)

 * /android_gingerbread/ros_text_view (

Therefore what should I do to put in communication a talker and a subscriber that are running on an avd and on a PC?

edit retag flag offensive close merge delete


Did you managed to solved this issue? I'm having the same problem, but the selected answer isn't helping me. NodeConfiguration is already public, I have the Master URI correctly setted (I think), and I still can't see anything outside the emulator.

magnux gravatar image magnux  ( 2014-10-17 06:45:43 -0500 )edit

The problem is to get to the net interface of the virtual device. The same setup on a real device work fine. Solution: use a real device.

magnux gravatar image magnux  ( 2014-10-17 12:18:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-09-24 02:36:34 -0500

Lorenz gravatar image

updated 2012-09-24 23:22:31 -0500

You need to make sure your network is set up correctly. E.g. if the roscore is running on the Android device, you need to set the ROS_MASTER_URI on the PC to point to it. Have a look at the network setup page.

Edit The node configuration in the andoid tutorial is created with NodeConfiguration.newPrivate() which creates a private ros node. Use NodeConfiguration.newPublic() instead. You will have to specify the host name of your android device. The following code should work:

NodeConfiguration nodeConfiguration = 
                                getHostAddress(), masterUri);

Note that you need to substitute masterUri with your actual master uri.

edit flag offensive delete link more


How can i get the IP of the avd?

camilla gravatar image camilla  ( 2012-09-24 02:55:58 -0500 )edit

The port of the ros core is per default always 11311.

Lorenz gravatar image Lorenz  ( 2012-09-24 03:30:17 -0500 )edit

Ok but how should I set the ROS_MASTER_URI?Because I launched roscore on the pc and I added this "master_uri = new"");nodeConfiguration.setMasterUri(master_uri);" to the original code of tutorial pub sub but it doesn't work

camilla gravatar image camilla  ( 2012-09-24 05:26:57 -0500 )edit

This looks fine given is the IP address of your PC, not of your tablet. The ROS_MASTER_URI on your PC needs to be the same: export ROS_MASTER_URI=

Lorenz gravatar image Lorenz  ( 2012-09-24 05:51:23 -0500 )edit

Did you configure a DNS? Did you go through the network setup page? Did you set ROS_IP? According to the output of rostopic info, the tablet and your computer advertise themselves as which is clearly wrong. Use their public ip on the android device and on the pc.

Lorenz gravatar image Lorenz  ( 2012-09-24 05:53:37 -0500 )edit

I set the ROS_MASTER_URI as you write and also the ROS_IP (export ROS_IP= Now when I run rostopic info the PC advertise himself with the public IP in fact I get:/rostopic_2423_1348561733505 ( but I don't know what to do to use the public IP of the avd

camilla gravatar image camilla  ( 2012-09-24 22:33:11 -0500 )edit

I know that the IP address of an android avd is But I don't know what should I set to solve the problem. Moreover I read the network setup page and when i do ping on my PC it can't send the messages.

camilla gravatar image camilla  ( 2012-09-24 22:39:52 -0500 )edit

Question Tools


Asked: 2012-09-24 02:11:14 -0500

Seen: 1,499 times

Last updated: Sep 24 '12