Skip to content

Commit cf066e0

Browse files
committed
New swift elements
1 parent c6db007 commit cf066e0

File tree

3 files changed

+570
-41
lines changed

3 files changed

+570
-41
lines changed

examples/gimbal.py

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,28 +108,107 @@ def set_three(x):
108108
update_gimbals(float(x), 3)
109109

110110

111-
env.add_slider(
111+
r_one = rtb.backends.Slider(
112112
set_one,
113113
min=-180, max=180,
114114
step=1, value=0,
115115
desc='Ring One', unit='°')
116116

117-
env.add_slider(
117+
118+
r_two = rtb.backends.Slider(
118119
set_two,
119120
min=-180, max=180,
120121
step=1, value=0,
121122
desc='Ring Two', unit='°')
122123

123-
env.add_slider(
124+
125+
r_three = rtb.backends.Slider(
124126
set_three,
125127
min=-180, max=180,
126128
step=1, value=0,
127129
desc='Ring Three', unit='°')
128130

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+
129207
update_gimbals(0, 1)
130208
update_gimbals(0, 2)
131209
update_gimbals(0, 3)
132210

133211
while(True):
134-
env.process_events()
212+
# env.process_events()
135213
env.step(0)
214+

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy