0
$\begingroup$

Rosanswers logo

Dear all,

I try to include an external library to the example of rosjava_tutorial_pubsub_Listener.

I modified the code as follows:

 package org.ros.tutorials.pubsub;
 import org.apache.commons.logging.Log;
 import org.ros.message.MessageListener;
 import org.ros.namespace.GraphName;
 import org.ros.node.Node;
 import org.ros.node.NodeMain;
 import org.ros.node.topic.Subscriber;
 import cylinder_reasoner.*;

 /**
 * This is a simple rosjava {@link Subscriber} {@link Node}. It assumes an
 * external roscore is already running.
 * 
 * @author [email protected] (Damon Kohler)
 */
 public class Listener implements NodeMain {

  @Override
  public GraphName getDefaultNodeName() {
  return new GraphName("rosjava_tutorial_pubsub/listener");
  }

   @Override
   public void onStart(Node node) {
   final Log log = node.getLog();
   CylinderReasoner reasoner=new CylinderReasoner();
   reasoner.doReasoning("//home//eich//Cylinders.txt");

   Subscriber<org.ros.message.std_msgs.String> subscriber =
     node.newSubscriber("chatter", "std_msgs/String");
    subscriber.addMessageListener(new MessageListener<org.ros.message.std_msgs.String>()   
   {
    @Override
    public void onNewMessage(org.ros.message.std_msgs.String message) {
     log.info("I heard: \"" + message.data + "\"");
  }
});
}`

Than I added the following line to the manifest.txt

<rosjava-pathelement location="/home/eich/Test.jar" />

Test Test.jar contains the Package cylinder_reasoner.CylinderReasoner.

Problem is I cannot compile. The error is that

Listener.java:25: package cylinder_reasoner does not exist

Do I have to set the jar file somewhere else as well? Or only in the manifest. After calling rosmake, the .classpath is updated correctly, but it cannot find the package.

Do you have any ideas?

Thank you


Originally posted by Markus Eich on ROS Answers with karma: 202 on 2012-01-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I solved the problem by adding the needed jars files to the ros.properties. This seems to work. The problem is I have to add them every time I call rosmake.


Originally posted by Markus Eich with karma: 202 on 2012-02-01

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by damonkohler on 2012-02-02:
Sounds like a bug. I've filed this issue: http://code.google.com/p/rosjava/issues/detail?id=85

Comment by Markus Eich on 2012-02-15:
I also tried to use relative path (i.e. the jars are in the root directory of the rosjava project). They are not added to ros.properties either.

$\endgroup$

Your Answer

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