Giter Site home page Giter Site logo

b4mad / racing Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 13.0 69.62 MB

Community-driven SimRacing data collection and analysis

Home Page: https://b4mad.racing

License: GNU General Public License v3.0

Shell 0.01% FLUX 0.01% Python 0.23% Jupyter Notebook 99.74% Dockerfile 0.01% Jsonnet 0.01% HTML 0.01%
grafana hacktoberfest influxdb

racing's People

Contributors

durandom avatar eadali avatar goern avatar khebhut[bot] avatar lukaslichten avatar taholmes160 avatar tetourne avatar thoraxe avatar yrogory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

racing's Issues

Individual vs community CSVs for Pitcrew

HI Guys:

Would be useful to have the ability to generate private CSVs for our specific notes, as well as those that are shared with the community, that will allow us to customize the info coming from our pitcrew to suit our own driving style

upgrade mosquitto

upgrade mosquitto image used to the latest version, ensure dyn sec plugin is available

/kind feature
/priority critical-urgent
/assign goern

`The character '#' is not allowed in topics` exeception when used with rfactor2

https://discord.com/channels/850841654327640074/914445482154147860/1050708958836424715

[10:42 AM]Matt Webb: hi all. stumbled into this but keen to try make it work. alas after following the install instructions I get this:
[10:43 AM]Matt Webb: Event Mqtt threw exception The character '#' is not allowed in topics. stack    at MQTTnet.Protocol.MqttTopicValidator.ThrowIfInvalid(String topic)
   at MQTTnet.Protocol.MqttTopicValidator.ThrowIfInvalid(MqttApplicationMessage applicationMessage)
   at MQTTnet.Client.MqttClient.PublishAsync(MqttApplicationMessage applicationMessage, CancellationToken cancellationToken)
   at CrewChiefV4.Events.Mqtt.triggerInternal(GameStateData previousGameState, GameStateData currentGameState) in C:\projects\crewchief_c_sharp\CrewChiefV4\CrewChiefV4\Events\Mqtt.cs:line 253
   at CrewChiefV4.CrewChief.triggerEvent(String eventName, AbstractEvent abstractEvent, GameStateData previousGameState, GameStateData currentGameState) in C:\projects\crewchief_c_sharp\CrewChiefV4\CrewChiefV4\CrewChief.cs:line 1128
09:40:16.990 : This is the first time this event has failed in this session
[10:43 AM]goern.b4mad.eth: Hi Matt 👍
[10:43 AM]Matt Webb: hiya
[10:44 AM]goern.b4mad.eth: I assume it’s all the latest and greatest crew chief versions?
[10:44 AM]Matt Webb: yes sir
[10:44 AM]Matt Webb: 4.16.3.4
[10:44 AM]goern.b4mad.eth: And did you follow the install like yesterday?! I think there was an update to the config..
[10:44 AM]Matt Webb: about 15 mins ago
[10:45 AM]goern.b4mad.eth: Cool!
[10:45 AM]Matt Webb: i did over right the mqtt json so cant go back now ;O)
[10:45 AM]Matt Webb: overwrite...
[10:45 AM]goern.b4mad.eth: Does your driver name contain a # ?
[10:45 AM]Matt Webb: nope. Mattw
[10:46 AM]Matt Webb: ah.....i think I know whats happened. I put Mattw in the mqtt driver name...but
[10:46 AM]goern.b4mad.eth: Strange error that is, let’s ping @durandom he wrote that part
[10:46 AM]Matt Webb: I did a windows refresh yesterday and reinstalled CC...I havent put my name in the actual name bit!! bloody stupid sorry
[10:47 AM]goern.b4mad.eth: Null problemo, that’s what i do all the time 😁
[10:48 AM]Matt Webb: trying again. Will report back. Thank you
[10:48 AM]goern.b4mad.eth: cool! Thanks
[10:48 AM]goern.b4mad.eth: Let’s see what features are missing to make it a good tool for you!
[10:49 AM]Matt Webb: still fails

Event Mqtt has failed 10 times in this session and will be disabled
[10:49 AM]Matt Webb: same # erro
[10:49 AM]Matt Webb: r
[10:50 AM]goern.b4mad.eth: ack, let me check if you cc is working
[10:50 AM]Matt Webb: hang on, restarted and it might be working...doing laps
[10:51 AM]Matt Webb: ah, nope, it connects to mqtt when I load CC, but as soon as I start CC in rf2 mode it gets the error
[10:52 AM]Matt Webb: doesnt happen if I select games Automobilista2 and Raceroom, just rfactor2 64
[10:55 AM]goern.b4mad.eth: ja, I see, for AC 64bit it seems to work
[10:56 AM]Matt Webb: can confirm that works for me also to

