ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is essentially right out of the ROS Python tutorial on writing a publisher and subscriber. That's the pattern that std_msgs uses. If you look in the std_msgs GitHub repo you'll see that message definitions are in the msg subdirectory. Since the package is called std_msgs and the definition is in the msg subdirectory you can use

from std_msgs.msg import Int32

For other packages you'd look at their documentation or their source code if there's no documentation.