Ask Your Question
1

rosjava listener(pub/sub example) error

asked 2011-06-21 21:19:05 -0500

hughie gravatar image

Hi, I am trying to Listening the Hello message by rosjava(pure java) client. The error is occured, when received a message from publisher. I ran roscore(not in rosjava) and I sent the message by rostopic pub /chatter std_msgs/String -1 "Hello".

    Jun 22, 2011 5:00:10 PM org.ros.internal.node.RosoutLogger info
INFO: I heard: "Hello"
Exception in thread "Thread-4" java.lang.NoSuchMethodError: org.ros.Publisher.publish(Lorg/ros/message/Message;)V
    at org.ros.internal.node.RosoutLogger.publishToRosout(RosoutLogger.java:64)
    at org.ros.internal.node.RosoutLogger.info(RosoutLogger.java:139)
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(Listener.java:45)
    at org.ros.tutorials.pubsub.Listener$1.onNewMessage(Listener.java:42)
    at org.ros.internal.node.topic.Subscriber$MessageReadingThread.run(Subscriber.java:85)

client source is as below.

import org.ros.NodeConfiguration;
import org.ros.tutorials.pubsub.*;

public class ROS_Listener {
        public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("Hello - Listener");

        org.ros.NodeConfiguration node_cfg = org.ros.NodeConfiguration.createDefault();
        org.ros.tutorials.pubsub.Listener ros_listener = new org.ros.tutorials.pubsub.Listener();
        ros_listener.main(node_cfg);
      }
    }

How can I solve this problem?

Thanks.

edit retag flag offensive close merge delete

Comments

That's a pretty strange error. Maybe you should try doing a clean compile?
damonkohler gravatar imagedamonkohler ( 2011-06-22 08:32:04 -0500 )edit
Thanks for answer. I cleaned this project. but, It has same error.
hughie gravatar imagehughie ( 2011-06-23 12:19:46 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-06-27 07:06:26 -0500

damonkohler gravatar image

I tried this myself at the latest revision by doing the following (which worked for me). Please pull the latest version of rosjava and try to get it working like this:

roscd rosjava rosmake ant dist roscore rosrun rosjava run org.ros.tutorials.pubsub.Listener rostopic pub /chatter std_msgs/String -1 "Hello"

edit flag offensive delete link more

Comments

Yes, I have pulled latest revision. It is working well. than you.
hughie gravatar imagehughie ( 2011-06-28 00:37:22 -0500 )edit

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: 2011-06-21 21:19:05 -0500

Seen: 349 times

Last updated: Jun 27 '11