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

Revision history [back]

click to hide/show revision 1
initial version

Solved it. Just added these lines

   //import statements for the publisher
   import org.ros.concurrent.CancellableLoop;
   import org.ros.node.topic.Publisher;


    final Publisher<std_msgs.String> publisher =
    connectedNode.newPublisher("chatter", std_msgs.String._TYPE);//added this line above the try block
    //added the following lines of code below  log.info("Classifier's output: \"" + da + "\"");
    std_msgs.String str = publisher.newMessage();
    str.setData(da);
    publisher.publish(str);

Solved it. Just added these lines

   //import statements statement for the publisher
   import org.ros.concurrent.CancellableLoop;
   import org.ros.node.topic.Publisher;


    final Publisher<std_msgs.String> publisher =
    connectedNode.newPublisher("chatter", std_msgs.String._TYPE);//added this line above the try block
    //added the following lines of code below  log.info("Classifier's output: \"" + da + "\"");
    std_msgs.String str = publisher.newMessage();
    str.setData(da);
    publisher.publish(str);