/kind bug
/assign @durandom

refactor all secrets into Secret

Let's refactor all the tokens and password and... into a Secret managed by kustomize+argocd, helm values and config files need to use ENV, deployments need to use volume mounted from Secret

extract track sections via deep learning

Some games provide x/y coordinates of the car on the map. This can be used to plot the track. We use this map to split the track into sections. I.e. a connection of corners and straights. See https://github.com/b4mad/racing/blob/main/notebooks/track_sections_from_coordinates.ipynb

Some games, like iRacing, don't provide the x/y coordinates in real-time. But we still get other telemetry, like SteeringAngle and Throttle and Brake input. We could create a similar approach, looking at the SteeringAngle, like already applied in https://github.com/b4mad/racing/blob/main/notebooks/fast_lap_analysis-v2.ipynb
But all these approaches have edge cases and need some tweaking of thresholds.

How about training a deep learning model?

The input features of the model are SteeringAngle, Throttle and Brake. The output is the layout of the track.
Training data can be created from those games that provide x/y coordinates and a collection of tracks with known good layouts. The layouts can be hand tuned.

SimHub plugin to publish telemetry to MQTT endpoint

User Story

As a SimHub user I can install a plugin to publish live game data to an MQTT endpoint

Acceptance Criteria

  • https://github.com/dotnet/MQTTnet client is used
  • Plugin configuration page with
    • User / Password authentication
    • Topic URL
    • sample rate in milliseconds
    • upload rate in seconds
  • payload is JSON with
    • “time” field with UNIX timestamp milliseconds UTC timezone
    • all SimHub normalized fields (e.g. throttle, brake, map_position)
    • all game-specific fields for iRacing or Automobilista2 game
  • telemetry is sampled at configurable sample rate and added to the JSON payload
  • payload is buffered and uploaded at configured upload rate
  • payload is compressed in gzip
  • telemetry sampling is not blocked during upload - use threads
  • sampling / uploading starts whenever a game enters practice/qualifying/race
  • plugin can also upload data from a saved session in SimHup (replay)
  • Documentation to build plugin

In order to avoid saturation of upload bandwidth and improve the compression ratio, we don't want to stream the JSON payloads, but instead, collect samples for a certain period (e.g. 10 seconds), then compress the payload and then publish the payload to the topic (upload).

local development

Use the docker-compose setup to develop locally

Use case

Racing teams and individual drivers are able to stream their telemetry data to the platform.
They can visualize the data in existing and customized dashboards and execute functions provided by the data storage engine.

Architecture

SimHub is able to read telemetry from a multitude of games and unifies the format, it also provides a plugin architecture in C#.
MQTT is a messaging standard. Telegraf can interface to the MQTT broker and send the data into an Influx database, which in turn can be visualized by Grafana dashboards. See b4mad.racing architecture

pitcrew throws exception

using a47b45a pitcrew threw an exception:

DEBUG:root:new session crewchief/goern/1666692415/iRacing/summit summit raceway/Ferrari 488 GT3 Evo 2020/LonePractice
Traceback (most recent call last):
  File "/home/goern/Source/github.com/b4mad/racing/pitcrew/./app.py", line 23, in <module>
    mqtt.run()
  File "/home/goern/Source/github.com/b4mad/racing/pitcrew/mqtt.py", line 102, in run
    self.mqttc.loop_forever()
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 1556, in loop_read
    rc = self._packet_read()
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
    self._handle_on_message(message)
  File "/home/goern/.local/share/virtualenvs/pitcrew-wsNBG5uX/lib/python3.9/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/home/goern/Source/github.com/b4mad/racing/pitcrew/mqtt.py", line 74, in on_message
    response = self.coach.get_response(meters)
  File "/home/goern/Source/github.com/b4mad/racing/pitcrew/coach.py", line 39, in get_response
    if self.msg['corner'] != brakepoint['corner']:
TypeError: 'NoneType' object is not subscriptable
DEBUG:root:loading brakepoints from /home/goern/Source/github.com/b4mad/racing/pitcrew/Ferrari 488 GT3 Evo 2020-summit summit raceway.csv

CC starting Rfactor 2 64 causing Mqtt failure due to #

Automobilista2, Raceroom & AC64 all start in CC without Mqtt failing. Rfactor2 causing Mqtt to fail with below messages in the console.

