Created
July 3, 2015 17:19
-
-
Save Billiam/3d12cf9569897b27ffa9 to your computer and use it in GitHub Desktop.
DiRT Rally Telemetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import struct | |
| import os | |
| # Create UDP socket. | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| # Bind to LFS. | |
| sock.bind(('127.0.0.1', 20777)) | |
| while True: | |
| # Receive data. | |
| data = sock.recv(512) | |
| if not data: | |
| break # Lost connection | |
| outsim_pack = struct.unpack('64f', data[0:256]) | |
| os.system('cls') | |
| for id, value in enumerate(outsim_pack): | |
| print "%d : %s" % (id, value) | |
| print 'lost connection' | |
| # Release the socket. | |
| sock.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment