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

turning java DM into ROS node

asked 2015-02-24 08:54:52 -0500

varatyst gravatar image

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");

  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>() {
    public void onNewMessage(std_msgs.String message) {"I heard: \"" + message.getData() + "\"");
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-02-25 09:20:33 -0500

varatyst gravatar image

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.

edit flag offensive delete link more

Question Tools



Asked: 2015-02-24 08:54:52 -0500

Seen: 450 times

Last updated: Feb 25 '15