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