1 import roslib; roslib.load_manifest(
'joy_listener')
3 from sensor_msgs.msg
import Joy
6 def __init__(self, wait_time=1.0, joy_topic='/joy'):
8 self.
sub = rospy.Subscriber(joy_topic, Joy, self.
joy_cb, queue_size=1)
14 now = rospy.Time.now()
18 for button, function
in self.iteritems():
27 PS3_BUTTONS = [
'select',
'left_joy',
'right_joy',
'start',
'up',
'right',
'down',
'left',
'l2',
'r2',
'l1',
'r1',
'triangle',
'circle',
'x',
'square',
'ps3']
29 return PS3_BUTTONS.index(name)
32 WII_BUTTONS = [
'1',
'2',
'a',
'b',
'+',
'-',
'left',
'right',
'up',
'down',
'home']
35 return WII_BUTTONS.index(name)
def __init__(self, wait_time=1.0, joy_topic='/joy')