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 this code. Please also refer to nao_driver nao_msgs

#!/usr/bin/env python
import rospy
from nao_msgs.msg import TactileTouch

def callback(data):
    rospy.loginfo( "I heard %u %u" % (data.button, data.state))

def tactilelistener():

    # in ROS, nodes are unique named. If two nodes with the same
    # node are launched, the previous one is kicked off. The 
    # anonymous=True flag means that rospy will choose a unique
    # name for our 'talker' node so that multiple talkers can
    # run simultaenously.
    rospy.init_node('tactilelistener', anonymous=True)

    rospy.Subscriber("tactile_touch", TactileTouch, callback)

    # spin() simply keeps python from exiting until this node is stopped
    rospy.spin()

if __name__ == '__main__':
    tactilelistener()

I got it working with this code. Please also refer to nao_driver nao_driver and nao_msgs

#!/usr/bin/env python
import rospy
from nao_msgs.msg import TactileTouch

def callback(data):
    rospy.loginfo( "I heard %u %u" % (data.button, data.state))

def tactilelistener():

    # in ROS, nodes are unique named. If two nodes with the same
    # node are launched, the previous one is kicked off. The 
    # anonymous=True flag means that rospy will choose a unique
    # name for our 'talker' node so that multiple talkers can
    # run simultaenously.
    rospy.init_node('tactilelistener', anonymous=True)

    rospy.Subscriber("tactile_touch", TactileTouch, callback)

    # spin() simply keeps python from exiting until this node is stopped
    rospy.spin()

if __name__ == '__main__':
    tactilelistener()