• Stars
    star
    140
  • Rank 261,473 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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 202x game (by CodeMasters/EA Sports) running on Microsoft Xbox. It uses different products, projects and technologies:

  • F1 202x games (by CodeMasters/EA Sports) for getting the telemetry data via UDP;
  • Apache Camel project for routing telemetry events from UDP to Apache Kafka and to InfluxDB;
  • Apache Kafka as the core project for ingesting the telemetry events on different topics;
  • Kubernetes for deploying most of the components to run in the cloud;
  • Strimzi for deploying easily the Apache Kafka on Kubernetes;
  • InfluxDB for storing the telemetry time series as data source for dashboards;
  • Grafana for providing dashboards showing the real time telemetry data;

Logo

The formula 1 telemetry library, used to decode the UDP packets, works with the F1 2020 game format. It's possible to have the project working with newer game editions by selecting the "2020" UDP packet format in the Telemetry settings on the game.

It is possible to select the season for teams, drivers and tracks by setting the F1_TELEMETRY_SEASON environment variable when running the different applications. By default, it uses 2020 season data. For more information see here.

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:

  • Let's code a motorsport telemetry processing pipeline - slides demo video
  • Formula 1 telemetry processing using Kafka Streams - slides demo video
  • Formula 1 telemetry processing using Quarkus and OpenShift Streams for Apache Kafka - slides demo video

Overview

F1 202x Xbox UDP to Kafka

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

  • a route getting the raw UDP packets from the F1 202x game (by CodeMasters/EA Sports) on Microsoft Xbox and dispatching these events to three more routes;
    • a route just forwarding the raw UDP packets to a corresponding Apache Kafka topic;
    • a route to filter only the EVENT type raw UDP packets and forwarding them to a corresponding Apache Kafka topic;
    • a route to aggregate the raw UDP packets data for producing drivers related data and forwarding them to a corresponding Apache Kafka topic;

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:

  • a route getting drivers related data for storing telemetry, motion and car status data;
  • a route getting the EVENT type raw UDP packets for storing fastest lap and speedtrap events;

Kafka to InfluxDB

Repository structure

Contains different components for ingesting and handling Formula 1 202x game (by CodeMasters/EA Sports) telemetry data through Apache Kafka.

  • udp-kafka: Apache Camel application bridging the telemetry packets got on UDP from the Formula 1 202x game to Apache Kafka to different topics:
    • f1-telemetry-packets contains the raw Packet(s);
    • f1-telemetry-events contains only the raw Packet(s) of EVENT type;
    • f1-telemetry-drivers contains the Driver messages as result of aggregating Packet(s) in the same frame with telemetry data for all drivers;
  • consumer: Apache Kafka client application consuming Driver messages from Apache Kafka;
  • streams-avg-speed: Apache Kafka Streams API based application getting raw Driver(s), processing them in real time to get average speed in a 5 seconds window and writing to Apache Kafka to the f1-telemetry-streams-avg-speed topic;
  • streams-laps: Apache Kafka Streams API based application getting raw Driver(s), processing them in real time to get the best overall times in the three track sectors and writing to Apache Kafka to the f1-telemetry-best-overall-sector topic;
  • common: common library providing model classes and related Apache Kafka serializer/deserializer;
  • kafka-influxdb: Apache Camel application writing driver/car's telemetry data to InfluxDB as time series;
  • webui: A sample Web application showing the race ranking in real time getting Driver(s) from Apache Kafka;
  • streams-processing: Apache Kafka Streams API based application getting raw Driver(s) and extracting some telemetry in JSON format;
  • dashboard: folder containing Grafana dashboard showing driver/car's telemetry data;
  • deployment: folder containing Kubernetes deployments for all the provided applications;
  • documentation: folder containing documentation about how to deploy the entire solution;

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

More Repositories

1

azuresblite

Access to Microsoft Azure Service Bus from all platforms using AMQP protocol
C#
28
star
2

formula1-telemetry

Java
25
star
3

kafka-go-examples

Kafka examples using Go language
Go
22
star
4

kafka-opentelemetry

Java
17
star
5

ble2azure

IoT Gateway concept from BLE (Bluetooth Low Energy) devices to Azure (Event Hubs)
C#
15
star
6

amqp-kafka-demo

Bridging AMQP - Kafka demo
Java
10
star
7

devday-2020-strimzi-aks-eventhub

Demo session at DevDay 2020 "Strimzi: running your Apache Kafka cluster on Kubernetes"
Java
10
star
8

kafka-hybrid-iot

Apache Kafka for the Hybrid IoT
JavaScript
10
star
9

codesamples

Code samples related to my articles, blog posts and demo
C#
9
star
10

enmasse-iot-demo

EnMasse - IoT demo
Java
8
star
11

kafka-connect-amqp

An AMQP connector for data ingestion into Kafka via AMQP protocol
Java
7
star
12

unfc

uNFC - NFC library for .Net platforms
C#
6
star
13

azuresblite-examples

Example scenarios to use Azure SB Lite library to access Azure Service Bus (Event Hubs, Queues and Topics/Subscription)
C#
6
star
14

pi2toeventhubs

Source code demo for the session "Telemetry from Windows 10 IoT Core on Raspberry Pi 2 to Event Hubs" at Mobile Camp 2015 in Naples
C#
6
star
15

formula1-telemetry-rhosak

Shell
5
star
16

azure-nodes

Library with nodes for Node-RED to use Microsoft Azure services
JavaScript
5
star
17

kafka-playground

An Apache Kafka playground
Java
5
star
18

strimzi-eventhub

Strimzi with Kafka Mirror Maker connected to Azure Event Hub
Java
5
star
19

reactive-iot-vertx

Demos for "Reactive Internet of Things : the Vert.x way"
JavaScript
4
star
20

devday-mqtt-on-the-road

"MQTT on the road" meetup examples
Java
4
star
21

strimzi-keda

Example usage of Strimzi and KEDA
4
star
22

qpid-dispatch-examples

Examples on using Qpid Dispatch Router
C#
4
star
23

devday-kubernetes-openshift

Kubernetes and OpenShift playground
Java
4
star
24

mqttlocation

This is demo project showed in my session at Mobile Camp 2014 in Naples about geolocation with MQTT (vs HTTP) on Windows Phone 8.1 and Windows 8.1 devices
C#
4
star
25

presentations

3
star
26

strimzi-demo

Strimzi demo
3
star
27

rhte-2019

"Building data streaming applications with Apache Kafka on OpenShift using AMQ Streams" workshop at Red Hat Tech Exchange 2019
Java
2
star
28

uplibrary

uPLibrary - .Net Micro Framework Helper Library
C#
2
star
29

kafka-http-strimzi-apps

HTTP based consumer and producer for Apache Kafka Strimzi bridge
Java
2
star
30

modern-integration-and-application-development-day-2019

Strimzi: how Apache Kafka has fallen in love with Kubernetes
Shell
2
star
31

devconfcz-2021-formula1-kafka-streams

1
star
32

codemotion-2021-formula1-kafka-camel

1
star
33

rh-osd-2018

Red Hat Open Source Day 2018 demo
Shell
1
star
34

ucloudy

uCloudy - Cloud services client library for .Net Micro Framework
C#
1
star
35

nginx-strimzi-kafka-bridge

Nginx with Strimzi Kafka Bridge
Shell
1
star
36

microjson

MicroJSON - Lightweight JSON library
C#
1
star
37

ocp-roadshow-2018

Demo for the Strimzi / AMQ Streams session at Red Hat Containers & Cloud-Native Roadshow Italia
1
star