Can a rosjava node subscribe to a topic without specifying the message type?
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 TOPICMESSAGETYPE_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.
Asked by RSamaniego on 2015-07-16 10:55:32 UTC
Comments