ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I usually program in C++ when working with ROS. By the way, what you first define as publisher.py
is not a python file, it is a message file and it must be a *.msg file. Once you've written the code of your *.msg file, you must compile it in order to let ROS create the header file for that message.
To use that message, lets imagine you've called your message my_msg, so you must write in python something like this:
import rospy
from your_ros_package_name import my_msg
def publisher():
pub = rospy.Publisher('topicName',my_msg, queue_size=10)
Try with something like this. It could be some python spelling mistake because as I've already told you I am used to work with C++ nodes.