Ask Your Question
1

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:

/chatter<br>
/rosout<br>
/rosout_agg

Using "rostopic info /chatter":

Type: std_msgs/String

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

Subscribers: 
 * /android_gingerbread/ros_text_view (http://127.0.0.1:43231/)

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

Comments

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 imagemagnux ( 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 imagemagnux ( 2014-10-17 12:18:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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 = 
    NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().
                                getHostAddress(), masterUri);

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

edit flag offensive delete link more

Comments

How can i get the IP of the avd?

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

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

Lorenz gravatar imageLorenz ( 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 java.net.URI("http://172.16.31.203:11311");nodeConfiguration.setMasterUri(master_uri);" to the original code of tutorial pub sub but it doesn't work

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

This looks fine given 172.16.31.203 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=http://172.16.31.203:11311

Lorenz gravatar imageLorenz ( 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 127.0.0.1 which is clearly wrong. Use their public ip on the android device and on the pc.

Lorenz gravatar imageLorenz ( 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=172.16.31.203). Now when I run rostopic info the PC advertise himself with the public IP in fact I get:/rostopic_2423_1348561733505 (http://172.16.31.203:52624/) but I don't know what to do to use the public IP of the avd

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

I know that the IP address of an android avd is 10.0.2.15. 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 10.0.2.15 on my PC it can't send the messages.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 1,309 times

Last updated: Sep 24 '12