0
$\begingroup$

Rosanswers logo

I am trying to turn a java dialogue manager into a ROS node. I attempt to do so by adding the libraries for ROSjava to the eclipse build path of the DM, and adding the code that is supplied as an example with ROSjava. This however does not by itself call the onStart method. No topics or nodes are found that belong to the DM when running the project through eclipse. Is there a way to launch it without using the rosjava build script or adding it to catkin_ws?

public class DialogueSystem extends AbstractNodeMain {

  public GraphName getDefaultNodeName() {
    return GraphName.of("rosjava/listener");
  }

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

Originally posted by varatyst on ROS Answers with karma: 16 on 2015-02-24

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

In case anyone ever has the same problem and finds this thread:

Adding it to the catkin workspace is not necessary. I opted to use a modified version of the rosjava build script (located at project/build/install/project/bin/project). as this seemed the best way to run org.ros.RosRun which has to call onStart. The class the code from the question is in is passed as an argument to RosRun/the build script.


Originally posted by varatyst with karma: 16 on 2015-02-25

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.