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

How to connect Rosjava talker to a C++ Listener

asked 2012-05-11 09:16:33 -0500

mikegulf gravatar image

updated 2014-01-28 17:12:18 -0500

ngrennan gravatar image

I have created a talker in in rosjava and have created a listener in C++ code. When I run the talker and the start the listener I see this on the talker screen...

May 11, 2012 2:53:01 PM org.jboss.netty.channel.DefaultChannelPipeline WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x4b3ec2dd, /127.0.0.1:40815 :> /127.0.0.1:42634] EXCEPTION: java.lang.IllegalStateException: Unexpected message MD5 fee433c609b213f85c484ba6dc0f8c7c != 74765c06a94b3265f1c21e7d818205cd) org.ros.exception.RosRuntimeException: java.lang.IllegalStateException: Unexpected message MD5 fee433c609b213f85c484ba6dc0f8c7c != 74765c06a94b3265f1c21e7d818205cd at org.ros.internal.transport.ConnectionTrackingHandler.exceptionCaught(ConnectionTrackingHandler.java:73) at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:432) at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:52) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:317) at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:299) at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:216) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679) Caused by: java.lang.IllegalStateException: Unexpected message MD5 fee433c609b213f85c484ba6dc0f8c7c != 74765c06a94b3265f1c21e7d818205cd at com.google.common.base.Preconditions.checkState(Preconditions.java:145) at org.ros.internal.node.topic.DefaultPublisher.finishHandshake(DefaultPublisher.java:179) at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.handleSubscriberHandshake(TcpServerHandshakeHandler.java:99) at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.messageReceived(TcpServerHandshakeHandler.java:69) ... 12 more

I know that the talker and listener are working correctly all in rosjava but when I try to connect it with C++ node I get this error. Roscore is running on localhost:11311. What am I missing here? It also fails when I do a rostopic echo chatter.

Thanks

edit retag flag offensive close merge delete

Comments

Looks like the message checksums do not match. What message are you trying to send?

joq gravatar image joq  ( 2012-05-11 12:10:00 -0500 )edit

I tried doing custom messages at first but then checked by sending a string and it did the same thing.

mikegulf gravatar image mikegulf  ( 2012-05-11 14:09:58 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2012-05-13 23:08:34 -0500

The message means that the Rosjava publisher is trying to publish a message to a topic on which the C++ listener already listens, but the publisher's message type doesn't match the subscriber's message type. This can have two reasons:

  1. Publisher and subscriber use different message types (e.g., one uses std_msgs/String and the other std_msgs/Int8).

  2. Both use the same message type, but were built with different versions of it.

To debug (1), you can do the following:

  • start a new roscore (!)
  • start the subscriber
  • do a rosnode info on the subscriber
  • repeat the same for the publisher (after restarting the roscore) and see whether subscription and publication match up

To debug (2), you can

  • make sure that your ROS_PACKAGE_PATH and ROS_ROOT are set up correctly
  • rebuild your message package, if you are using custom messages
  • rebuild your subscriber and your publisher (that way you know that both used the same environment variables when they were build)

I don't have any experience with the newest rosjava build system using gradle, but before the switch to gradle, it usually also helped to do the following, then rebuild the rosjava nodes:

rm -rf ~/.m2/ ~/.ros/rosjava/
(cd $(rosstack find rosjava_core) && hg clean --all)
edit flag offensive delete link more

Comments

Thanks for the tips. It turned out I was sending one type of message and wanting to receive a different one. Once I got things aligned and was sending the proper message I was good. I appreciate your help.

mikegulf gravatar image mikegulf  ( 2012-05-17 04:07:23 -0500 )edit

Glad to help! Please mark the answer as correct (check box to the left).

Martin Günther gravatar image Martin Günther  ( 2012-05-21 06:04:46 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-05-11 09:16:33 -0500

Seen: 1,248 times

Last updated: May 13 '12