Created a custom msg to support an array of strings but I get thhis warning msg when i use it..
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/)
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.
yes I am publishing to that topic. I edited my post to paste my code for reference.
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.
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.
Please post also the output of rostopic info /DA_tags.
I edited the question to post the output. Take a look.
Also I ran both the nodes today and I dont see the warning anymore. wonder what the problem was.