File tree Expand file tree Collapse file tree 3 files changed +570
-41
lines changed
roboticstoolbox/backends/Swift Expand file tree Collapse file tree 3 files changed +570
-41
lines changed Original file line number Diff line number Diff line change @@ -108,28 +108,107 @@ def set_three(x):
108
108
update_gimbals (float (x ), 3 )
109
109
110
110
111
- env . add_slider (
111
+ r_one = rtb . backends . Slider (
112
112
set_one ,
113
113
min = - 180 , max = 180 ,
114
114
step = 1 , value = 0 ,
115
115
desc = 'Ring One' , unit = '°' )
116
116
117
- env .add_slider (
117
+
118
+ r_two = rtb .backends .Slider (
118
119
set_two ,
119
120
min = - 180 , max = 180 ,
120
121
step = 1 , value = 0 ,
121
122
desc = 'Ring Two' , unit = '°' )
122
123
123
- env .add_slider (
124
+
125
+ r_three = rtb .backends .Slider (
124
126
set_three ,
125
127
min = - 180 , max = 180 ,
126
128
step = 1 , value = 0 ,
127
129
desc = 'Ring Three' , unit = '°' )
128
130
131
+
132
+ def reset (e ):
133
+ r_one .value = 0
134
+ r_two .value = 0
135
+ r_three .value = 0
136
+
137
+ button = rtb .backends .Button (
138
+ reset ,
139
+ desc = 'Set to Zero'
140
+ )
141
+
142
+
143
+ def angle (index ):
144
+ print ('Selection Box Index selected: ' + str (index ))
145
+
146
+ rot_seq = rtb .backends .Select (
147
+ angle ,
148
+ desc = 'Rotation Sequence' ,
149
+ options = [
150
+ 'zyx' ,
151
+ 'zyz' ,
152
+ 'I dont know'
153
+ ],
154
+ value = 0
155
+ )
156
+
157
+
158
+ def check_fn (indices ):
159
+ if indices [1 ]:
160
+ print ("YOU ARE WRONG" )
161
+ elif indices [0 ] and indices [2 ]:
162
+ print ("You are correct :)" )
163
+ else :
164
+ print ('Half marks' )
165
+
166
+ check = rtb .backends .Checkbox (
167
+ check_fn ,
168
+ desc = 'Describe Jesse' ,
169
+ options = [
170
+ 'Amazing' ,
171
+ 'Bad' ,
172
+ 'The Greatest'
173
+ ],
174
+ checked = [True , False , True ]
175
+ )
176
+
177
+
178
+ def radio_fn (idx ):
179
+ if idx == 0 :
180
+ print ("YOU ARE WRONG" )
181
+ else :
182
+ print ("You are correct :)" )
183
+
184
+ radio = rtb .backends .Radio (
185
+ radio_fn ,
186
+ desc = 'Jesse is:' ,
187
+ options = [
188
+ 'Bad' ,
189
+ 'Good' ,
190
+ ],
191
+ checked = 1
192
+ )
193
+
194
+ label = rtb .backends .Label (
195
+ desc = 'Teach Panel'
196
+ )
197
+
198
+ env .add (label )
199
+ env .add (r_one )
200
+ env .add (r_two )
201
+ env .add (r_three )
202
+ env .add (button )
203
+ env .add (rot_seq )
204
+ env .add (check )
205
+ env .add (radio )
206
+
129
207
update_gimbals (0 , 1 )
130
208
update_gimbals (0 , 2 )
131
209
update_gimbals (0 , 3 )
132
210
133
211
while (True ):
134
- env .process_events ()
212
+ # env.process_events()
135
213
env .step (0 )
214
+
You can’t perform that action at this time.
0 commit comments