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

How to connect Rosjava talker to a C++ Listener

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

mikegulf gravatar image

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

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 WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x4b3ec2dd, / :> /] 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( at at at at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived( at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode( at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived( at at at at at at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at Caused by: java.lang.IllegalStateException: Unexpected message MD5 fee433c609b213f85c484ba6dc0f8c7c != 74765c06a94b3265f1c21e7d818205cd at at org.ros.internal.node.topic.DefaultPublisher.finishHandshake( at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.handleSubscriberHandshake( at org.ros.internal.transport.tcp.TcpServerHandshakeHandler.messageReceived( ... 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.


edit retag flag offensive close merge delete


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 -0600 )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 -0600 )edit

1 Answer

Sort by » oldest newest most voted

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

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


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 -0600 )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 -0600 )edit

Question Tools

1 follower


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

Seen: 1,247 times

Last updated: May 13 '12