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

rosjava nodes isolated and ros tools buggy behavior

asked 2014-10-17 05:33:28 -0500

magnux gravatar image

updated 2014-10-17 12:16:37 -0500

I'm trying to connect the android pubsub tutorial of android_core with a master core in my server.

I'm using ros indigo, which I installed in ubuntu using apt; and compiled rosjava and android_core from scratch.

Actually the example runs fine and I'm able to see the android subscriber getting the messages in the listener activity, which are sent from the talker node written in rosjava and runs also within the android emulator.

And when I run an additional listener node, it seems to subscribe fine:

rostopic info /chatter
Type: std_msgs/String

 * /rosjava_tutorial_pubsub/talker (

 * /listener_6323_1412952506377 (http://laptop:37300/)
 * /android_gingerbread/ros_text_view (

The problem is that even if it is subscribed, the python listener won't see anything, the messages sent by the talker in the emulator arrive fine to the listener in the emulator, but not to the outside listener.

Also I noticed several glitches in the tools when combined with the android example:

  • I tried to send messages from the console using rostopic, and they are received fine by the listener in the console, but the listener in the emulator won't see it.

  • rostopic sees the topic /chatter, but rostopic echo /chatter wont print anything either.

  • When I run rqt_graph, it stops working right after I launch the android APP. And it wont work at all if I close and reopen, I have to restart the roscore in order to use it again.

I'm using the ROS_MASTER_URI set to my IP, in both console and emulator, so there shouldn't be mismatches in the namespace.

I checked the rosjava distribution to see if the git branches were correct and all of them seem to be the latest (indigo-devel most of them).

I saw this commit has to do with msg headers: could it be related?

What could be happening here?, Namespace problem of the messages?, version incompatibility problem?. IDK.


EDIT: I couln't get it to work on the emulator, but the problem was getting to the net interface of the virtual device. In a real device, the exact same setup works fine. The bugs also dissapeared, I guess the problem is that when ros tools can't get to the devices for information they crash, that includes rqt_graph and some others.

edit retag flag offensive close merge delete


You mention ROS_MASTER_URI, but have you checked whether you need ROS_IP as well? If there is no working DNS for your hosts, you probably need that. I've done the exact same thing you're trying to do (albeit with Hydro) and it definitely can work.

gvdhoorn gravatar image gvdhoorn  ( 2014-10-17 06:31:41 -0500 )edit

Nice to hear it can work, I don't have a DNS, where should I set the ROS_IP variable? in my server or in my app?

magnux gravatar image magnux  ( 2014-10-17 06:52:53 -0500 )edit

I had setted the ROS_HOSTNAME var, to my IP, I forgot to mention, but now I also setted the ROS_IP var. No changes so far. :(

magnux gravatar image magnux  ( 2014-10-17 07:04:16 -0500 )edit

Easiest is probably to make sure you got your network setup correctly. See ROS/NetworkSetup and Tutorials/MultipleMachines on the ROS wiki.

gvdhoorn gravatar image gvdhoorn  ( 2014-10-17 07:10:22 -0500 )edit

I already followed that tutorial, and see the wiki several times, :/. If I'm doing something wrong I don't know what is (obviously). I guess it could be related to that but as I said, I'm running with ROS_MASTER_URI setted to my IP, and the example works fine, however subscribing from outside is not

magnux gravatar image magnux  ( 2014-10-17 07:19:09 -0500 )edit

when you did it, you had to setup a port forwarding for the emulator or something like that?

magnux gravatar image magnux  ( 2014-10-17 07:58:37 -0500 )edit

IIRC, without a working DNS, you need to make sure all your nodes use only their IP. A subscription needs comms to work both ways: in your example I see, but also laptop. Without DNS, that won't work. Set ROS_IP on all machines (virtual or not) to their own IP.

gvdhoorn gravatar image gvdhoorn  ( 2014-10-17 09:27:58 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-10-17 09:52:46 -0500

gvdhoorn gravatar image

Besides the usual suspects (working DNS, using ROS_IP, ROS_MASTER_URI, etc), be sure there is real bi-directional communication possible between the involved hosts. Especially if your emulator is not running on the same host as your ROS master / other nodes.

See the Using Network Redirection subsection in the Emulator Networking section under Setting Up Virtual Devices in Using the Emulator on the Android Developer site.

edit flag offensive delete link more


Ok. Actually I couldn't get the redirection to work. But, with the exact same setup, I was able to make it work, not on the emulator, but on a real device. I guess that if you could get the redirection done right, it could work, however, It is a waste of time because ports change every run.

magnux gravatar image magnux  ( 2014-10-17 12:12:36 -0500 )edit

Question Tools

1 follower


Asked: 2014-10-17 05:33:28 -0500

Seen: 745 times

Last updated: Oct 17 '14