Ask Your Question

Created a custom msg to support an array of strings but I get thhis warning msg when i use it..

asked 2014-06-01 23:33:33 -0500

uzair gravatar image

updated 2014-06-03 15:56:16 -0500

I created a custom msg which is an array or strings. this is my declaration:

    string[] data

However when I use this msg, i get a warning. I dont understand why I get this warning.

   [WARN] [WallTime: 1401683261.952534] Could not process inbound connection: topic types do not match:[std_msgs/String] vs. [beginner_tutorials/StringArray]{'message_definition': 'string data\n\n', 'callerid': '/rostopic_3711_1401673205336', 'tcp_nodelay': '0', 'md5sum': '992ce8a1687cec8c8bd883ec73ca41d1', 'topic': '/tag_history', 'type': 'std_msgs/String'}

Can somebody please tell me how I can get rid of this? THanks

My code where i am using ths StringArray datatype:

#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from beginner_tutorials.msg import StringArray

def callback(data):
    global c
    pub = rospy.Publisher('tag_history',StringArray)
    if len(c)>3:
    print str

 def listener():

 rospy.init_node('tag_history', anonymous=True)

 rospy.Subscriber("DA_tags", String, callback)

if __name__ == '__main__':

 global c

This is the data i see when i enter "rostopic echo DA_tags"

 uahmed9@uahmed9-Lenovo-IdeaPad-U410-Touch:~$ rostopic echo DA_tags
 data: Query-yn
 data: Unknown
 data: Unknown
 data: Acknowledge
 data: Unknown
 data: Unknown

This is the output for rostopic info DA_tags

uahmed9@uahmed9-Lenovo-IdeaPad-U410-Touch:~$ rostopic info DA_tags
Type: std_msgs/String

 * /rosjava_tutorial_pubsub/listener (

 * /tag_history_32168_1401828816089 (http://uahmed9-Lenovo-IdeaPad-U410-Touch:51087/)
edit retag flag offensive close merge delete



Seems like you're publishing to a topic of Type 'beginner_tutorials/StringArray'. Is this correct? If this is the case you have to use this type.

BennyRe gravatar image BennyRe  ( 2014-06-02 02:05:52 -0500 )edit

yes I am publishing to that topic. I edited my post to paste my code for reference.

uzair gravatar image uzair  ( 2014-06-02 02:27:34 -0500 )edit

Please post also the output of rostopic info /DA_tags. BTW: Why do you mention your custom message? I'm asking because you don't use it.

BennyRe gravatar image BennyRe  ( 2014-06-02 02:39:28 -0500 )edit

the data on DA_tags consists of words like "check","acknowledge","unknown" etc. Thse are the outputs from the classifier that I am impelemnting in ROS. Also I am using my custom message. I created StringArray following the message creation tutorial in the ROS documentation.

uzair gravatar image uzair  ( 2014-06-02 13:16:21 -0500 )edit

Please post also the output of rostopic info /DA_tags.

BennyRe gravatar image BennyRe  ( 2014-06-03 01:39:14 -0500 )edit

I edited the question to post the output. Take a look.

uzair gravatar image uzair  ( 2014-06-03 15:48:04 -0500 )edit

Also I ran both the nodes today and I dont see the warning anymore. wonder what the problem was.

uzair gravatar image uzair  ( 2014-06-03 15:57:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-03 17:19:07 -0500

ahendrix gravatar image

In general, this message means that the subscriber on a topic was expecting one data type, but the publisher is using a different data type.

edit flag offensive delete link more


Exactly. Bu right now my requirement is that , i convert the message to the one that the topic is expecting. Is that possible if so how?

NagaDinesh1194 gravatar image NagaDinesh1194  ( 2019-03-18 09:51:32 -0500 )edit

@NagaDinesh1194 it sounds like you have a different question. Please ask it as a new question instead of commenting on an old question.

ahendrix gravatar image ahendrix  ( 2019-03-18 11:39:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-06-01 23:33:33 -0500

Seen: 2,997 times

Last updated: Jun 03 '14