10:06:46.843 : Event Mqtt threw exception The character '#' is not allowed in topics. stack at MQTTnet.Protocol.MqttTopicValidator.ThrowIfInvalid(String topic)
at MQTTnet.Protocol.MqttTopicValidator.ThrowIfInvalid(MqttApplicationMessage applicationMessage)
at MQTTnet.Client.MqttClient.PublishAsync(MqttApplicationMessage applicationMessage, CancellationToken cancellationToken)
at CrewChiefV4.Events.Mqtt.triggerInternal(GameStateData previousGameState, GameStateData currentGameState) in C:\projects\crewchief_c_sharp\CrewChiefV4\CrewChiefV4\Events\Mqtt.cs:line 253
at CrewChiefV4.CrewChief.triggerEvent(String eventName, AbstractEvent abstractEvent, GameStateData previousGameState, GameStateData currentGameState) in C:\projects\crewchief_c_sharp\CrewChiefV4\CrewChiefV4\CrewChief.cs:line 1128
10:06:46.843 : This is the first time this event has failed in this session
10:06:46.843 : ********** starting spotter***********
10:06:46.843 : Invoking spotter every 50
10:06:47.228 : There are 1 more events in the queue, playing them...
10:06:47.228 : Playing sounds, events: COMPOUND_smoke_test_spotter
10:06:47.228 : (radio_check_Billy/test)
10:06:47.754 : Event Mqtt has failed 10 times in this session and will be disabled

car model not displayed correctly for some simulators

for some simulators, the car model is not displayed correctly on dashboards, some are shown as "Unknown" and some are shown with their internal names for example al_pontiac_fire68. Games affected GTR2, ACC, RaceRoom.

/kind bug

simracing grafana dashboard

dashboard

recommended skills

Acceptance criteria

  • dashboard uses the plotly panel for graphs https://github.com/ae3e/ae3e-plotly-panel
  • Speed, Throttle, Brake graphs over one lap distance
  • Lap can be selected as dropdown / variable - with multi-select option
  • If multiple laps are selected, lines are drawn as overlapping lines in the same widget (like the wheel rot speed graph in the above image)

Notes

this might require preprocessing of the telemetry data as in https://docs.influxdata.com/influxdb/v2.2/process-data/get-started/#process-or-transform-your-data

Some more grafana resources:

No version identifier found in sources to perform a release

Automated version release could not be completed.

Kebechet version manager expects a file with one of the following names: ["setup.py", "__init__.py", "__about__.py", "version.py", "app.py", "wsgi.py", "pyproject.toml"] to contain the line:

...
version = X.Y.Z  (in pyproject.toml project section)
or
__version__ = X.Y.Z (in the rest of the options)
...

where X.Y.Z is the current semantic version. To fix this issue, add this line to one of these files. If none of these
files exist create one somewhere in your repository.

Related: #171

overlay-release-run fails with ssh error

+ export 'GIT_SSH_COMMAND=ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+ git clone [email protected]:b4mad/racing /workspace/configrepo
Cloning into '/workspace/configrepo'...
Warning: Identity file /opt/app-root/src/.ssh/id_rsa not accessible: No such file or directory.
Warning: Permanently added 'github.com,140.82.112.3' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

/kind bug
/priority critical-urgent

@harshad16 I think sesheta has all the required perms to clone the repo. could you have a look if you got a few free cycles?

Mark in telemetry

Would be nice to have the ability to drop markers in the telemetry, so that we can add comments to the csv file -- like "Get to the left here" or "downshift to second" etc

patch release

Hey, Kebechet!

Create a new patch release, please.

aicoe-ci overlay build fails

for tag v0.1.1. the build failed, see https://tekton.operate-first.cloud/#/namespaces/opf-ci-pipelines/pipelineruns/racing-paddock-65a091?pipelineTask=overlay-release-run&step=generate

+ '[' Containerfile == Dockerfile ']'
+ '[' -z '' ']'
+ /usr/local/bin/s2i build . --env IMAGE_NAME=quay.io/b4mad/paddock --env IMAGE_TAG=v0.1.1 --env THAMOS_RUNTIME_ENVIRONMENT=paddock --env THOTH_ADVISE=0 --env THOTH_ERROR_FALLBACK=1 --env THOTH_DRY_RUN=1 --env THAMOS_DEBUG=0 --env THAMOS_VERBOSE=1 --env THOTH_PROVENANCE_CHECK=0 --env GIT_REPO_NAME=racing --loglevel=0 --as-dockerfile /gen-source/Containerfile
ERROR: Required value not specified for "builderImage"

/kind bug
/priority important-soon

@harshad16 if you got some 15min to share, I would be happy if you can take a look at

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.