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

How to run listener.cpp on PC to receive message from Android (using Rosjava)?

asked 2012-03-28 03:11:14 -0600

rosdai gravatar image

updated 2014-01-28 17:11:46 -0600

ngrennan gravatar image

The goal is to send message from Android and receive it on my PC. My idea is to use this tutorial to build a package on PC containing an executable "listener". Then I write an android application based on rosjava. and set the MasterUri to PC (which is my code is like this:

String hostLocal = InetAddressFactory.newNonLoopback().getHostAddress();
String hostMaster = "";
URI uri = URI.create("http://" + hostMaster + ":" + "11311");
NodeConfiguration nodeConfigurationTalker = NodeConfiguration.newPublic(hostLocal, uri);

talker = new Talker;, nodeConfigurationTalker);

Then I started roscore on PC and talker on android AVD (target 10), remembering to export ROS_MASTER_URI=http://localhost:11311 and export ROS_IP=

but then there occurs this error - Connection refused

roswtf suggests Could not connect the android Node. and of course i couldn't receive anything on my pc...

I wonder what could be the cause. Do I need to set up anything else to combine c++ and rosjava? what could be the correct network setup? Is there any tutorial which is intended for communication between android and PC? The android_tutorial_pubsub builds its roscore in android itself.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-03-30 04:22:30 -0600

damonkohler gravatar image

If you're using the emulator, this will likely never work. See

edit flag offensive delete link more

Question Tools


Asked: 2012-03-28 03:11:14 -0600

Seen: 2,046 times

Last updated: Mar 30 '12