nanokontrol_status.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import roslib
5 
7  def __init__(self, msg):
8  if msg.buttons[0] == 1:
9  self.track_left = True
10  else:
11  self.track_left = False
12  if msg.buttons[1] == 1:
13  self.track_right = True
14  else:
15  self.track_right = False
16  if msg.buttons[2] == 1:
17  self.cycle = True
18  else:
19  self.cycle = False
20  if msg.buttons[3] == 1:
21  self.marker_set = True
22  else:
23  self.marker_set = False
24  if msg.buttons[4] == 1:
25  self.marker_left = True
26  else:
27  self.marker_left = False
28  if msg.buttons[5] == 1:
29  self.marker_right = True
30  else:
31  self.marker_right = False
32  if msg.buttons[6] == 1:
33  self.prev = True
34  else:
35  self.prev = False
36  if msg.buttons[7] == 1:
37  self.next = True
38  else:
39  self.next = False
40  if msg.buttons[8] == 1:
41  self.pause = True
42  else:
43  self.pause = False
44  if msg.buttons[9] == 1:
45  self.play = True
46  else:
47  self.play = False
48  if msg.buttons[10] == 1:
49  self.rec = True
50  else:
51  self.rec = False
52 
53  if msg.buttons[11] == 1:
54  self.S1 = True
55  else:
56  self.S1 = False
57  if msg.buttons[12] == 1:
58  self.S2 = True
59  else:
60  self.S2 = False
61  if msg.buttons[13] == 1:
62  self.S3 = True
63  else:
64  self.S3 = False
65  if msg.buttons[14] == 1:
66  self.S4 = True
67  else:
68  self.S4 = False
69  if msg.buttons[15] == 1:
70  self.S5 = True
71  else:
72  self.S5 = False
73  if msg.buttons[16] == 1:
74  self.S6 = True
75  else:
76  self.S6 = False
77  if msg.buttons[17] == 1:
78  self.S7 = True
79  else:
80  self.S7 = False
81  if msg.buttons[18] == 1:
82  self.S8 = True
83  else:
84  self.S8 = False
85  if msg.buttons[19] == 1:
86  self.M1 = True
87  else:
88  self.M1 = False
89  if msg.buttons[20] == 1:
90  self.M2 = True
91  else:
92  self.M2 = False
93  if msg.buttons[21] == 1:
94  self.M3 = True
95  else:
96  self.M3 = False
97  if msg.buttons[22] == 1:
98  self.M4 = True
99  else:
100  self.M4 = False
101  if msg.buttons[23] == 1:
102  self.M5 = True
103  else:
104  self.M5 = False
105  if msg.buttons[24] == 1:
106  self.M6 = True
107  else:
108  self.M6 = False
109  if msg.buttons[25] == 1:
110  self.M7 = True
111  else:
112  self.M7 = False
113  if msg.buttons[26] == 1:
114  self.M8 = True
115  else:
116  self.M8 = False
117  if msg.buttons[27] == 1:
118  self.R1 = True
119  else:
120  self.R1 = False
121  if msg.buttons[28] == 1:
122  self.R2 = True
123  else:
124  self.R2 = False
125  if msg.buttons[29] == 1:
126  self.R3 = True
127  else:
128  self.R3 = False
129  if msg.buttons[30] == 1:
130  self.R4 = True
131  else:
132  self.R4 = False
133  if msg.buttons[31] == 1:
134  self.R5 = True
135  else:
136  self.R5 = False
137  if msg.buttons[32] == 1:
138  self.R6 = True
139  else:
140  self.R6 = False
141  if msg.buttons[33] == 1:
142  self.R7 = True
143  else:
144  self.R7 = False
145  if msg.buttons[34] == 1:
146  self.R8 = True
147  else:
148  self.R8 = False
149 
150  self.rotate1 = msg.axes[0]
151  self.rotate2 = msg.axes[1]
152  self.rotate3 = msg.axes[2]
153  self.rotate4 = msg.axes[3]
154  self.rotate5 = msg.axes[4]
155  self.rotate6 = msg.axes[5]
156  self.rotate7 = msg.axes[6]
157  self.rotate8 = msg.axes[7]
158 
159  self.slide1 = msg.axes[8]
160  self.slide2 = msg.axes[9]
161  self.slide3 = msg.axes[10]
162  self.slide4 = msg.axes[11]
163  self.slide5 = msg.axes[12]
164  self.slide6 = msg.axes[13]
165  self.slide7 = msg.axes[14]
166  self.slide8 = msg.axes[15]
167 
168 
169 
170 import pprint
171 
172 def joyCB(msg):
173  status = NanoKONTROL2Status(msg)
174  pprint.PrettyPrinter().pprint(status.__dict__)
175 
176 
177 def main():
178  import roslib
179  import rospy
180  from sensor_msgs.msg import Joy
181 
182  rospy.sleep(1)
183  rospy.init_node('nanokontrol_controller')
184  s = rospy.Subscriber('/nanokontrol/joy', Joy, joyCB)
185 
186  rospy.spin()
187 
188 if __name__ == '__main__':
189  main()
190 
191 
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R2
R2
Definition: nanokontrol_status.py:122
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate3
rotate3
Definition: nanokontrol_status.py:152
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.marker_right
marker_right
Definition: nanokontrol_status.py:29
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R5
R5
Definition: nanokontrol_status.py:134
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate7
rotate7
Definition: nanokontrol_status.py:156
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.__init__
def __init__(self, msg)
Definition: nanokontrol_status.py:7
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M1
M1
Definition: nanokontrol_status.py:86
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide6
slide6
Definition: nanokontrol_status.py:164
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.marker_left
marker_left
Definition: nanokontrol_status.py:25
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S3
S3
Definition: nanokontrol_status.py:62
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S7
S7
Definition: nanokontrol_status.py:78
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M3
M3
Definition: nanokontrol_status.py:94
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate2
rotate2
Definition: nanokontrol_status.py:151
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M7
M7
Definition: nanokontrol_status.py:110
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide7
slide7
Definition: nanokontrol_status.py:165
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide3
slide3
Definition: nanokontrol_status.py:161
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide1
slide1
Definition: nanokontrol_status.py:159
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide4
slide4
Definition: nanokontrol_status.py:162
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.track_left
track_left
Definition: nanokontrol_status.py:9
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S8
S8
Definition: nanokontrol_status.py:82
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.cycle
cycle
Definition: nanokontrol_status.py:17
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M8
M8
Definition: nanokontrol_status.py:114
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.play
play
Definition: nanokontrol_status.py:45
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S6
S6
Definition: nanokontrol_status.py:74
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S4
S4
Definition: nanokontrol_status.py:66
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rec
rec
Definition: nanokontrol_status.py:49
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.marker_set
marker_set
Definition: nanokontrol_status.py:21
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M2
M2
Definition: nanokontrol_status.py:90
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.pause
pause
Definition: nanokontrol_status.py:41
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate8
rotate8
Definition: nanokontrol_status.py:157
jsk_teleop_joy.nanokontrol_status.main
def main()
Definition: nanokontrol_status.py:177
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide5
slide5
Definition: nanokontrol_status.py:163
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate6
rotate6
Definition: nanokontrol_status.py:155
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate4
rotate4
Definition: nanokontrol_status.py:153
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate5
rotate5
Definition: nanokontrol_status.py:154
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R4
R4
Definition: nanokontrol_status.py:130
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S1
S1
Definition: nanokontrol_status.py:54
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide2
slide2
Definition: nanokontrol_status.py:160
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R8
R8
Definition: nanokontrol_status.py:146
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S2
S2
Definition: nanokontrol_status.py:58
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.next
next
Definition: nanokontrol_status.py:37
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R3
R3
Definition: nanokontrol_status.py:126
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.rotate1
rotate1
Definition: nanokontrol_status.py:150
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M4
M4
Definition: nanokontrol_status.py:98
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R7
R7
Definition: nanokontrol_status.py:142
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M5
M5
Definition: nanokontrol_status.py:102
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.M6
M6
Definition: nanokontrol_status.py:106
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R1
R1
Definition: nanokontrol_status.py:118
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.R6
R6
Definition: nanokontrol_status.py:138
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.slide8
slide8
Definition: nanokontrol_status.py:166
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status
Definition: nanokontrol_status.py:6
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.track_right
track_right
Definition: nanokontrol_status.py:13
jsk_teleop_joy.nanokontrol_status.joyCB
def joyCB(msg)
Definition: nanokontrol_status.py:172
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.S5
S5
Definition: nanokontrol_status.py:70
jsk_teleop_joy.nanokontrol_status.NanoKONTROL2Status.prev
prev
Definition: nanokontrol_status.py:33
msg


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