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

rosjava subscriber unreliable

asked 2012-01-12 12:16:09 -0500

ahendrix gravatar image

updated 2014-01-28 17:11:07 -0500

ngrennan gravatar image

I have a python node that publishes a latched topic, and a rosjava subscriber running on an android device. If I start the publisher first, the subscriber receives the latched message just fine. If I start the subscriber first, it doesn't receive any messages when I start the publisher.

This could be a problem in one of at least three places:

  1. My code
  2. IP selection in ros.android.util.MasterChooser, although I think I've corrected this. See: https://kforge.ros.org/appmanandroid/trac/ticket/26 for more details.
  3. The publisherUpdate XMR-RPC callback mechanism

I suspect #3, but I'm having a hard time tracing through the rosjava codebase to find the problem.

My subscriber code:

protected void onNodeCreate(Node node) {
   super.onNodeCreate();
   client_sub = node.newSubscriber("pr2_wifi/client_status", 
         "pr2_network_management/WifiStatus", new MessageListener<WifiStatus>() {
            public void onNewMessage(WifiStatus arg0) {
               Log.i("PR2WifiActivity", "Got client state. SSID: " + arg0.ssid);
               Handler.sendMessage(mHandler.obtainMessage(CLIENT_MSG, arg0));
            }
         }
   );
}
edit retag flag offensive close merge delete

Comments

I've updated rosjava_core, rosjava_android, and appmanandroid to head (as of about 10am PST), and I'm still seeing the same problem.
ahendrix gravatar image ahendrix  ( 2012-01-13 09:19:26 -0500 )edit
I cleaned and rebuilt everything (rm -rf ~/.ros/rosjava ~/.m2) and can no longer reproduce this. I guess it's fixed?
ahendrix gravatar image ahendrix  ( 2012-01-13 11:50:30 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-01-12 18:49:10 -0500

damonkohler gravatar image

This doesn't appear to be a problem at head. It's possible there is a bug in the currently released version of rosjava. I've added a regression test which you can see here:

http://code.google.com/p/rosjava/source/browse/rosjava/src/test/java/org/ros/node/topic/TopicIntegrationTest.java#109

edit flag offensive delete link more

Comments

Nice! It's always good to see more regression tests. Sadly, in my case the master and the publisher are running on a separate machine (the PR2) from the subscriber. Could this make a difference?
ahendrix gravatar image ahendrix  ( 2012-01-13 11:27:38 -0500 )edit
I suppose it's possible, but it shouldn't matter. All those tests are integration style and use the network interface.
damonkohler gravatar image damonkohler  ( 2012-01-14 03:57:36 -0500 )edit

Question Tools

Stats

Asked: 2012-01-12 12:16:09 -0500

Seen: 569 times

Last updated: Jan 12 '12