nanopad_status.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import roslib
5 
6 class NanoPAD2Status():
7  def __init__(self, msg):
8  if msg.buttons[0] == 1:
9  self.buttonU1 = True
10  else:
11  self.buttonU1 = False
12  if msg.buttons[1] == 1:
13  self.buttonU2 = True
14  else:
15  self.buttonU2 = False
16  if msg.buttons[2] == 1:
17  self.buttonU3 = True
18  else:
19  self.buttonU3 = False
20  if msg.buttons[3] == 1:
21  self.buttonU4 = True
22  else:
23  self.buttonU4 = False
24  if msg.buttons[4] == 1:
25  self.buttonU5 = True
26  else:
27  self.buttonU5 = False
28  if msg.buttons[5] == 1:
29  self.buttonU6 = True
30  else:
31  self.buttonU6 = False
32  if msg.buttons[6] == 1:
33  self.buttonU7 = True
34  else:
35  self.buttonU7 = False
36  if msg.buttons[7] == 1:
37  self.buttonU8 = True
38  else:
39  self.buttonU8 = False
40 
41  if msg.buttons[8] == 1:
42  self.buttonL1 = True
43  else:
44  self.buttonL1 = False
45  if msg.buttons[9] == 1:
46  self.buttonL2 = True
47  else:
48  self.buttonL2 = False
49  if msg.buttons[10] == 1:
50  self.buttonL3 = True
51  else:
52  self.buttonL3 = False
53  if msg.buttons[11] == 1:
54  self.buttonL4 = True
55  else:
56  self.buttonL4 = False
57  if msg.buttons[12] == 1:
58  self.buttonL5 = True
59  else:
60  self.buttonL5 = False
61  if msg.buttons[13] == 1:
62  self.buttonL6 = True
63  else:
64  self.buttonL6 = False
65  if msg.buttons[14] == 1:
66  self.buttonL7 = True
67  else:
68  self.buttonL7 = False
69  if msg.buttons[15] == 1:
70  self.buttonL8 = True
71  else:
72  self.buttonL8 = False
73 
74 
75 
76 import pprint
77 
78 def joyCB(msg):
79  status = NanoPAD2Status(msg)
80  pprint.PrettyPrinter().pprint(status.__dict__)
81 
82 
83 def main():
84  import roslib
85  import rospy
86  from sensor_msgs.msg import Joy
87 
88  rospy.sleep(1)
89  rospy.init_node('nanopad_controller')
90  s = rospy.Subscriber('/nanopad/joy', Joy, joyCB)
91 
92  rospy.spin()
93 
94 if __name__ == '__main__':
95  main()
96 
97 
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL4
buttonL4
Definition: nanopad_status.py:54
jsk_teleop_joy.nanopad_status.NanoPAD2Status
Definition: nanopad_status.py:6
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL1
buttonL1
Definition: nanopad_status.py:42
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU3
buttonU3
Definition: nanopad_status.py:17
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU5
buttonU5
Definition: nanopad_status.py:25
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU2
buttonU2
Definition: nanopad_status.py:13
jsk_teleop_joy.nanopad_status.NanoPAD2Status.__init__
def __init__(self, msg)
Definition: nanopad_status.py:7
jsk_teleop_joy.nanopad_status.main
def main()
Definition: nanopad_status.py:83
jsk_teleop_joy.nanopad_status.joyCB
def joyCB(msg)
Definition: nanopad_status.py:78
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU1
buttonU1
Definition: nanopad_status.py:9
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL5
buttonL5
Definition: nanopad_status.py:58
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU4
buttonU4
Definition: nanopad_status.py:21
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU7
buttonU7
Definition: nanopad_status.py:33
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL3
buttonL3
Definition: nanopad_status.py:50
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL6
buttonL6
Definition: nanopad_status.py:62
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL8
buttonL8
Definition: nanopad_status.py:70
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU8
buttonU8
Definition: nanopad_status.py:37
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL2
buttonL2
Definition: nanopad_status.py:46
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonU6
buttonU6
Definition: nanopad_status.py:29
jsk_teleop_joy.nanopad_status.NanoPAD2Status.buttonL7
buttonL7
Definition: nanopad_status.py:66
msg


jsk_teleop_joy
Author(s): Ryohei Ueda
autogenerated on Wed Jan 24 2024 04:05:49