Fixed up example
@@ -89,7 +89,7 @@ def update_gimbals(theta, ring):
# figure the transforms for each gimbal and the plane, and update their
# pose
def convert(R):
- return BASE * SE3.SO3(R)
+ return BASE * SE3.Rt(R, t=[0, 0, 0])
g3.base = convert(R1 * SO3.Ry(pi / 2))
g2.base = convert(R1 * R2 * SO3.Rz(pi / 2))
@@ -167,6 +167,12 @@ zero_button = swift.Button(
)
+def update_all_sliders():
+ update_gimbals(float(r_one.value), 1)
+ update_gimbals(float(r_two.value), 2)
+ update_gimbals(float(r_three.value), 3)
+
+
def change_sequence(new):
global sequence
@@ -178,6 +184,7 @@ def change_sequence(new):
ring3_axis.checked = xyz.find(new[2])
sequence = new
+ update_all_sliders()
# handle radio button on angle slider
@@ -189,6 +196,7 @@ def angle(index, ring):
s = list(sequence)
s[ring] = xyz[int(index)]
sequence = ''.join(s)
+ update_all_sliders()
ring1_axis = swift.Radio(
@@ -222,48 +230,31 @@ ring3_axis = swift.Radio(
)
-def check_fn(indices):
- if indices[1]:
- print("YOU ARE WRONG")
- elif indices[0] and indices[2]:
- print("You are correct :)")
- else:
- print('Half marks')
+label = swift.Label(
+ desc='Triple angle'
+)
-check = swift.Checkbox(
- check_fn,
- desc='Describe Jesse',
- options=[
- 'Amazing',
- 'Bad',
- 'The Greatest'
- ],
- checked=[True, False, True]
-)
+def chekked(e, el):
+ nlabel = 's: '
+ if e[0]:
+ nlabel += 'a'
+ r_one.value = 0
+
+ if e[1]:
+ nlabel += 'b'
+ r_two.value = 0
-def radio_fn(idx):
- if idx == 0:
- print("YOU ARE WRONG")
- else:
- print("You are correct :)")
+ if e[2]:
+ nlabel += 'c'
+ r_three.value = 0
+ if e[3]:
+ el.value = 1
-radio = swift.Radio(
- radio_fn,
- desc='Gimbal axis',
- options=[
- 'X',
- 'Y',
- 'Z'
- ],
- checked=1
-)
+ label.desc = nlabel
-label = swift.Label(
- desc='Triple angle'
-)
env.add(label)
env.add(r_one)
