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

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 http://192.168.13.7:11311) my code is like this:

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

talker = new Talker;
nodeRunner.run(tistener, 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=192.168.13.7.

but then there occurs this error

java.lang.RuntimeException:java.net.ConnectException:10.0.2.15/10.0.2.15:58353 - 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
0

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

damonkohler gravatar image

If you're using the emulator, this will likely never work. See http://answers.ros.org/question/30018/rosjava-on-android-emulator

edit flag offensive delete link more

Question Tools

Stats

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

Seen: 2,077 times

Last updated: Mar 30 '12