Ask Your Question
0

Error after adding new listener on android

asked 2013-05-14 13:35:43 -0500

grzebyk gravatar image

Hi, I have launched a simple publisher on my linux pc with ros and then i tried to modify the pubsub tutorial to show messages published by ros machine on the phone screen. Logcat informs me that subscriber was succesfully registered but there are also some errors. In the end nothing appears on my android device screen. Could you help me resolve this problem?

Here is code: MainActivity

public class MainActivity extends RosActivity {

  private RosTextView<std_msgs.String> rosTextViewPublikowanie;

  public MainActivity() {
    // The RosActivity constructor configures the notification title and ticker
    // messages.
    super("Pubsub Tutorial", "Pubsub Tutorial");
  }

  @SuppressWarnings("unchecked")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    rosTextViewPublikowanie = (RosTextView<std_msgs.String>) findViewById(R.id.text_publikowanie);
    rosTextViewPublikowanie.setTopicName("publikowanie");
    rosTextViewPublikowanie.setMessageType(std_msgs.String._TYPE);
    rosTextViewPublikowanie.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
      @Override
      public String call(std_msgs.String message) {
        return message.getData();
      }
    });
  }

  @Override
  protected void init(NodeMainExecutor nodeMainExecutor) {
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPrivate();
    nodeConfiguration.setMasterUri(getMasterUri());
    nodeMainExecutor.execute(rosTextViewPublikowanie, nodeConfiguration);
  }

and a Listener

public class Listener extends AbstractNodeMain {

  @Override
  public GraphName getDefaultNodeName() {
    return GraphName.of("rosjava_tutorial_pubsub/listener");
  }

  @Override
  public void onStart(ConnectedNode connectedNode) {
    final Log log = connectedNode.getLog();
    Subscriber<std_msgs.String> sub_publikowanie = connectedNode.newSubscriber("publikowanie", std_msgs.String._TYPE);
    sub_publikowanie.addMessageListener(new MessageListener<std_msgs.String>() {
      @Override
      public void onNewMessage(std_msgs.String message) {
        log.info("I heard: \"" + message.getData() + "\"");
      }
    });
  }

and Logcat

05-15 01:23:24.439: E/dalvikvm(23345): Could not find class 'java.util.concurrent.LinkedTransferQueue', referenced from method org.jboss.netty.util.internal.QueueFactory.createQueue
05-15 01:23:24.439: W/dalvikvm(23345): VFY: unable to resolve new-instance 2378 (Ljava/util/concurrent/LinkedTransferQueue;) in Lorg/jboss/netty/util/internal/QueueFactory;
05-15 01:23:24.479: E/dalvikvm(23345): Could not find class 'java.util.concurrent.LinkedTransferQueue', referenced from method org.jboss.netty.util.internal.QueueFactory.createQueue
05-15 01:23:24.479: W/dalvikvm(23345): VFY: unable to resolve new-instance 2378 (Ljava/util/concurrent/LinkedTransferQueue;) in Lorg/jboss/netty/util/internal/QueueFactory;
05-15 01:23:24.539: I/Registrar(23345): MasterXmlRpcEndpoint URI: http:/----/
05-15 01:23:24.599: I/Registrar(23345): Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android_gingerbread/ros_text_view, http:/----/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
05-15 01:23:24.909: I/Registrar(23345): Response<Success, Registered [/android_gingerbread/ros_text_view] as publisher of [/rosout], [http://Salon-Linux:42216/]>
05-15 01:23:24.909: I/DefaultPublisher(23345): Publisher registered: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</android_gingerbread/ros_text_view, http:/-------/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
05-15 01:23:24.939: I/Registrar(23345): Registering subscriber: Subscriber<Topic<TopicIdentifier</publikowanie>, TopicDescription<std_msgs/String, 992ce8a1687cec8c8bd883ec73ca41d1>>>
05-15 01:23:24.959: I/Registrar(23345): Response<Success, Subscribed to [/publikowanie], [http://Salon-Linux:42897/]>
05-15 01:23:24.969: I/DefaultPublisher(23345): Subscriber registered: Subscriber<Topic<TopicIdentifier</publikowanie>, TopicDescription<std_msgs/String, 992ce8a1687cec8c8bd883ec73ca41d1>>>
05-15 01:23:25.029: E/UpdatePublisherRunnable(23345): java.lang.RuntimeException: java.net.UnknownHostException: Salon-Linux
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-06-10 03:29:53 -0500

grzebyk gravatar image

Maybe it's quite late to answer my own question but i've forgotten about it...

The problem with UnknowHostException was connected with wrong ROS_IP and ROS_MASTER_URI setup.

The problem Could not find class 'java.util.concurrent.LinkedTransferQueue' persisted but it didn't have any influence at how program worked that time. Later it has just disappeared with further development but I am unable to tell why.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-14 13:35:43 -0500

Seen: 786 times

Last updated: Jun 10 '13