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

I got it working with the codes below. Hope this helps those who's trying to familiarize with programming the Nao on ROS

#!/usr/bin/env python
import rospy
from std_msgs.msg import String

def naotalker():
    pub = rospy.Publisher('chatter', String)
    rospy.init_node('naotalk')
    while not rospy.is_shutdown():
        str = "hello world"
        rospy.loginfo(str)
        pub.publish(String(str))
        rospy.sleep(1.0)

if __name__ == '__main__':
    try:
        naotalker()
    except rospy.ROSInterruptException:
        pass