我正在尝试通过OSC从EEG耳机发送数据。我可以打印数据,我也可以通过OSCClient发送独立的OSC消息,但我无法通过OSC发送整个数据包:
from OSC import OSCClient, OSCMessage # Import Open Sound Control Module
from emokit.emotiv import Emotiv # Import EmoKit
client = OSCClient()
client.connect( ("localhost", 9098) )
if __name__ == "__main__":
with Emotiv(display_output=True, verbose=True, write=True) as headset:
while True:
packet = headset.dequeue()
client.send( OSCMessage("/pack", packet)
if packet is not None:
print("Gyro - X:{x_position} Y:{y_position}".format(x_position=packet.sensors['X']['value'],
y_position=packet.sensors['Y']['value']))