b4mad / racing-archived

Apache License 2.0
0 stars 1 forks source link

Build Open in Visual Studio Code

Formula 1 - Telemetry with Apache Kafka

This project aims to use Apache Kafka in order to ingest Formula 1 telemetry data from the F1 2020 game (by CodeMasters) running on Microsoft Xbox. It uses different products, projects and technologies:

Logo

Overview

Following an overall picture of how these technologies are used together. A couple of short introduction videos are available here and here.

You can also find some material from conference presentations:

Overview

F1 2020 Xbox UDP to Kafka

In order to ingest the telemetry events into Apache Kafka, the Apache Camel project is used with:

UDP to Kafka

Kafka Streams API

The Kafka Streams API based application shows an example of real-time analytics on the telemetry data. The application processes the average speed in the last 5 seconds.

Kafka Streams API

It has a source node reading from the topic with drivers related messages, filtering the ones not containing valid telemetry data. Extract and group the driver's speed by corresponding driver's id using in a tumbling window of 5 seconds. Next, it sums speeds and counts them in order to process the corresponding average value. Finally, the sink node writes to the destination topic.

Kafka Streams API Topology

Kafka to InfluxDB

In order to provide the telemetry data to Grafana dashboards, InfluxDB is used as data source and the telemetry events are stored through Apache Camel with:

Kafka to InfluxDB

Repository structure

Contains different components for ingesting and handling Formula 1 2020 game (by CodeMasters) telemetry data through Apache Kafka.

The Formula 1 2020 game UDP packets specification is here. The library used for decoding the packets is here.

Documentation

You can find more information about building, deploying and running the solution in the documentation here

Dashboards

The telemetry dashboard shows information like speed, engine (rpm), throttle and brake.

Telemetry

The motion dashboard shows information about the car in motion like the G-force.

Motion

The car status dashboard shows information mostly related to the status of each car, for example wings damages and fuel in tank.

Car Status

The events dashboard shows race events like max speed trap and fastest lap.

Events

The driver dashboard allows to get data for a single driver, selecting one through the corresponding drop down list. It has a top bar with information about current lap, position, distance and lap times.

Driver

It also has some graphs showing specific driver data related to throttle/brake, engine/speed, gear/clutch, brakes and steering.

Driver

Driver

It also shows specific information about tyres like, for example, the compound, the age laps, wear, surface temperature and damage

Driver

Driver

The streams dashboard shows data about processed telemetry data through Kafka Streams application. The first one is about the average speed during the last 5 seconds.

Streams