Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

sockets - How can I create a live graph in python of data that I am streaming from a phone

So I am using an app which streams gyroscope and accelerometer data to a port to which I then can pick up this information in python. My questions is how can I create a live graph of data that I am receiving. I have provided the code that is given which picks up the data in python.

import socket, traceback



host = ''
port = 5555

s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind((host, port))

print("Success binding")
while 1:
    message, address = s.recvfrom(8192)
    messageString = message.decode("utf-8")
    print(messageString) 

This is the type of output that is continuous as its streaming.

0.29927522,0.30885202,9.651027,6.1086525E-4,6.1086525E-4,0.0036651916


0.28491,0.30166942,9.636662,0.0030543262,-0.0012217305,0.0


0.2705448,0.30885202,9.64145,0.0061086523,0.0012217305,0.0012217305


0.5650316,1.0414777,3.4261026,-0.18997909,0.012217305,-6.1086525E-4


I think the first 3 numbers are the accelerometer and the next 3 are the gyroscope

question from:https://stackoverflow.com/questions/65929222/how-can-i-create-a-live-graph-in-python-of-data-that-i-am-streaming-from-a-phone

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...