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

varatyst's profile - activity

2016-03-10 20:08:07 -0500 received badge  Notable Question (source)
2015-10-12 00:25:11 -0500 received badge  Popular Question (source)
2015-02-25 09:20:33 -0500 answered a question turning java DM into ROS node

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.

2015-02-24 09:03:45 -0500 asked a question turning java DM into ROS node

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());
    }
  });
}