ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Android subscriber can get msg but "rostopic echo" cannot?

asked 2014-11-08 07:29:16 -0500

SilverBullet gravatar image

Hi, everyone. I am new to ROS Android and I'm playing with android_tutorial_pubsub. I run the program on AVD and run roscore on Ubuntu Desktop. As we know, the program on AVD creates a publisher as well as a subscriber, both on topic /chatter. The publisher publishes message "Helloworld n" per second and the subscriber recieves messages and show in TextView.
On my AVD,the TextView shows "Helloworld n" correctly. And on my Ubuntu Desktop, when I excute rostopic list, I can see a topic named /chatter. And the rqt_graph seems correct, too. But when I excute rostopic echo chatter (or /chatter), I can not get messages "Helloworld n". When I see rqt_graph, it shows that both android node and rostopic node subscribe to topic /chatter.
So here comes the problem. Why does rostopic echo get nothing but the android node can get messages while they're subscribing to exactly one same topic? I'd appriciate it if anyone can help.

edit retag flag offensive close merge delete


What values are you using for ROS_MASTER_URI and ROS_IP (or ROS_HOSTANAME) on Ubuntu? Can you set those env-vars to use the IP of your machine?

Gary Servin gravatar image Gary Servin  ( 2014-11-08 17:23:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-09 02:09:05 -0500

gvdhoorn gravatar image

This is most likely a network configuration issue. The AVD does not expose a direct network connection to hosts on your LAN, it uses NAT. As the ros master is running on your Android device, you'll need to allow traffic to be routed to the proper IPs through the NAT. See an earlier answer about this: rosjava nodes isolated and ros tools buggy behavior.

Alternatively, you could try running your master on your host machine, and have your rosjava applications use that as a master. In that case you need to make sure you have working DNS (for both the AVD instance and hosts on your LAN), or just set ROS_IP and ROS_MASTER_URI appropriately (use plain IPs).

edit flag offensive delete link more


Thanks a lot. I think it's right that ROS on my ubuntu cannot connect to AVD nodes correctly. It seems that I really should buy a real android phone to continue my study. orz

SilverBullet gravatar image SilverBullet  ( 2014-11-09 19:52:06 -0500 )edit

Well it's probably possible, you'd just have to figure out the correct configuration of the AVD network interfaces. A real device is slightly easier, but I'm not sure it's really needed.

gvdhoorn gravatar image gvdhoorn  ( 2014-11-10 06:39:27 -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

1 follower


Asked: 2014-11-08 07:29:16 -0500

Seen: 989 times

Last updated: Nov 09 '14