0
$\begingroup$

Rosanswers logo

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?


Originally posted by camilla on ROS Answers with karma: 255 on 2012-09-24

Post score: 1


Original comments

Comment by magnux on 2014-10-17:
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.

Comment by magnux on 2014-10-17:
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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Lorenz with karma: 22731 on 2012-09-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by camilla on 2012-09-24:
How can i get the IP of the avd?

Comment by Lorenz on 2012-09-24:
The port of the ros core is per default always 11311.

Comment by camilla on 2012-09-24:
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

Comment by Lorenz on 2012-09-24:
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

Comment by Lorenz on 2012-09-24:
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.

Comment by camilla on 2012-09-24:
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

Comment by camilla on 2012-09-24:
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.

$\endgroup$

Your Answer

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