Receives telemetry data from the F1 game franchise
Data output documentations can be found in the Data Output Doc folder.
It contains the UDP specifications for the following games:
- F1 25 v3
- F1 24 v27.2
- F1 23 v29.3
- F1 22 v16
- F1 21 Not available
- F1 20 v?
- F1 19 v?
The latest version can be found in code 2024
Inside main.py use the following code to retrieve telemetry data:
from f1_telemetry.server import get_telemetry
for packet, packetID, m_header in get_telemetry():
# Your code here
print(packetID, packet)
If you wish to store the telemetry data you can use the lastestData class, making sure to update the class with each packet received:
for packet, packetID, m_header in get_telemetry():
latestPackets.update(packetID, packet)
# Your code here
If you wish to log events that occur during a session you can use the eventLogger class.
make sure to update the class with each event packet received:
for packet, packetID, m_header in get_telemetry():
dataLogger.LogData(packetID, latestPackets)
This class will print out to the console any events that occur during a session.
Most event are print as [{Event Name}] - {message}
examples include:
[SSTA] - Session has started[FTLP] - User [ID:15-PEREZ-Red Bull Racing-Mexican-11] set fastest lap with [70.744][OVTK] - User [ID:16-GASLY-Alpine-French-10] has overtaken [ID:13-RUSSELL-Mercedes-British-63][DTSV] - User [ID:19-VERSTAPPEN-Red Bull Racing-Dutch-33] is serving a drive through penalty[COLL] - Collision between user [ID:15-PEREZ-Red Bull Racing-Mexican-11] and user [ID:17-ALONSO-Aston Martin-Spanish-14][RCWN] - User [ID:1-LECLERC-Ferrari-Monegasque-16] has won the race
It will also create an event log file containing the above events as well as sessions settings, see code 2024/raceLog.csv for an example log file. This is created during each event (qualy and race).
At the end of the session it will create a race results file, see code 2024/raceResults.csv for an example results file.