publish arrays to a topic on the command line
Hi all,
I am new to ROS and experimenting with several things. Now I have the following problem: I want to define a topic where the type contains arrays of strings and floats. So I wrote a file Arrays.msg that contains
string[] name
float32[] value
and a simple Subscriber node:
import roslib; roslib.load_manifest("playground")
import rospy
from playground.msg import Arrays
def callback(data):
print "test"
def main():
rospy.init_node("array_test_node")
sub = rospy.Subscriber("array_test", Arrays, callback)
rospy.spin()
if __name__ == "__main__":
main()
Now my question is: How do I publish a list of strings and floats on the command line? It works when I type
rostopic pub /array_test playground/Arrays -- ["Foo"] [1.1]
and it publishes the correct message on /array_test. But what if I have more strings? I tried
rostopic pub /array_test playground/Arrays -- ["Foo", "Bar"] [1.1, 2.2]
but I get the following error message:
rostopic: error: Argument error: while parsing a flow node
expected the node content, but found '<stream end>'
in "<string>", line 1, column 6:
[Foo,
^
What would be the correct command for publishing these arrays on the command line?
Thanks!