Skip to content

Turn TunerConstants into a dataclass - #360

Merged
auscompgeek merged 17 commits into
mainfrom
tuner-swerve-dataclassify
Nov 8, 2026
Merged

auscompgeek merged 17 commits into
mainfrom
tuner-swerve-dataclassify

Conversation

@auscompgeek

Copy link
Copy Markdown
Member

Make it easy to switch between swerve constants for different drive bases. This provides a way to achieve #347 in a way that the type checker is actually happy with.

To make this easier to use, this also adds a script which will read the code generated by corvus (either by the CLI tool or in Tuner X) and spit out a Python module with the appropriate constants.

corvus swerve python -i swerves/projects/comp-project.json | swerves/tuner-output-to-data | ruff format - > swerves/my_constants.py

@auscompgeek
auscompgeek requested a review from rafzip June 10, 2026 09:24
@greptile-apps

greptile-apps Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

Turns TunerConstants into a reusable dataclass and adds a converter for generated swerve code.

  • The chassis and simulator use one selected swerve setup.
  • Generated Tuner X settings can become a Python setup.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Generated["Generated swerve code"] --> Converter["tuner-output-to-data"]
    Converter --> Settings["TunerConstants instance"]
    Settings --> Derived["Drivetrain and module constants"]
    Derived --> Chassis["Chassis"]
    Derived --> Physics["Physics"]
Loading

Reviews (2) · Last reviewed commit: "tuner-output-to-data: Remove implicit an..." · Reviewed by Greptile

Comment thread swerves/comp.py Resolved
@auscompgeek
auscompgeek force-pushed the tuner-swerve-dataclassify branch 3 times, most recently from 5a742d2 to ecaa8e8 Compare June 17, 2026 09:19
@auscompgeek
auscompgeek force-pushed the tuner-swerve-dataclassify branch from ecaa8e8 to a4e65df Compare September 30, 2026 06:42
@auscompgeek
auscompgeek force-pushed the tuner-swerve-dataclassify branch from a4e65df to 61058cf Compare October 14, 2026 08:53
@auscompgeek
auscompgeek force-pushed the tuner-swerve-dataclassify branch 2 times, most recently from 36cdc38 to 0c47861 Compare October 25, 2026 12:54
@auscompgeek
auscompgeek force-pushed the tuner-swerve-dataclassify branch from d557166 to 01e6c55 Compare November 8, 2026 03:32
@auscompgeek
auscompgeek merged commit e649780 into main Nov 8, 2026
11 checks passed
@auscompgeek
auscompgeek deleted the tuner-swerve-dataclassify branch November 8, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants