rosjava custom messages: can compile and import, but not use as expected
I am using rosindigo and rosjava. I created a rosjava_message package to create a custom foo.msg for use in my rosjava node. I followed the example in http://wiki.ros.org/rosjava/Tutorials/hydro/Unofficial%20Messages
Ros recognizes my message:
rosmsg show foo_msgs/foo
int32 intVar
float32 floatVar
string stringVar
I see it is built and foo.class looks reasonable. The generated cpp files look good too.
I can import foo_msgs.foo in my publisher node and create a publisher:
final Publisher<foo> publisher_custom = connectedNode.newPublisher("/custom/topic", foo._TYPE); foo_msgs.foo myMessage = publisher_custom.newMessage(); foo_msgs.foo myMessage = publisher_custom.newMessage();
Now I expect to be able to do myMessage.setIntVar(5), but that results in a compilation error.
If I use java's inspection to print the methods available to myMessage, it's the same methods availabe if it was a std_msgs.String message!
If I do rostopic echo /custom/topic, an exception results. I the rostopic echo expects my foo message type, but I think the std_msgs.String is being used and results in this exception:
WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x063b05a0, /127.0.0.1:40396 :> /127.0.0.1:43938] EXCEPTION: java.lang.IllegalStateException: Unexpected message MD5 c9954cba4a4cc14c464daad6dfbafe15 != 131c7b16e90d7646b67a1c83cd590279) org.ros.exception.RosRuntimeException: java.lang.IllegalStateException: Unexpected message MD5 c9954cba4a4cc14c464daad6dfbafe15 != 131c7b16e90d7646b67a1c83cd590279 at org.ros.internal.transport.ConnectionTrackingHandler.exceptionCaught(ConnectionTrackingHandler.java:81) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:533) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:49) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:458) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:439) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:91) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:373) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:247) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: Unexpected message MD5 c9954cba4a4cc14c464daad6dfbafe15 != 131c7b16e90d7646b67a1c83cd590279 at com.google.common.base.Preconditions.checkState(Preconditions.java:149) at org.ros.internal.node.topic.DefaultPublisher.finishHandshake(DefaultPublisher.java:176) at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.handleSubscriberHandshake(TcpServerHandshakeHandler.java:97) at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.messageReceived(TcpServerHandshakeHandler.java:67) ... 13 more
Any pointers on how to proceed? I don't understand why the class I'm importing somehow isn't the right class(?). I only define foo.msg in one place.
Asked by ears_and_tails on 2014-11-25 14:06:06 UTC
Comments