How to write the publisher in Python correctly?
Hi! I'm very confused... I failed to follow the instructions from http://library.isr.ist.utl.pt/docs/ro...
1 #!/usr/bin/env python
2 # license removed for brevity
3 import rospy
4 from std_msgs.msg import String
5
6 def publisher():
7 pub = rospy.Publisher('chatter', String, queue_size=10)
.........
I have a file name publisher.py and it has
float32 a
float32 b
float32 c
Should I do the following? But it doesn't work. What should I do so it pulls the data from publisher.py?
1 #!/usr/bin/env python
2 # license removed for brevity
3 import rospy
4 from std_msgs.msg import Float32
5
6 def publisher():
7 pub = rospy.Publisher('topicName', Float32, queue_size=10)
Have you gone through the official tutorials of the ROS wiki? The tutorial you link to is pretty out-of-date, it is from 2011. The official tutorials should actually cover/answer all your questions. Once you've checked those and still have issues, please post them here by editing your question...
@mgruhler Thank you!