Can a rosjava node subscribe to a topic without specifying the message type?

asked 2015-07-16 11:11:20 -0600

RSamaniego gravatar image

updated 2015-07-17 02:46:59 -0600

Hello.

I want to build a generic subscriber in java (think "rostopic echo"), capable of receiving any message, no matter the type.

I see that org.ros.node.topic.Subscriber interface defines the token TOPIC_MESSAGE_TYPE_WILDCARD, which is equal to an asterisk character and is commented as "The message type given when a Subscriber chooses not to commit to a specific message type.", but I am not able to get this working.

The line:

Subscriber<Message> subscriber = connectedNode.newSubscriber(topic, Subscriber.TOPIC_MESSAGE_TYPE_WILDCARD);

Produces the following exception:

Exception in thread "pool-1-thread-3" org.ros.exception.RosMessageRuntimeException: java.lang.ClassNotFoundException: *
at org.ros.internal.message.definition.MessageDefinitionReflectionProvider.get(MessageDefinitionReflectionProvider.java:58)
at org.ros.internal.message.Md5Generator.generate(Md5Generator.java:44)
at org.ros.internal.message.topic.TopicDescriptionFactory.newFromType(TopicDescriptionFactory.java:36)
at org.ros.internal.node.DefaultNode.newSubscriber(DefaultNode.java:286)
at org.ros.internal.node.DefaultNode.newSubscriber(DefaultNode.java:297)

The java process is on a different machine than roscore. I am using ROS Indigo and rosjava_core version is 0.2.1

What am I doing wrong?

Best regards,

Ricardo.

edit retag flag offensive close merge delete