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

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

uzair gravatar image

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

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
    str=StringArray()
    pub = rospy.Publisher('tag_history',StringArray)
    c.append(data.data)
    if len(c)>3:
       c=c[1:4]    
    str.data=c
    print str
   pub.publish(str)


 def listener():

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

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


if __name__ == '__main__':

 global c
 c=[]
 listener()

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

Publishers: 
 * /rosjava_tutorial_pubsub/listener (http://127.0.0.1:59178/)

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

Comments

1

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

Please post also the output of rostopic info /DA_tags.

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

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

uzair gravatar image uzair  ( 2014-06-03 15:48:04 -0600 )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 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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

Question Tools

1 follower

Stats

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

Seen: 3,549 times

Last updated: Jun 03 '14