Skip to content
/ racing Public

Community-driven SimRacing data collection and analysis

License

Notifications You must be signed in to change notification settings

b4mad/racing

Repository files navigation

Community driven SimRacing data collection and analysis.

A telemetry data collection and analysis pipeline for simracers 🏎️

The pipeline start at CrewChief. This means we can take data in from any simulation that CrewChief supports. CrewChief will send your simulator telemetry data to an endpoint hosted on the Operate First Community Cloud. You can then visualize your telemetry data in our B4mad Pitwall or do some data science

architecture

Installation

  1. Install CrewChief
  2. Enable the telemetry collection by checking 'MQTT Telemetry enabled' in the CrewChief Properties
  3. Choose a 'MQTT drivername' in the CrewChief Properties cc_settings_mqtt
  4. Enable text to speech cc_settings_tts
  5. If all works you should see connection messages in the CrewChief console cc_log
  6. Join our Discord and say hello 👋

Drive some laps to send some initial data. Now any time you run your simulator you will be sending data. If anything doesnt work, check out the FAQ.

Coaches

At Paddock find your drivername and enable the coach.

Visualization

Head over to the B4mad Pitwall and explore your recent sessions or signup for an account to create new dashboards.

grafana

Check out the flux scratchpad for some flux query examples.

Hacking

docker-compose stack

cd docker-compose
docker-compose up

influx

Go to https://localhost:8086/ and login with configuration.env and explore the racing bucket

connecting to influx

# create a config with a reader token
influx config create --active -n b4mad_reader -u https://telemetry.b4mad.racing -t "citqAMr66LLb25hvaaZm2LezOc88k2ocOFJcJDR6QB-RmLJa_-sAr9kYB4vSFYaz8bt26lm7SokVgpQKdgKFKA==" -o b4mad

# count the number of sessions in the last 24 hours
influx query 'from(bucket:"racing") |> range(start:-1d) |> keep(columns: ["SessionId"])|> group()|> distinct(column: "SessionId") |> count()'
Result: _result
Table: keys: []
                _value:int
--------------------------
                      1788

# count the number of points
influx query 'from(bucket:"racing") |> range(start:-10y) |> filter(fn: (r) => r["_measurement"] == "fast_laps") |> group() |> count()'
influx query 'from(bucket:"racing") |> range(start:-10y) |> filter(fn: (r) => r["_measurement"] == "fast_laps") |> filter(fn: (r) => r["SessionId"] == "1677384694") |> group() |> count()'

# delete all points in a measurement
influx delete --bucket racing --start '2022-11-27T00:00:00Z' --stop $(date +"%Y-%m-%dT%H:%M:%SZ") \
  --predicate '_measurement="fast_laps" AND "SessionId"="1689169765"'

telegraf

docker compose exec telegraf cat /tmp/metrics.out
docker compose restart telegraf

mosquitto

publish stuff

docker-compose exec mosquitto mosquitto_pub  -u admin -P admin -t racing -m '{"a": 5}'
docker-compose exec mosquitto mosquitto_pub  -u admin -P admin -t racing -m "`cat ../sample-small.json`"

subscribe

docker-compose exec mosquitto mosquitto_sub  -u admin -P admin -t racing/\# -d
docker-compose exec mosquitto mosquitto_sub  -p 31883 -h telemetry.b4mad.racing -u admin -P admin -t crewchief/\# -d

grafana

Export data sources

curl -s "https://localhost:3000/api/datasources" -u admin:admin | jq -c -M '.[]'

CD

App Status