0
$\begingroup$

Rosanswers logo

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/)

Originally posted by uzair on ROS Answers with karma: 87 on 2014-06-01

Post score: 1


Original comments

Comment by BennyRe on 2014-06-02:
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.

Comment by uzair on 2014-06-02:
yes I am publishing to that topic. I edited my post to paste my code for reference.

Comment by BennyRe on 2014-06-02:
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.

Comment by uzair on 2014-06-02:
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.

Comment by BennyRe on 2014-06-03:
Please post also the output of rostopic info /DA_tags.

Comment by uzair on 2014-06-03:
I edited the question to post the output. Take a look.

Comment by uzair on 2014-06-03:
Also I ran both the nodes today and I dont see the warning anymore. wonder what the problem was.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ahendrix with karma: 47576 on 2014-06-03

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by NagaDinesh1194 on 2019-03-18:
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?

Comment by ahendrix on 2019-03-18:
@NagaDinesh1194 it sounds like you have a different question. Please ask it as a new question instead of commenting on an old question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.