q = mag.getQuat() yaw, pitch, roll = angleFromQuat(q) yaw = int(yaw) pitch = int(pitch) roll = int(roll) angles = (yaw, pitch, roll) #@glove.deformationFrameDecorator def deformationFrame(data): global flex flex = data[:5] #glove.connect("FRAME", glove.newFrameDecorator(lambda head, data: None)) glove.connect("IMU_FRAME", imuFrame) glove.connect("DEFORMATION_FRAME", deformationFrame) glove.open() glove.start() writer = imageio.get_writer(output_filename) isSaving = False def update(ev): global gloveCanvas, flex, angles global writer global isSaving if isSaving: image = gloveCanvas._canvas.render()
vx = axgo * tm + vx vy = aygo * tm + vy vz = azgo * tm + vz if count > 10: count = 0 count += 1 plotter.addPoint(sx, sy, sz, t) #plotter.addPoint(azgo, vz, sz*100, t) @glove.deformationFrameDecorator def deformationFrame(data): pass #print("deformation data: ", data) glove.connect("FRAME", glove.newFrameDecorator(lambda head, data: None)) glove.connect("IMU_FRAME", imuFrame) glove.connect("DEFORMATION_FRAME", deformationFrame) glove.open() glove.start() while True: plotter.update() time.sleep(0.02) glove.exit() plotter.exit()