Пример #1
0
    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()
Пример #2
0
import time
from pynput import keyboard
from glove.gloveHandle import GloveHandle, SourceConfig, Sources

filename = "data/glovetest.rec"
file = open(filename, 'rb')

glove = GloveHandle(SourceConfig(Sources.SIMULATION,
                                 data=bytearray(file.read())),
                    nonBlocking=False)


@glove.imuFrameDecorator
def imuFrame(data):
    print("IMU data: ", data)
    time.sleep(0.5)


@glove.deformationFrameDecorator
def deformationFrame(data):
    print("deformation data: ", data)


glove.connect(
    "FRAME", glove.newFrameDecorator(lambda head, data: print("FRAME:", data)))
glove.connect("IMU_FRAME", imuFrame)
glove.connect("DEFORMATION_FRAME", deformationFrame)
glove.open()
glove.start()
time.sleep(10)
glove.exit()