Compare commits
No commits in common. "63e926f26eb151845a22f4be7671db752d1afd57" and "87e5bcae5bc68c1bb1b5d2fd1b3aaef771a8b933" have entirely different histories.
63e926f26e
...
87e5bcae5b
28 changed files with 363 additions and 3395 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -24,6 +24,3 @@ dist/
|
|||
# Environment files with secrets
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Agent notes
|
||||
AGENTS.md
|
||||
|
|
|
|||
19
AGENTS.md
19
AGENTS.md
|
|
@ -46,24 +46,7 @@ Use the `joplin_get_note` tool with note ID `6c0dcb2a567348fd9796f50c790082e4` t
|
|||
|
||||
## API Communication
|
||||
|
||||
Racecraft communicates exclusively with the rusty-telemetry REST API (28 endpoints). In development, Vite proxies `/api/*` to `http://127.0.0.1:8080`. See the rusty-telemetry README for full endpoint documentation.
|
||||
|
||||
## Features
|
||||
|
||||
- **Dashboard** — system status, live feed cards, recent sessions
|
||||
- **Live Telemetry** — real-time gauges (speed, RPM, gear, inputs), per-feed status
|
||||
- **Sessions** — create/complete/reopen sessions, start/stop/delete runs, view analysis
|
||||
- **Shift Points** — gear RPM range charts, shift event timeline, recommended shift RPM
|
||||
- **Car Characteristics** — aggregated shift-point profiles per car across all sessions
|
||||
- **Track Mapping** — canvas-rendered track boundaries, persistent track models
|
||||
|
||||
## State Management (Pinia Stores)
|
||||
|
||||
| Store | Purpose |
|
||||
|-------|---------|
|
||||
| `stores/telemetry.ts` | Live telemetry polling + derived status |
|
||||
| `stores/sessions.ts` | Session CRUD, run management, analysis retrieval |
|
||||
| `stores/tracks.ts` | Track model list + detail |
|
||||
Racecraft communicates exclusively with the rusty-telemetry REST API. In development, Vite proxies `/api/*` to `http://127.0.0.1:8080`. See the rusty-telemetry README for full endpoint documentation.
|
||||
|
||||
## Commands
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
# Commercial License
|
||||
|
||||
This software is dual-licensed:
|
||||
|
||||
1. **GNU AGPL-3.0** — for open-source use, self-hosting, and community contributions
|
||||
2. **Commercial License** — for use cases that require avoiding AGPL obligations
|
||||
|
||||
## When you need a commercial license
|
||||
|
||||
You need a commercial license if your use case involves any of the following and you do not want to release your modifications under AGPL-3.0:
|
||||
|
||||
- **Self-hosting a modified version** at a venue or organization (e.g., karting tracks, sim racing centers)
|
||||
- **Embedding or bundling** this software into hardware products (e.g., data loggers, OBD-II devices, telemetry hardware)
|
||||
- **Offering a modified version as a network service** (the AGPL-3.0 §13 network-use clause requires sharing all modifications if you don't have a commercial license)
|
||||
- **Distributing modified versions** without releasing source code
|
||||
|
||||
## When you do NOT need a commercial license
|
||||
|
||||
- Personal, non-commercial use (e.g., analyzing your own sim racing telemetry)
|
||||
- Studying, modifying, or contributing to the open-source project
|
||||
- Self-hosting an unmodified version for personal use
|
||||
- Any use where you are comfortable releasing modifications under AGPL-3.0
|
||||
|
||||
## Contact
|
||||
|
||||
For commercial license inquiries, pricing, and terms:
|
||||
|
||||
**Jan-Peter v. Hunnius**
|
||||
Email: jan@hunnius.net
|
||||
|
||||
## Contributor License Agreement
|
||||
|
||||
External contributors must sign a Contributor License Agreement (CLA) before their contributions can be merged. This ensures the project maintainer retains the right to offer commercial licenses. The CLA grants the maintainer a perpetual, worldwide, non-exclusive license to use, modify, and sublicense the contribution under any license.
|
||||
661
LICENSE
661
LICENSE
|
|
@ -1,661 +0,0 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
33
README.md
33
README.md
|
|
@ -48,7 +48,7 @@ Web-based sim racing telemetry analysis client. Connects to [rusty-telemetry](ht
|
|||
- Polling at 250ms for responsive updates
|
||||
|
||||
### Session Management
|
||||
- Create analysis sessions with use case selection (Shift Points, Track Mapping)
|
||||
- Create analysis sessions with use case selection (Shift Points, Track Map, etc.)
|
||||
- Start/stop runs within a session to capture telemetry data
|
||||
- Complete sessions to trigger automatic analysis
|
||||
- Session detail view with run history and status
|
||||
|
|
@ -59,23 +59,10 @@ Web-based sim racing telemetry analysis client. Connects to [rusty-telemetry](ht
|
|||
- Recommended shift RPM from aggregated data
|
||||
- Detailed shift event table
|
||||
|
||||
### Car Grip Analysis
|
||||
- Grip envelope chart: peak lateral/accel/brake G vs speed (envelope extraction)
|
||||
- Grip circle scatter: longitudinal G vs lateral G (friction circle)
|
||||
- Cornering grip vs speed curve
|
||||
- Steering response: steer angle vs lateral G scatter
|
||||
- Summary stats: max lateral/accel/brake/combined G
|
||||
|
||||
### Car Characteristics
|
||||
- Aggregated shift-point profiles per car across all sessions
|
||||
- Expandable car cards showing per-gear RPM/speed ranges
|
||||
- Recommended shift RPM per car
|
||||
|
||||
### Track Mapping
|
||||
### Track Map
|
||||
- Canvas-rendered track boundaries from coordinate data
|
||||
- Center line computation from left/right boundary runs
|
||||
- Boundary legend with point counts
|
||||
- Persistent track models with track list and detail views
|
||||
- Responsive canvas that redraws on window resize
|
||||
|
||||
## Tech Stack
|
||||
|
|
@ -150,23 +137,19 @@ racecraft/
|
|||
├── src/
|
||||
│ ├── main.ts # App bootstrap (Vue + Pinia + Router)
|
||||
│ ├── App.vue # Root layout with navigation
|
||||
│ ├── router/index.ts # 9 routes with lazy loading
|
||||
│ ├── router/index.ts # 6 routes with lazy loading
|
||||
│ ├── types/index.ts # TypeScript interfaces matching API JSON shapes
|
||||
│ ├── api/client.ts # Typed Axios client (all API endpoints)
|
||||
│ ├── stores/
|
||||
│ │ ├── telemetry.ts # Live telemetry with polling + derived status
|
||||
│ │ ├── sessions.ts # Session CRUD, run management, analysis
|
||||
│ │ └── tracks.ts # Track model list + detail
|
||||
│ │ └── sessions.ts # Session CRUD, run management, analysis
|
||||
│ ├── views/
|
||||
│ │ ├── DashboardView.vue # System status, feeds, quick actions
|
||||
│ │ ├── LiveView.vue # Real-time gauges and telemetry
|
||||
│ │ ├── SessionsView.vue # Session list with create/delete
|
||||
│ │ ├── SessionDetailView.vue # Run workflow, complete, analyze
|
||||
│ │ ├── ShiftPointsView.vue # RPM charts and shift event table
|
||||
│ │ ├── GripAnalysisView.vue # Grip envelope, grip circle, steering response
|
||||
│ │ ├── CharacteristicsView.vue # Car characteristics aggregation
|
||||
│ │ ├── TracksView.vue # Track model list
|
||||
│ │ └── TrackDetailView.vue # Canvas track map renderer
|
||||
│ │ └── TrackMapView.vue # Canvas track map renderer
|
||||
│ ├── components/
|
||||
│ │ └── FeedStatus.vue # Reusable feed card with health + telemetry
|
||||
│ └── assets/
|
||||
|
|
@ -177,7 +160,7 @@ racecraft/
|
|||
|
||||
## API Contract
|
||||
|
||||
Racecraft consumes the rusty-telemetry REST API (28 endpoints). See the [rusty-telemetry README](https://codeberg.org/jhunnius/rusty-telemetry) for full endpoint documentation.
|
||||
Racecraft consumes the rusty-telemetry REST API (19 endpoints). See the [rusty-telemetry README](https://codeberg.org/jhunnius/rusty-telemetry) for full endpoint documentation.
|
||||
|
||||
Key endpoints used:
|
||||
- `GET /api/live` — polled every 250ms–1000ms for live telemetry
|
||||
|
|
@ -185,10 +168,6 @@ Key endpoints used:
|
|||
- `POST /api/sessions/{id}/runs` / `POST /api/sessions/{id}/runs/{run_id}/stop` — run capture
|
||||
- `POST /api/sessions/{id}/complete` — complete session and trigger analysis
|
||||
- `GET /api/sessions/{id}/analysis` — retrieve analysis results
|
||||
- `GET /api/characteristics/cars` — aggregated car shift-point profiles
|
||||
- `GET /api/characteristics/cars/{car}` — detailed per-gear data for a car
|
||||
- `GET /api/tracks` / `GET /api/tracks/{game}/{track_name}` — track model list and detail
|
||||
- `POST /api/tracks/build` — build track model from completed session
|
||||
|
||||
## License
|
||||
|
||||
|
|
|
|||
17
src/App.vue
17
src/App.vue
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { RouterLink, RouterView, useRoute } from 'vue-router'
|
||||
import { computed } from 'vue'
|
||||
|
|
@ -24,8 +9,6 @@ const navItems = [
|
|||
{ path: '/', label: 'Dashboard', icon: '🏠' },
|
||||
{ path: '/live', label: 'Live', icon: '📡' },
|
||||
{ path: '/sessions', label: 'Sessions', icon: '📊' },
|
||||
{ path: '/tracks', label: 'Tracks', icon: '🗺' },
|
||||
{ path: '/characteristics', label: 'Characteristics', icon: '🏭' },
|
||||
]
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import axios from 'axios'
|
||||
import type {
|
||||
LiveTelemetryResponse,
|
||||
|
|
@ -24,11 +9,6 @@ import type {
|
|||
SessionRun,
|
||||
UseCaseInfo,
|
||||
AnalysisResult,
|
||||
TrackModel,
|
||||
TrackSummary,
|
||||
BuildTrackModelRequest,
|
||||
CarProfile,
|
||||
GameInfo,
|
||||
} from '@/types'
|
||||
|
||||
const api = axios.create({
|
||||
|
|
@ -46,11 +26,6 @@ export async function getLiveTelemetry(): Promise<LiveTelemetryResponse> {
|
|||
return res.data
|
||||
}
|
||||
|
||||
export async function getGameInfo(): Promise<GameInfo> {
|
||||
const res = await api.get<GameInfo>('/game-info')
|
||||
return res.data
|
||||
}
|
||||
|
||||
// ── Recordings ──
|
||||
|
||||
export async function listRecordings(): Promise<RecordingManifest[]> {
|
||||
|
|
@ -113,15 +88,6 @@ export async function stopRun(sessionId: string, runId: string): Promise<Session
|
|||
return res.data
|
||||
}
|
||||
|
||||
export async function deleteRun(sessionId: string, runId: string): Promise<void> {
|
||||
await api.delete(`/sessions/${sessionId}/runs/${runId}`)
|
||||
}
|
||||
|
||||
export async function reopenSession(id: string): Promise<UseCaseSession> {
|
||||
const res = await api.post<UseCaseSession>(`/sessions/${id}/reopen`)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function completeSession(id: string): Promise<UseCaseSession> {
|
||||
const res = await api.post<UseCaseSession>(`/sessions/${id}/complete`)
|
||||
return res.data
|
||||
|
|
@ -149,32 +115,4 @@ export async function getGames(): Promise<string[]> {
|
|||
return res.data
|
||||
}
|
||||
|
||||
// ── Tracks ──
|
||||
|
||||
export async function listTracks(): Promise<TrackSummary[]> {
|
||||
const res = await api.get<TrackSummary[]>('/tracks')
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function getTrack(game: string, trackName: string): Promise<TrackModel> {
|
||||
const res = await api.get<TrackModel>(`/tracks/${encodeURIComponent(game)}/${encodeURIComponent(trackName)}`)
|
||||
return res.data
|
||||
}
|
||||
|
||||
export async function deleteTrack(game: string, trackName: string): Promise<void> {
|
||||
await api.delete(`/tracks/${encodeURIComponent(game)}/${encodeURIComponent(trackName)}`)
|
||||
}
|
||||
|
||||
export async function buildTrackModel(req: BuildTrackModelRequest): Promise<TrackModel> {
|
||||
const res = await api.post<TrackModel>('/tracks/build', req)
|
||||
return res.data
|
||||
}
|
||||
|
||||
// ── Characteristics ──
|
||||
|
||||
export async function listCarProfiles(): Promise<CarProfile[]> {
|
||||
const res = await api.get<CarProfile[]>('/characteristics/cars')
|
||||
return res.data
|
||||
}
|
||||
|
||||
export default api
|
||||
|
|
|
|||
|
|
@ -71,18 +71,6 @@ input, select, textarea {
|
|||
}
|
||||
|
||||
/* Utility classes */
|
||||
.form-input {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius);
|
||||
padding: 0.5rem 0.75rem;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.form-input:focus {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
|
|
@ -208,12 +196,8 @@ input, select, textarea {
|
|||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
.grid-4 {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.grid-2, .grid-3, .grid-4 {
|
||||
.grid-2, .grid-3 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import type { LiveFeedSnapshot } from '@/types'
|
||||
import { computed } from 'vue'
|
||||
|
|
|
|||
|
|
@ -1,99 +0,0 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { ref, type Ref } from 'vue'
|
||||
|
||||
export interface ZoomState {
|
||||
zoom: number
|
||||
panX: number
|
||||
panY: number
|
||||
}
|
||||
|
||||
export function useCanvasZoom(canvasRef: Ref<HTMLCanvasElement | null>, redraw: () => void) {
|
||||
const zoom = ref(1)
|
||||
const panX = ref(0)
|
||||
const panY = ref(0)
|
||||
const isDragging = ref(false)
|
||||
const lastMouseX = ref(0)
|
||||
const lastMouseY = ref(0)
|
||||
|
||||
function onWheel(e: WheelEvent) {
|
||||
e.preventDefault()
|
||||
if (!canvasRef.value) return
|
||||
|
||||
const rect = canvasRef.value.getBoundingClientRect()
|
||||
const mouseX = e.clientX - rect.left
|
||||
const mouseY = e.clientY - rect.top
|
||||
|
||||
const oldZoom = zoom.value
|
||||
const delta = e.deltaY > 0 ? 0.9 : 1.1
|
||||
zoom.value = Math.max(0.5, Math.min(20, zoom.value * delta))
|
||||
|
||||
// Zoom toward mouse position
|
||||
const scale = zoom.value / oldZoom
|
||||
panX.value = mouseX - (mouseX - panX.value) * scale
|
||||
panY.value = mouseY - (mouseY - panY.value) * scale
|
||||
|
||||
redraw()
|
||||
}
|
||||
|
||||
function onMouseDown(e: MouseEvent) {
|
||||
isDragging.value = true
|
||||
lastMouseX.value = e.clientX
|
||||
lastMouseY.value = e.clientY
|
||||
if (canvasRef.value) {
|
||||
canvasRef.value.style.cursor = 'grabbing'
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseMove(e: MouseEvent) {
|
||||
if (!isDragging.value) return
|
||||
panX.value += e.clientX - lastMouseX.value
|
||||
panY.value += e.clientY - lastMouseY.value
|
||||
lastMouseX.value = e.clientX
|
||||
lastMouseY.value = e.clientY
|
||||
redraw()
|
||||
}
|
||||
|
||||
function onMouseUp() {
|
||||
isDragging.value = false
|
||||
if (canvasRef.value) {
|
||||
canvasRef.value.style.cursor = 'grab'
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
zoom.value = 1
|
||||
panX.value = 0
|
||||
panY.value = 0
|
||||
redraw()
|
||||
}
|
||||
|
||||
function applyTransform(ctx: CanvasRenderingContext2D) {
|
||||
ctx.translate(panX.value, panY.value)
|
||||
ctx.scale(zoom.value, zoom.value)
|
||||
}
|
||||
|
||||
return {
|
||||
zoom,
|
||||
isDragging,
|
||||
onWheel,
|
||||
onMouseDown,
|
||||
onMouseMove,
|
||||
onMouseUp,
|
||||
reset,
|
||||
applyTransform,
|
||||
}
|
||||
}
|
||||
15
src/main.ts
15
src/main.ts
|
|
@ -1,18 +1,3 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import App from './App.vue'
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
|
|
@ -46,33 +31,11 @@ const router = createRouter({
|
|||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/analysis/grip/:id',
|
||||
name: 'grip-analysis',
|
||||
component: () => import('@/views/GripAnalysisView.vue'),
|
||||
path: '/analysis/track-map/:id',
|
||||
name: 'track-map',
|
||||
component: () => import('@/views/TrackMapView.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/analysis/racing-line/:id',
|
||||
name: 'racing-line',
|
||||
component: () => import('@/views/RacingLineView.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/tracks',
|
||||
name: 'tracks',
|
||||
component: () => import('@/views/TracksView.vue'),
|
||||
},
|
||||
{
|
||||
path: '/tracks/:game/:trackName',
|
||||
name: 'track-detail',
|
||||
component: () => import('@/views/TrackDetailView.vue'),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: '/characteristics',
|
||||
name: 'characteristics',
|
||||
component: () => import('@/views/CharacteristicsView.vue'),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import type { UseCaseSession, CreateSessionRequest, StartRunRequest, SessionRun, AnalysisResult } from '@/types'
|
||||
|
|
@ -134,40 +119,6 @@ export const useSessionsStore = defineStore('sessions', () => {
|
|||
}
|
||||
}
|
||||
|
||||
async function deleteRun(sessionId: string, runId: string): Promise<boolean> {
|
||||
try {
|
||||
await api.deleteRun(sessionId, runId)
|
||||
if (currentSession.value?.id === sessionId) {
|
||||
currentSession.value.runs = currentSession.value.runs.filter((r) => r.id !== runId)
|
||||
const sIdx = sessions.value.findIndex((s) => s.id === sessionId)
|
||||
if (sIdx !== -1) {
|
||||
sessions.value[sIdx] = { ...sessions.value[sIdx], runs: [...currentSession.value.runs] }
|
||||
}
|
||||
}
|
||||
return true
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to delete run'
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
async function reopenSession(id: string): Promise<UseCaseSession | null> {
|
||||
try {
|
||||
const session = await api.reopenSession(id)
|
||||
const idx = sessions.value.findIndex((s) => s.id === id)
|
||||
if (idx !== -1) {
|
||||
sessions.value[idx] = session
|
||||
}
|
||||
if (currentSession.value?.id === id) {
|
||||
currentSession.value = session
|
||||
}
|
||||
return session
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to reopen session'
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
sessions,
|
||||
currentSession,
|
||||
|
|
@ -179,9 +130,7 @@ export const useSessionsStore = defineStore('sessions', () => {
|
|||
deleteSession,
|
||||
startRun,
|
||||
stopRun,
|
||||
deleteRun,
|
||||
completeSession,
|
||||
reopenSession,
|
||||
reAnalyze,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,33 +1,16 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, computed } from 'vue'
|
||||
import type { LiveTelemetryResponse, LiveFeedSnapshot, GameInfo } from '@/types'
|
||||
import { getLiveTelemetry, getGameInfo } from '@/api/client'
|
||||
import type { LiveTelemetryResponse, LiveFeedSnapshot } from '@/types'
|
||||
import { getLiveTelemetry } from '@/api/client'
|
||||
|
||||
export const useTelemetryStore = defineStore('telemetry', () => {
|
||||
const feeds = ref<LiveFeedSnapshot[]>([])
|
||||
const activeRecording = ref<string | null>(null)
|
||||
const gameInfo = ref<GameInfo>({})
|
||||
const connected = ref(false)
|
||||
const error = ref<string | null>(null)
|
||||
const lastUpdate = ref<Date | null>(null)
|
||||
|
||||
let pollTimer: ReturnType<typeof setInterval> | null = null
|
||||
let gameInfoCounter = 0
|
||||
|
||||
const anyFeedAlive = computed(() => feeds.value.some((f) => f.health === 'alive'))
|
||||
const anyFeedStale = computed(() => feeds.value.some((f) => f.health === 'stale'))
|
||||
|
|
@ -67,12 +50,6 @@ export const useTelemetryStore = defineStore('telemetry', () => {
|
|||
connected.value = true
|
||||
error.value = null
|
||||
lastUpdate.value = new Date()
|
||||
gameInfoCounter++
|
||||
if (gameInfoCounter % 8 === 0) {
|
||||
try {
|
||||
gameInfo.value = await getGameInfo()
|
||||
} catch { /* non-critical */ }
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
connected.value = false
|
||||
error.value = e instanceof Error ? e.message : 'Connection failed'
|
||||
|
|
@ -95,7 +72,6 @@ export const useTelemetryStore = defineStore('telemetry', () => {
|
|||
return {
|
||||
feeds,
|
||||
activeRecording,
|
||||
gameInfo,
|
||||
connected,
|
||||
error,
|
||||
lastUpdate,
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import type { TrackModel, TrackSummary } from '@/types'
|
||||
import * as api from '@/api/client'
|
||||
|
||||
export const useTracksStore = defineStore('tracks', () => {
|
||||
const tracks = ref<TrackSummary[]>([])
|
||||
const currentTrack = ref<TrackModel | null>(null)
|
||||
const loading = ref(false)
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
async function fetchTracks() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
tracks.value = await api.listTracks()
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load tracks'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchTrack(game: string, trackName: string) {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
currentTrack.value = await api.getTrack(game, trackName)
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load track'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteTrack(game: string, trackName: string) {
|
||||
try {
|
||||
await api.deleteTrack(game, trackName)
|
||||
tracks.value = tracks.value.filter(
|
||||
(t) => !(t.game === game && t.track_name === trackName),
|
||||
)
|
||||
if (
|
||||
currentTrack.value?.game === game &&
|
||||
currentTrack.value?.track_name === trackName
|
||||
) {
|
||||
currentTrack.value = null
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to delete track'
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tracks,
|
||||
currentTrack,
|
||||
loading,
|
||||
error,
|
||||
fetchTracks,
|
||||
fetchTrack,
|
||||
deleteTrack,
|
||||
}
|
||||
})
|
||||
|
|
@ -1,18 +1,3 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
// TypeScript interfaces matching the rusty-telemetry REST API JSON responses.
|
||||
// Field names use snake_case to match Rust's serde serialization.
|
||||
|
||||
|
|
@ -20,19 +5,18 @@
|
|||
|
||||
export type UseCase =
|
||||
| 'shift_points'
|
||||
| 'car_grip'
|
||||
| 'racing_line'
|
||||
| 'braking_analysis'
|
||||
| 'lap_times'
|
||||
| 'sector_analysis'
|
||||
| 'track_mapping'
|
||||
| 'track_map'
|
||||
| 'general'
|
||||
|
||||
export type Game =
|
||||
| 'assetto_corsa'
|
||||
| 'assetto_corsa_competizione'
|
||||
| 'project_cars_1'
|
||||
| 'project_cars_2'
|
||||
| 'project_cars1'
|
||||
| 'project_cars2'
|
||||
|
||||
export type RecordingStatus = 'recording' | 'stopped'
|
||||
export type SessionStatus = 'active' | 'completed'
|
||||
|
|
@ -118,8 +102,6 @@ export interface UseCaseSession {
|
|||
analysis: AnalysisResult | null
|
||||
guidance: string | null
|
||||
recording_id: string | null
|
||||
car_name?: string | null
|
||||
track_name?: string | null
|
||||
}
|
||||
|
||||
export interface CreateSessionRequest {
|
||||
|
|
@ -130,7 +112,6 @@ export interface CreateSessionRequest {
|
|||
export interface StartRunRequest {
|
||||
feed_name: string
|
||||
label?: string | null
|
||||
merge_feeds?: string[]
|
||||
}
|
||||
|
||||
// ── Use Cases ──
|
||||
|
|
@ -141,14 +122,6 @@ export interface UseCaseInfo {
|
|||
guidance: string
|
||||
}
|
||||
|
||||
// ── Game Info (from KSUDP handshake) ──
|
||||
|
||||
export interface GameInfo {
|
||||
car_name?: string | null
|
||||
track_name?: string | null
|
||||
driver_name?: string | null
|
||||
}
|
||||
|
||||
// ── Analysis Results ──
|
||||
|
||||
// Shift Point Analysis (use_case = "shift_points")
|
||||
|
|
@ -187,44 +160,7 @@ export interface ShiftPointAnalysis {
|
|||
total_frames_analyzed: number
|
||||
}
|
||||
|
||||
// Car Grip Analysis (use_case = "car_grip")
|
||||
export interface GripEnvelopePoint {
|
||||
speed_kmh: number
|
||||
max_lateral_g: number
|
||||
max_accel_g: number
|
||||
max_brake_g: number
|
||||
sample_count: number
|
||||
}
|
||||
|
||||
export interface GripCirclePoint {
|
||||
longitudinal_g: number
|
||||
lateral_g: number
|
||||
}
|
||||
|
||||
export interface SteeringResponsePoint {
|
||||
steer: number
|
||||
lateral_g: number
|
||||
speed_kmh: number
|
||||
}
|
||||
|
||||
export interface GripSummary {
|
||||
max_lateral_g: number
|
||||
max_accel_g: number
|
||||
max_brake_g: number
|
||||
max_combined_g: number
|
||||
peak_lateral_speed_kmh: number
|
||||
}
|
||||
|
||||
export interface CarGripAnalysis {
|
||||
summary: GripSummary
|
||||
grip_envelope: GripEnvelopePoint[]
|
||||
grip_circle: GripCirclePoint[]
|
||||
steering_response: SteeringResponsePoint[]
|
||||
runs_analyzed: number
|
||||
total_frames_analyzed: number
|
||||
}
|
||||
|
||||
// Track Map Analysis (use_case = "track_mapping")
|
||||
// Track Map Analysis (use_case = "track_map")
|
||||
export interface TrackPoint {
|
||||
x: number
|
||||
y: number
|
||||
|
|
@ -250,105 +186,5 @@ export interface NotImplementedResponse {
|
|||
use_case: string
|
||||
}
|
||||
|
||||
// ── Track Models (persistent, from /api/tracks) ──
|
||||
|
||||
export interface Corner {
|
||||
index: number
|
||||
number: number
|
||||
entry_s: number
|
||||
apex_s: number
|
||||
exit_s: number
|
||||
curvature_peak: number
|
||||
}
|
||||
|
||||
export interface Sector {
|
||||
index: number
|
||||
start_s: number
|
||||
end_s: number
|
||||
}
|
||||
|
||||
export type TrackModelSource = 'boundary_recording'
|
||||
|
||||
export interface TrackModel {
|
||||
game: string
|
||||
track_name: string
|
||||
center_line: number[][]
|
||||
left_boundary: number[][]
|
||||
right_boundary: number[][]
|
||||
track_width: number[]
|
||||
heading: number[]
|
||||
curvature: number[]
|
||||
corners: Corner[]
|
||||
sectors: Sector[]
|
||||
source: TrackModelSource
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface TrackSummary {
|
||||
game: string
|
||||
track_name: string
|
||||
source: TrackModelSource
|
||||
created_at: string
|
||||
corner_count: number
|
||||
}
|
||||
|
||||
export interface BuildTrackModelRequest {
|
||||
session_id: string
|
||||
game?: string | null
|
||||
track_name?: string | null
|
||||
}
|
||||
|
||||
export type TrackMappingAnalysis = TrackMapAnalysis
|
||||
|
||||
// ── Racing Line Analysis ──
|
||||
|
||||
export interface RacingLinePoint {
|
||||
x: number
|
||||
y: number
|
||||
z: number
|
||||
speed_kmh: number
|
||||
spline: number
|
||||
}
|
||||
|
||||
export interface RacingLap {
|
||||
label: string
|
||||
lap_index: number
|
||||
point_count: number
|
||||
points: RacingLinePoint[]
|
||||
lap_time_ms: number
|
||||
length_m: number
|
||||
avg_speed_kmh: number
|
||||
max_speed_kmh: number
|
||||
}
|
||||
|
||||
export interface RacingLineAnalysis {
|
||||
laps: RacingLap[]
|
||||
position_mode: 'Spline' | 'Coordinate'
|
||||
total_laps: number
|
||||
total_frames_analyzed: number
|
||||
}
|
||||
|
||||
export type AnalysisResult = ShiftPointAnalysis | CarGripAnalysis | TrackMapAnalysis | RacingLineAnalysis | NotImplementedResponse
|
||||
|
||||
// ── Characteristics (aggregated across sessions) ──
|
||||
|
||||
export interface CarGearProfile {
|
||||
gear: number
|
||||
gear_display: string
|
||||
min_rpm: number
|
||||
max_rpm: number
|
||||
min_speed_kmh: number
|
||||
max_speed_kmh: number
|
||||
session_count: number
|
||||
}
|
||||
|
||||
export interface CarProfile {
|
||||
car_name: string
|
||||
session_count: number
|
||||
recommended_shift_rpm_avg: number | null
|
||||
recommended_shift_rpm_min: number | null
|
||||
recommended_shift_rpm_max: number | null
|
||||
gear_profiles: CarGearProfile[]
|
||||
last_session_id: string
|
||||
last_session_date: string
|
||||
}
|
||||
// Union of all analysis result types — matches backend discriminant responses
|
||||
export type AnalysisResult = ShiftPointAnalysis | TrackMapAnalysis | NotImplementedResponse
|
||||
|
|
|
|||
|
|
@ -1,19 +1,4 @@
|
|||
// racecraft — Vue.js web client for sim racing telemetry analysis
|
||||
// Copyright (C) 2026 Jan-Peter v. Hunnius
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
import type { ShiftPointAnalysis, CarGripAnalysis, TrackMapAnalysis, RacingLineAnalysis } from '@/types'
|
||||
import type { ShiftPointAnalysis, TrackMapAnalysis } from '@/types'
|
||||
|
||||
/**
|
||||
* Runtime type guard: checks if an unknown value is a ShiftPointAnalysis.
|
||||
|
|
@ -23,14 +8,6 @@ export function isShiftPointAnalysis(data: unknown): data is ShiftPointAnalysis
|
|||
return typeof data === 'object' && data !== null && 'gear_curves' in data
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime type guard: checks if an unknown value is a CarGripAnalysis.
|
||||
* Uses the 'grip_envelope' discriminator field.
|
||||
*/
|
||||
export function isCarGripAnalysis(data: unknown): data is CarGripAnalysis {
|
||||
return typeof data === 'object' && data !== null && 'grip_envelope' in data
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime type guard: checks if an unknown value is a TrackMapAnalysis.
|
||||
* Uses the 'boundaries' discriminator field that the backend includes.
|
||||
|
|
@ -45,11 +22,3 @@ export function isTrackMapAnalysis(data: unknown): data is TrackMapAnalysis {
|
|||
export function isNotImplemented(data: unknown): data is { status: 'not_implemented'; use_case: string } {
|
||||
return typeof data === 'object' && data !== null && 'status' in data && (data as { status: string }).status === 'not_implemented'
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime type guard: checks if an unknown value is a RacingLineAnalysis.
|
||||
* Uses the 'laps' discriminator field.
|
||||
*/
|
||||
export function isRacingLineAnalysis(data: unknown): data is RacingLineAnalysis {
|
||||
return typeof data === 'object' && data !== null && 'laps' in data && 'position_mode' in data
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,189 +0,0 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
import * as api from '@/api/client'
|
||||
import type { CarProfile } from '@/types'
|
||||
|
||||
const profiles = ref<CarProfile[]>([])
|
||||
const loading = ref(true)
|
||||
const error = ref<string | null>(null)
|
||||
const expanded = ref<Set<string>>(new Set())
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
profiles.value = await api.listCarProfiles()
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load characteristics'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
function toggle(carName: string) {
|
||||
const next = new Set(expanded.value)
|
||||
if (next.has(carName)) {
|
||||
next.delete(carName)
|
||||
} else {
|
||||
next.add(carName)
|
||||
}
|
||||
expanded.value = next
|
||||
}
|
||||
|
||||
function formatTime(iso: string): string {
|
||||
return new Date(iso).toLocaleString()
|
||||
}
|
||||
|
||||
function rpmLabel(rpm: number | null): string {
|
||||
return rpm !== null ? `${Math.round(rpm).toLocaleString()}` : '—'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="characteristics-view">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="page-title">Characteristics</h2>
|
||||
</div>
|
||||
|
||||
<div v-if="error" class="card mb-3 text-error">{{ error }}</div>
|
||||
<div v-if="loading" class="card text-secondary">Loading...</div>
|
||||
|
||||
<div v-if="!loading && profiles.length === 0" class="card text-secondary">
|
||||
<p class="mb-2">No car characteristics data yet.</p>
|
||||
<p style="font-size: 0.85rem; color: var(--color-text-muted)">
|
||||
Complete Shift Points analysis sessions to build per-car profiles across your sessions.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="profile-cards">
|
||||
<div v-for="car in profiles" :key="car.car_name" class="card profile-card">
|
||||
<div class="flex items-center justify-between" @click="toggle(car.car_name)" style="cursor: pointer">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="car-name">{{ car.car_name }}</span>
|
||||
<span class="badge badge-muted">{{ car.session_count }} session{{ car.session_count !== 1 ? 's' : '' }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-secondary" style="font-size: 0.85rem">
|
||||
Shift RPM: {{ rpmLabel(car.recommended_shift_rpm_avg) }}
|
||||
</span>
|
||||
<span class="expand-icon">{{ expanded.has(car.car_name) ? '▾' : '▸' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="expanded.has(car.car_name)" class="gear-table-wrap mt-2">
|
||||
<table v-if="car.gear_profiles.length > 0" class="gear-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Gear</th>
|
||||
<th>Min RPM</th>
|
||||
<th>Max RPM</th>
|
||||
<th>Min Speed</th>
|
||||
<th>Max Speed</th>
|
||||
<th>Sessions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="gear in car.gear_profiles" :key="gear.gear">
|
||||
<td class="mono">{{ gear.gear_display }}</td>
|
||||
<td class="mono">{{ Math.round(gear.min_rpm).toLocaleString() }}</td>
|
||||
<td class="mono">{{ Math.round(gear.max_rpm).toLocaleString() }}</td>
|
||||
<td class="mono">{{ Math.round(gear.min_speed_kmh) }} km/h</td>
|
||||
<td class="mono">{{ Math.round(gear.max_speed_kmh) }} km/h</td>
|
||||
<td class="mono">{{ gear.session_count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="shift-rpm-detail mt-2">
|
||||
<span class="text-secondary" style="font-size: 0.85rem">
|
||||
Recommended shift RPM — avg: {{ rpmLabel(car.recommended_shift_rpm_avg) }} ·
|
||||
min: {{ rpmLabel(car.recommended_shift_rpm_min) }} ·
|
||||
max: {{ rpmLabel(car.recommended_shift_rpm_max) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<RouterLink
|
||||
:to="`/sessions/${car.last_session_id}`"
|
||||
class="btn btn-secondary btn-sm"
|
||||
>
|
||||
View last session
|
||||
</RouterLink>
|
||||
<span class="text-muted ml-2" style="font-size: 0.8rem">{{ formatTime(car.last_session_date) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.profile-cards {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.profile-card:hover {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.car-name {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: 0.85rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.gear-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.gear-table th,
|
||||
.gear-table td {
|
||||
text-align: left;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.gear-table th {
|
||||
color: var(--color-text-muted);
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.gear-table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
|
@ -44,7 +29,7 @@ function useCaseLabel(uc: string): string {
|
|||
braking_analysis: 'Braking Analysis',
|
||||
lap_times: 'Lap Times',
|
||||
sector_analysis: 'Sector Analysis',
|
||||
track_mapping: 'Track Mapping',
|
||||
track_map: 'Track Map',
|
||||
general: 'General',
|
||||
}
|
||||
return labels[uc] ?? uc
|
||||
|
|
@ -114,10 +99,6 @@ const aliveCount = computed(() => telemetry.feeds.filter((f) => f.health === 'al
|
|||
<span class="text-success">{{ aliveCount }} feed(s) receiving data</span>
|
||||
<span class="text-muted">·</span>
|
||||
<span class="text-secondary">{{ telemetry.totalPackets.toLocaleString() }} packets total</span>
|
||||
<template v-if="telemetry.gameInfo.car_name || telemetry.gameInfo.track_name">
|
||||
<span class="text-muted">·</span>
|
||||
<span class="text-secondary">{{ [telemetry.gameInfo.car_name, telemetry.gameInfo.track_name].filter(Boolean).join(' @ ') }}</span>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else-if="telemetry.anyFeedStale">
|
||||
<span class="text-warning">Data stream stalled</span>
|
||||
|
|
@ -183,9 +164,8 @@ const aliveCount = computed(() => telemetry.feeds.filter((f) => f.health === 'al
|
|||
<h2>Quick Actions</h2>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<RouterLink to="/live" class="btn btn-primary">Live Telemetry</RouterLink>
|
||||
<RouterLink to="/sessions" class="btn btn-secondary">Sessions</RouterLink>
|
||||
<RouterLink to="/tracks" class="btn btn-secondary">Tracks</RouterLink>
|
||||
<RouterLink to="/live" class="btn btn-primary">📡 Live Telemetry</RouterLink>
|
||||
<RouterLink to="/sessions" class="btn btn-secondary">📊 Sessions</RouterLink>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,315 +0,0 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Scatter } from 'vue-chartjs'
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
LinearScale,
|
||||
PointElement,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend,
|
||||
} from 'chart.js'
|
||||
import type { CarGripAnalysis } from '@/types'
|
||||
import { isCarGripAnalysis } from '@/utils/analysis'
|
||||
import * as api from '@/api/client'
|
||||
|
||||
ChartJS.register(LinearScale, PointElement, Title, Tooltip, Legend)
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const sessionId = computed(() => route.params.id as string)
|
||||
const analysis = ref<CarGripAnalysis | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await api.getAnalysis(sessionId.value)
|
||||
if (isCarGripAnalysis(data)) {
|
||||
analysis.value = data
|
||||
} else {
|
||||
error.value = 'Analysis data not available or wrong type'
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load analysis'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
const axisColor = '#8b8fa3'
|
||||
const gridColor = '#2a2e3f'
|
||||
|
||||
const gripCurveData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
const env = analysis.value.grip_envelope
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: 'Lateral G',
|
||||
data: env.map((p) => ({ x: p.speed_kmh, y: p.max_lateral_g })),
|
||||
borderColor: '#4f8ff7',
|
||||
backgroundColor: '#4f8ff730',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
pointRadius: 2,
|
||||
borderWidth: 2,
|
||||
tension: 0.3,
|
||||
},
|
||||
{
|
||||
label: 'Accel G',
|
||||
data: env.map((p) => ({ x: p.speed_kmh, y: p.max_accel_g })),
|
||||
borderColor: '#34d399',
|
||||
backgroundColor: '#34d39930',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
pointRadius: 2,
|
||||
borderWidth: 2,
|
||||
tension: 0.3,
|
||||
},
|
||||
{
|
||||
label: 'Brake G',
|
||||
data: env.map((p) => ({ x: p.speed_kmh, y: -p.max_brake_g })),
|
||||
borderColor: '#f87171',
|
||||
backgroundColor: '#f8717130',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
pointRadius: 2,
|
||||
borderWidth: 2,
|
||||
tension: 0.3,
|
||||
},
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const gripCurveOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { labels: { color: axisColor } },
|
||||
title: { display: true, text: 'Grip Envelope — Peak G vs Speed', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Speed (km/h)', color: axisColor } },
|
||||
y: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'G-force', color: axisColor } },
|
||||
},
|
||||
}
|
||||
|
||||
const gripCircleData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: 'G-force samples',
|
||||
data: analysis.value.grip_circle.map((p) => ({ x: p.longitudinal_g, y: p.lateral_g })),
|
||||
backgroundColor: '#4f8ff720',
|
||||
borderColor: '#4f8ff7',
|
||||
pointRadius: 1.5,
|
||||
showLine: false,
|
||||
},
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const gripCircleOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: 'Grip Circle — Longitudinal vs Lateral G', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Longitudinal G (brake ← → accel)', color: axisColor } },
|
||||
y: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Lateral G (right ← → left)', color: axisColor } },
|
||||
},
|
||||
}
|
||||
|
||||
const steerResponseData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: 'Samples',
|
||||
data: analysis.value.steering_response.map((p) => ({ x: p.steer, y: p.lateral_g })),
|
||||
backgroundColor: '#fbbf2420',
|
||||
borderColor: '#fbbf24',
|
||||
pointRadius: 1.5,
|
||||
showLine: false,
|
||||
},
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const steerResponseOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
title: { display: true, text: 'Steering Response — Steer Angle vs Lateral G', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Steering Input (right ← → left)', color: axisColor } },
|
||||
y: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Lateral G', color: axisColor } },
|
||||
},
|
||||
}
|
||||
|
||||
const speedVsSteerData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
const env = analysis.value.grip_envelope
|
||||
return {
|
||||
datasets: [
|
||||
{
|
||||
label: 'Peak lateral G per speed bin',
|
||||
data: env.map((p) => ({ x: p.speed_kmh, y: p.max_lateral_g })),
|
||||
borderColor: '#a78bfa',
|
||||
backgroundColor: '#a78bfa30',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
pointRadius: 2,
|
||||
borderWidth: 2,
|
||||
tension: 0.3,
|
||||
},
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const speedVsSteerOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { labels: { color: axisColor } },
|
||||
title: { display: true, text: 'Cornering Grip vs Speed', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Speed (km/h)', color: axisColor } },
|
||||
y: { ticks: { color: axisColor }, grid: { color: gridColor }, title: { display: true, text: 'Peak Lateral G', color: axisColor } },
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grip-analysis">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<button class="btn btn-secondary btn-sm" @click="router.back()">← Back</button>
|
||||
<h2 class="page-title">Car Grip Analysis</h2>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="card text-secondary">Loading analysis...</div>
|
||||
<div v-if="error" class="card text-error">{{ error }}</div>
|
||||
|
||||
<template v-if="analysis">
|
||||
<!-- Summary Stats -->
|
||||
<div class="stat-grid mb-3">
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Lateral G</span>
|
||||
<span class="stat-value mono">{{ analysis.summary.max_lateral_g.toFixed(2) }}</span>
|
||||
<span class="stat-sub">at {{ Math.round(analysis.summary.peak_lateral_speed_kmh) }} km/h</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Accel G</span>
|
||||
<span class="stat-value mono">{{ analysis.summary.max_accel_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Brake G</span>
|
||||
<span class="stat-value mono">{{ analysis.summary.max_brake_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Combined G</span>
|
||||
<span class="stat-value mono">{{ analysis.summary.max_combined_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Frames Analyzed</span>
|
||||
<span class="stat-value mono">{{ analysis.total_frames_analyzed.toLocaleString() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Charts -->
|
||||
<div class="chart-grid">
|
||||
<div class="chart-card">
|
||||
<Scatter v-if="gripCurveData" :data="gripCurveData" :options="gripCurveOptions" />
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<Scatter v-if="gripCircleData" :data="gripCircleData" :options="gripCircleOptions" />
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<Scatter v-if="speedVsSteerData" :data="speedVsSteerData" :options="speedVsSteerOptions" />
|
||||
</div>
|
||||
<div class="chart-card">
|
||||
<Scatter v-if="steerResponseData" :data="steerResponseData" :options="steerResponseOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
padding: 0.75rem;
|
||||
background: var(--color-background);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.7rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.stat-sub {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.chart-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-card {
|
||||
padding: 1rem;
|
||||
background: var(--color-surface);
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, onUnmounted, computed } from 'vue'
|
||||
import { useTelemetryStore } from '@/stores/telemetry'
|
||||
|
|
|
|||
|
|
@ -1,420 +0,0 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, computed, watch, nextTick } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import type { RacingLineAnalysis } from '@/types'
|
||||
import { isRacingLineAnalysis } from '@/utils/analysis'
|
||||
import { useCanvasZoom } from '@/composables/useCanvasZoom'
|
||||
import * as api from '@/api/client'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const sessionId = computed(() => route.params.id as string)
|
||||
const analysis = ref<RacingLineAnalysis | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref<string | null>(null)
|
||||
|
||||
const canvas = ref<HTMLCanvasElement | null>(null)
|
||||
const colorMode = ref<'speed' | 'lap'>('speed')
|
||||
const visibleLaps = ref<Set<number>>(new Set())
|
||||
|
||||
const lapColors = ['#4f8ff7', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#22d3ee', '#fb923c', '#ec4899']
|
||||
|
||||
const { zoom, onWheel, onMouseDown, onMouseMove, onMouseUp, reset: resetZoom, applyTransform } = useCanvasZoom(canvas, draw)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await api.getAnalysis(sessionId.value)
|
||||
if (isRacingLineAnalysis(data)) {
|
||||
analysis.value = data
|
||||
visibleLaps.value = new Set(data.laps.map((_, i) => i))
|
||||
} else {
|
||||
error.value = 'Analysis data not available or wrong type'
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load analysis'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
await nextTick()
|
||||
resizeCanvas()
|
||||
draw()
|
||||
window.addEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
function onResize() {
|
||||
resizeCanvas()
|
||||
draw()
|
||||
}
|
||||
|
||||
function resizeCanvas() {
|
||||
if (!canvas.value) return
|
||||
const container = canvas.value.parentElement
|
||||
if (container) {
|
||||
canvas.value.width = container.clientWidth
|
||||
canvas.value.height = Math.max(500, container.clientWidth * 0.6)
|
||||
}
|
||||
}
|
||||
|
||||
watch([analysis, colorMode, visibleLaps], () => draw(), { deep: true })
|
||||
|
||||
function toggleLap(idx: number) {
|
||||
if (visibleLaps.value.has(idx)) {
|
||||
visibleLaps.value.delete(idx)
|
||||
} else {
|
||||
visibleLaps.value.add(idx)
|
||||
}
|
||||
visibleLaps.value = new Set(visibleLaps.value)
|
||||
}
|
||||
|
||||
function draw() {
|
||||
if (!canvas.value || !analysis.value) return
|
||||
const ctx = canvas.value.getContext('2d')
|
||||
if (!ctx) return
|
||||
|
||||
const laps = analysis.value.laps
|
||||
const width = canvas.value.width
|
||||
const height = canvas.value.height
|
||||
const padding = 50
|
||||
const drawWidth = width - padding * 2
|
||||
const drawHeight = height - padding * 2
|
||||
|
||||
ctx.fillStyle = '#0f1117'
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.save()
|
||||
applyTransform(ctx)
|
||||
|
||||
ctx.strokeStyle = '#1a1d27'
|
||||
ctx.lineWidth = 1
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
const x = padding + (drawWidth / 10) * i
|
||||
const y = padding + (drawHeight / 10) * i
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x, padding)
|
||||
ctx.lineTo(x, height - padding)
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(padding, y)
|
||||
ctx.lineTo(width - padding, y)
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
const visiblePoints = laps
|
||||
.filter((_, i) => visibleLaps.value.has(i))
|
||||
.flatMap((lap) => lap.points)
|
||||
if (visiblePoints.length === 0) return
|
||||
|
||||
const minX = visiblePoints.reduce((m, p) => p.x < m ? p.x : m, Infinity)
|
||||
const maxX = visiblePoints.reduce((m, p) => p.x > m ? p.x : m, -Infinity)
|
||||
const minZ = visiblePoints.reduce((m, p) => p.z < m ? p.z : m, Infinity)
|
||||
const maxZ = visiblePoints.reduce((m, p) => p.z > m ? p.z : m, -Infinity)
|
||||
|
||||
const rangeX = maxX - minX || 1
|
||||
const rangeZ = maxZ - minZ || 1
|
||||
const scale = Math.min(drawWidth / rangeX, drawHeight / rangeZ)
|
||||
|
||||
const offsetX = padding + (drawWidth - rangeX * scale) / 2
|
||||
const offsetY = padding + (drawHeight - rangeZ * scale) / 2
|
||||
|
||||
function toCanvas(x: number, z: number): [number, number] {
|
||||
return [
|
||||
offsetX + (x - minX) * scale,
|
||||
offsetY + (maxZ - z) * scale,
|
||||
]
|
||||
}
|
||||
|
||||
const allSpeeds = visiblePoints.map((p) => p.speed_kmh)
|
||||
const minSpeed = Math.min(...allSpeeds)
|
||||
const maxSpeed = Math.max(...allSpeeds)
|
||||
|
||||
function speedColor(speed: number): string {
|
||||
const t = maxSpeed > minSpeed ? (speed - minSpeed) / (maxSpeed - minSpeed) : 0.5
|
||||
if (t < 0.5) {
|
||||
const r = Math.round(79 + (251 - 79) * (t * 2))
|
||||
const g = Math.round(143 + (191 - 143) * (t * 2))
|
||||
const b = Math.round(247 + (36 - 247) * (t * 2))
|
||||
return `rgb(${r}, ${g}, ${b})`
|
||||
} else {
|
||||
const t2 = (t - 0.5) * 2
|
||||
const r = Math.round(251 + (248 - 251) * t2)
|
||||
const g = Math.round(191 + (113 - 191) * t2)
|
||||
const b = Math.round(36 + (113 - 36) * t2)
|
||||
return `rgb(${r}, ${g}, ${b})`
|
||||
}
|
||||
}
|
||||
|
||||
laps.forEach((lap, lapIdx) => {
|
||||
if (!visibleLaps.value.has(lapIdx)) return
|
||||
const pts = lap.points
|
||||
if (pts.length < 2) return
|
||||
|
||||
if (colorMode.value === 'speed') {
|
||||
ctx.lineWidth = 2.5
|
||||
for (let i = 1; i < pts.length; i++) {
|
||||
const [sx, sy] = toCanvas(pts[i - 1].x, pts[i - 1].z)
|
||||
const [ex, ey] = toCanvas(pts[i].x, pts[i].z)
|
||||
ctx.strokeStyle = speedColor((pts[i].speed_kmh + pts[i - 1].speed_kmh) / 2)
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(sx, sy)
|
||||
ctx.lineTo(ex, ey)
|
||||
ctx.stroke()
|
||||
}
|
||||
} else {
|
||||
ctx.strokeStyle = lapColors[lapIdx % lapColors.length]
|
||||
ctx.lineWidth = 2.5
|
||||
ctx.globalAlpha = 0.85
|
||||
ctx.beginPath()
|
||||
const [sx, sy] = toCanvas(pts[0].x, pts[0].z)
|
||||
ctx.moveTo(sx, sy)
|
||||
for (let i = 1; i < pts.length; i++) {
|
||||
const [px, py] = toCanvas(pts[i].x, pts[i].z)
|
||||
ctx.lineTo(px, py)
|
||||
}
|
||||
ctx.stroke()
|
||||
ctx.globalAlpha = 1
|
||||
}
|
||||
|
||||
const [startX, startY] = toCanvas(pts[0].x, pts[0].z)
|
||||
ctx.fillStyle = lapColors[lapIdx % lapColors.length]
|
||||
ctx.beginPath()
|
||||
ctx.arc(startX, startY, 5, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
})
|
||||
|
||||
ctx.restore()
|
||||
|
||||
ctx.fillStyle = '#8b8fa3'
|
||||
ctx.font = '11px monospace'
|
||||
if (colorMode.value === 'speed') {
|
||||
const legendX = width - 160
|
||||
const legendY = 60
|
||||
const barWidth = 120
|
||||
const barHeight = 10
|
||||
const grad = ctx.createLinearGradient(legendX, 0, legendX + barWidth, 0)
|
||||
grad.addColorStop(0, speedColor(minSpeed))
|
||||
grad.addColorStop(0.5, speedColor((minSpeed + maxSpeed) / 2))
|
||||
grad.addColorStop(1, speedColor(maxSpeed))
|
||||
ctx.fillStyle = grad
|
||||
ctx.fillRect(legendX, legendY, barWidth, barHeight)
|
||||
ctx.strokeStyle = '#3a3e4f'
|
||||
ctx.strokeRect(legendX, legendY, barWidth, barHeight)
|
||||
ctx.fillStyle = '#8b8fa3'
|
||||
ctx.fillText(`${Math.round(minSpeed)} km/h`, legendX, legendY + 25)
|
||||
ctx.fillText(`${Math.round(maxSpeed)} km/h`, legendX + barWidth - 50, legendY + 25)
|
||||
}
|
||||
}
|
||||
|
||||
function formatLapTime(ms: number): string {
|
||||
if (ms <= 0) return '--'
|
||||
const totalSec = ms / 1000
|
||||
const min = Math.floor(totalSec / 60)
|
||||
const sec = totalSec - min * 60
|
||||
return `${min}:${sec.toFixed(3).padStart(6, '0')}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="racing-line-view">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<button class="btn btn-secondary btn-sm" @click="router.back()">← Back</button>
|
||||
<h2 class="page-title">Racing Line Analysis</h2>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="card text-secondary">Loading analysis...</div>
|
||||
<div v-if="error" class="card text-error">{{ error }}</div>
|
||||
|
||||
<template v-if="analysis">
|
||||
<!-- Summary Stats -->
|
||||
<div class="stat-grid mb-3">
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Laps Analyzed</span>
|
||||
<span class="stat-value mono">{{ analysis.total_laps }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Frames Analyzed</span>
|
||||
<span class="stat-value mono">{{ analysis.total_frames_analyzed.toLocaleString() }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Position Mode</span>
|
||||
<span class="stat-value mono" style="font-size: 1rem">{{ analysis.position_mode }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Canvas Track Map -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Racing Line</h2>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
class="btn btn-sm"
|
||||
:class="colorMode === 'speed' ? 'btn-primary' : 'btn-secondary'"
|
||||
@click="colorMode = 'speed'"
|
||||
>Speed Heatmap</button>
|
||||
<button
|
||||
class="btn btn-sm"
|
||||
:class="colorMode === 'lap' ? 'btn-primary' : 'btn-secondary'"
|
||||
@click="colorMode = 'lap'"
|
||||
>Per Lap</button>
|
||||
<button class="btn btn-sm btn-secondary" @click="resetZoom">
|
||||
Reset View ({{ zoom.toFixed(1) }}x)
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="canvas-container">
|
||||
<canvas
|
||||
ref="canvas"
|
||||
style="cursor: grab"
|
||||
@wheel="onWheel"
|
||||
@mousedown="onMouseDown"
|
||||
@mousemove="onMouseMove"
|
||||
@mouseup="onMouseUp"
|
||||
@mouseleave="onMouseUp"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Lap List -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Laps</h2>
|
||||
</div>
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Lap</th>
|
||||
<th>Run Label</th>
|
||||
<th>Lap Time</th>
|
||||
<th>Length</th>
|
||||
<th>Avg Speed</th>
|
||||
<th>Max Speed</th>
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(lap, idx) in analysis.laps" :key="idx">
|
||||
<td>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="visibleLaps.has(idx)"
|
||||
@change="toggleLap(idx)"
|
||||
>
|
||||
</td>
|
||||
<td class="mono">
|
||||
<span
|
||||
v-if="colorMode === 'lap'"
|
||||
class="color-dot"
|
||||
:style="{ background: lapColors[idx % lapColors.length] }"
|
||||
></span>
|
||||
{{ lap.lap_index + 1 }}
|
||||
</td>
|
||||
<td>{{ lap.label || '—' }}</td>
|
||||
<td class="mono">{{ formatLapTime(lap.lap_time_ms) }}</td>
|
||||
<td class="mono">{{ lap.length_m > 0 ? Math.round(lap.length_m) + ' m' : '—' }}</td>
|
||||
<td class="mono">{{ lap.avg_speed_kmh > 0 ? Math.round(lap.avg_speed_kmh) + ' km/h' : '—' }}</td>
|
||||
<td class="mono">{{ lap.max_speed_kmh > 0 ? Math.round(lap.max_speed_kmh) + ' km/h' : '—' }}</td>
|
||||
<td class="mono">{{ lap.point_count }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
padding: 0.75rem;
|
||||
background: var(--color-background);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.7rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.canvas-container {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.data-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.data-table th {
|
||||
text-align: left;
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--color-text-muted);
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.data-table td {
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.data-table tr:hover {
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
}
|
||||
|
||||
.color-dot {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
margin-right: 6px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,25 +1,9 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useSessionsStore } from '@/stores/sessions'
|
||||
import type { ShiftPointAnalysis, CarGripAnalysis, TrackMapAnalysis, RacingLineAnalysis } from '@/types'
|
||||
import { isShiftPointAnalysis, isCarGripAnalysis, isTrackMapAnalysis, isRacingLineAnalysis } from '@/utils/analysis'
|
||||
import * as api from '@/api/client'
|
||||
import type { ShiftPointAnalysis, TrackMapAnalysis } from '@/types'
|
||||
import { isShiftPointAnalysis, isTrackMapAnalysis } from '@/utils/analysis'
|
||||
|
||||
const props = defineProps<{
|
||||
id: string
|
||||
|
|
@ -32,18 +16,12 @@ const store = useSessionsStore()
|
|||
const showStartRun = ref(false)
|
||||
const runFeedName = ref('ksudp')
|
||||
const runLabel = ref('')
|
||||
const runMergeEnabled = ref(false)
|
||||
const runMergeFeeds = ref<string[]>([])
|
||||
|
||||
const sessionId = computed(() => props.id ?? (route.params.id as string))
|
||||
const session = computed(() => store.currentSession)
|
||||
|
||||
const feedOptions = ['ksudp', 'telemetry_tool', 'pcars']
|
||||
|
||||
const mergeFeedOptions = computed(() => {
|
||||
return feedOptions.filter((f) => f !== runFeedName.value)
|
||||
})
|
||||
|
||||
const hasActiveRun = computed(() => {
|
||||
return session.value?.runs.some((r) => r.status === 'recording') ?? false
|
||||
})
|
||||
|
|
@ -71,22 +49,6 @@ const trackAnalysis = computed((): TrackMapAnalysis | null => {
|
|||
return null
|
||||
})
|
||||
|
||||
const gripAnalysis = computed((): CarGripAnalysis | null => {
|
||||
if (!analysisData.value) return null
|
||||
if (isCarGripAnalysis(analysisData.value)) {
|
||||
return analysisData.value
|
||||
}
|
||||
return null
|
||||
})
|
||||
|
||||
const racingLineAnalysis = computed((): RacingLineAnalysis | null => {
|
||||
if (!analysisData.value) return null
|
||||
if (isRacingLineAnalysis(analysisData.value)) {
|
||||
return analysisData.value
|
||||
}
|
||||
return null
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await store.fetchSession(sessionId.value)
|
||||
})
|
||||
|
|
@ -99,13 +61,10 @@ async function handleStartRun() {
|
|||
const run = await store.startRun(sessionId.value, {
|
||||
feed_name: runFeedName.value,
|
||||
label: runLabel.value || undefined,
|
||||
merge_feeds: runMergeEnabled.value && runMergeFeeds.value.length > 0 ? runMergeFeeds.value : undefined,
|
||||
})
|
||||
if (run) {
|
||||
showStartRun.value = false
|
||||
runLabel.value = ''
|
||||
runMergeEnabled.value = false
|
||||
runMergeFeeds.value = []
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,83 +91,17 @@ function viewAnalysis() {
|
|||
if (!session.value) return
|
||||
if (session.value.use_case === 'shift_points') {
|
||||
router.push({ name: 'shift-points', params: { id: session.value.id } })
|
||||
} else if (session.value.use_case === 'car_grip') {
|
||||
router.push({ name: 'grip-analysis', params: { id: session.value.id } })
|
||||
} else if (session.value.use_case === 'racing_line') {
|
||||
router.push({ name: 'racing-line', params: { id: session.value.id } })
|
||||
} else if (session.value.use_case === 'track_map') {
|
||||
router.push({ name: 'track-map', params: { id: session.value.id } })
|
||||
}
|
||||
}
|
||||
|
||||
function formatLapTimeShort(ms: number): string {
|
||||
if (!ms || ms <= 0 || !isFinite(ms)) return '--'
|
||||
const totalSec = ms / 1000
|
||||
const min = Math.floor(totalSec / 60)
|
||||
const sec = totalSec - min * 60
|
||||
return `${min}:${sec.toFixed(3).padStart(6, '0')}`
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
if (confirm('Delete this session?')) {
|
||||
await store.deleteSession(sessionId.value)
|
||||
router.push('/sessions')
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteRun(runId: string, runLabel: string) {
|
||||
if (confirm(`Delete run "${runLabel || 'Untitled Run'}"?`)) {
|
||||
await store.deleteRun(sessionId.value, runId)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReopen() {
|
||||
await store.reopenSession(sessionId.value)
|
||||
}
|
||||
|
||||
const buildingTrack = ref(false)
|
||||
const buildTrackError = ref<string | null>(null)
|
||||
const buildTrackSuccess = ref(false)
|
||||
const buildGame = ref('assetto_corsa')
|
||||
const buildTrackName = ref('')
|
||||
|
||||
const gameOptions = [
|
||||
{ value: 'assetto_corsa', label: 'Assetto Corsa' },
|
||||
{ value: 'assetto_corsa_competizione', label: 'Assetto Corsa Competizione' },
|
||||
{ value: 'project_cars_1', label: 'Project CARS 1' },
|
||||
{ value: 'project_cars_2', label: 'Project CARS 2' },
|
||||
]
|
||||
|
||||
const isTrackMapping = computed(() => session.value?.use_case === 'track_mapping')
|
||||
|
||||
const hasLeftRun = computed(() =>
|
||||
session.value?.runs.some((r) => r.label?.toLowerCase() === 'left' && r.status === 'stopped') ?? false,
|
||||
)
|
||||
|
||||
const hasRightRun = computed(() =>
|
||||
session.value?.runs.some((r) => r.label?.toLowerCase() === 'right' && r.status === 'stopped') ?? false,
|
||||
)
|
||||
|
||||
const canBuildTrack = computed(() => isCompleted.value && hasLeftRun.value && hasRightRun.value)
|
||||
|
||||
async function handleBuildTrack() {
|
||||
buildingTrack.value = true
|
||||
buildTrackError.value = null
|
||||
buildTrackSuccess.value = false
|
||||
try {
|
||||
await store.reAnalyze(sessionId.value)
|
||||
await api.buildTrackModel({
|
||||
session_id: sessionId.value,
|
||||
game: buildGame.value,
|
||||
track_name: buildTrackName.value || undefined,
|
||||
})
|
||||
buildTrackSuccess.value = true
|
||||
} catch (e: unknown) {
|
||||
const axiosErr = e as { response?: { data?: { error?: string } } }
|
||||
buildTrackError.value = axiosErr.response?.data?.error
|
||||
?? (e instanceof Error ? e.message : 'Failed to build track model')
|
||||
} finally {
|
||||
buildingTrack.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -240,14 +133,6 @@ async function handleBuildTrack() {
|
|||
<span class="info-label">Use Case</span>
|
||||
<span>{{ session.use_case.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase()) }}</span>
|
||||
</div>
|
||||
<div v-if="session.car_name" class="info-item">
|
||||
<span class="info-label">Car</span>
|
||||
<span>{{ session.car_name }}</span>
|
||||
</div>
|
||||
<div v-if="session.track_name" class="info-item">
|
||||
<span class="info-label">Track</span>
|
||||
<span>{{ session.track_name }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Created</span>
|
||||
<span>{{ formatTime(session.created_at) }}</span>
|
||||
|
|
@ -296,18 +181,6 @@ async function handleBuildTrack() {
|
|||
/>
|
||||
<button class="btn btn-primary btn-sm" @click="handleStartRun">Start</button>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 mt-2">
|
||||
<label class="merge-toggle">
|
||||
<input type="checkbox" v-model="runMergeEnabled" />
|
||||
<span>Merge with additional feeds</span>
|
||||
</label>
|
||||
</div>
|
||||
<div v-if="runMergeEnabled" class="flex gap-2 items-center mt-1">
|
||||
<label v-for="f in mergeFeedOptions" :key="f" class="merge-feed-option">
|
||||
<input type="checkbox" :value="f" v-model="runMergeFeeds" />
|
||||
<span>{{ f }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="session.runs.length === 0" class="text-secondary text-muted">
|
||||
|
|
@ -335,12 +208,6 @@ async function handleBuildTrack() {
|
|||
>
|
||||
■ Stop
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-danger btn-sm"
|
||||
@click="handleDeleteRun(run.id, run.label || '')"
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -405,60 +272,13 @@ async function handleBuildTrack() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick stats for car grip -->
|
||||
<div v-if="gripAnalysis" class="analysis-stats grid grid-4 mb-2">
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Lateral G</span>
|
||||
<span class="stat-value mono">{{ gripAnalysis.summary.max_lateral_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Accel G</span>
|
||||
<span class="stat-value mono">{{ gripAnalysis.summary.max_accel_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Brake G</span>
|
||||
<span class="stat-value mono">{{ gripAnalysis.summary.max_brake_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Combined G</span>
|
||||
<span class="stat-value mono">{{ gripAnalysis.summary.max_combined_g.toFixed(2) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="racingLineAnalysis" class="grid-4 mb-2">
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Laps</span>
|
||||
<span class="stat-value mono">{{ racingLineAnalysis.total_laps }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Best Lap</span>
|
||||
<span class="stat-value mono" style="font-size: 1.1rem">
|
||||
{{ racingLineAnalysis.laps.length > 0
|
||||
? formatLapTimeShort(Math.min(...racingLineAnalysis.laps.filter(l => l.lap_time_ms > 0).map(l => l.lap_time_ms)))
|
||||
: '--' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Max Speed</span>
|
||||
<span class="stat-value mono">{{ Math.round(Math.max(...racingLineAnalysis.laps.map(l => l.max_speed_kmh), 0)) }}</span>
|
||||
<span class="stat-sub">km/h</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-label">Frames</span>
|
||||
<span class="stat-value mono">{{ racingLineAnalysis.total_frames_analyzed.toLocaleString() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button v-if="session.use_case === 'shift_points' || session.use_case === 'car_grip' || session.use_case === 'racing_line'" class="btn btn-primary" @click="viewAnalysis">
|
||||
<button class="btn btn-primary" @click="viewAnalysis">
|
||||
📊 View Full Analysis
|
||||
</button>
|
||||
<button class="btn btn-secondary" @click="handleReAnalyze">
|
||||
🔄 Re-analyze
|
||||
</button>
|
||||
<button class="btn btn-secondary" @click="handleReopen">
|
||||
↩ Reopen Session
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -469,54 +289,6 @@ async function handleBuildTrack() {
|
|||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Track Mapping: Build Track Model -->
|
||||
<section v-if="isTrackMapping && isCompleted" class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Build Track Model</h2>
|
||||
</div>
|
||||
<div v-if="canBuildTrack">
|
||||
<p class="text-secondary mb-2" style="font-size: 0.85rem">
|
||||
Both boundary runs (left + right) are recorded. Name the track and build the persistent track model to enable corner analysis and sector timing.
|
||||
</p>
|
||||
<div class="flex gap-2 mb-2 flex-wrap">
|
||||
<select v-model="buildGame" class="form-input" style="width: auto">
|
||||
<option v-for="opt in gameOptions" :key="opt.value" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
<input
|
||||
v-model="buildTrackName"
|
||||
class="form-input"
|
||||
style="flex: 1; min-width: 180px"
|
||||
placeholder="Track name (e.g. ks_nurburgring)"
|
||||
:disabled="buildingTrack"
|
||||
>
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
:disabled="buildingTrack || !buildTrackName.trim()"
|
||||
@click="handleBuildTrack"
|
||||
>
|
||||
{{ buildingTrack ? 'Building...' : 'Build Track Model' }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-if="buildTrackSuccess" class="text-success mt-2" style="font-size: 0.85rem">
|
||||
Track model built successfully. <RouterLink to="/tracks">View in Tracks →</RouterLink>
|
||||
</div>
|
||||
<div v-if="buildTrackError" class="text-error mt-2" style="font-size: 0.85rem">
|
||||
{{ buildTrackError }}
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="text-secondary" style="font-size: 0.85rem">
|
||||
<p>Requires 2 completed runs labeled "left" and "right".</p>
|
||||
<div class="flex gap-2 mt-1">
|
||||
<span :class="hasLeftRun ? 'text-success' : 'text-muted'">
|
||||
{{ hasLeftRun ? '✓' : '○' }} Left boundary
|
||||
</span>
|
||||
<span :class="hasRightRun ? 'text-success' : 'text-muted'">
|
||||
{{ hasRightRun ? '✓' : '○' }} Right boundary
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -613,25 +385,4 @@ async function handleBuildTrack() {
|
|||
flex: 1;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.merge-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.85rem;
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.merge-feed-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-secondary);
|
||||
padding: 0.2rem 0.5rem;
|
||||
background: var(--color-background);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
|
|
@ -27,7 +12,7 @@ const newLabel = ref('')
|
|||
|
||||
const useCaseOptions: { value: UseCase; label: string }[] = [
|
||||
{ value: 'shift_points', label: 'Shift Points' },
|
||||
{ value: 'track_mapping', label: 'Track Mapping' },
|
||||
{ value: 'track_map', label: 'Track Map' },
|
||||
{ value: 'racing_line', label: 'Racing Line' },
|
||||
{ value: 'braking_analysis', label: 'Braking Analysis' },
|
||||
{ value: 'lap_times', label: 'Lap Times' },
|
||||
|
|
|
|||
|
|
@ -1,18 +1,3 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
|
@ -58,41 +43,10 @@ onMounted(async () => {
|
|||
}
|
||||
})
|
||||
|
||||
const colors = ['#4f8ff7', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#60a5fa', '#f472b6']
|
||||
|
||||
const rpmVsAccelChartData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
const curves = analysis.value.gear_curves.filter((g) => g.gear >= 2)
|
||||
return {
|
||||
datasets: curves.map((curve, i) => ({
|
||||
label: `${curve.gear_display} (${curve.run_label})`,
|
||||
data: curve.data_points.map((p) => ({ x: p.rpm, y: p.acceleration_g })),
|
||||
borderColor: colors[i % colors.length],
|
||||
backgroundColor: colors[i % colors.length] + '20',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
tension: 0.3,
|
||||
pointRadius: 0,
|
||||
borderWidth: 2,
|
||||
})),
|
||||
}
|
||||
})
|
||||
|
||||
const rpmVsAccelChartOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { labels: { color: '#8b8fa3' } },
|
||||
title: { display: true, text: 'RPM vs. Force', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'RPM', color: '#8b8fa3' } },
|
||||
y: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'Force (g)', color: '#8b8fa3' } },
|
||||
},
|
||||
}
|
||||
|
||||
const gearCurvesChartData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
const curves = analysis.value.gear_curves.filter((g) => g.gear >= 2)
|
||||
const colors = ['#4f8ff7', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#60a5fa', '#f472b6']
|
||||
return {
|
||||
datasets: curves.map((curve, i) => ({
|
||||
label: `${curve.gear_display} (${curve.run_label})`,
|
||||
|
|
@ -112,41 +66,11 @@ const gearCurvesOptions = {
|
|||
responsive: true,
|
||||
plugins: {
|
||||
legend: { labels: { color: '#8b8fa3' } },
|
||||
title: { display: true, text: 'Speed vs. Force', color: '#e2e4ea' },
|
||||
title: { display: true, text: 'Gear Acceleration Curves', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'Speed (km/h)', color: '#8b8fa3' } },
|
||||
y: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'Force (g)', color: '#8b8fa3' } },
|
||||
},
|
||||
}
|
||||
|
||||
const speedVsRpmChartData = computed(() => {
|
||||
if (!analysis.value) return null
|
||||
const curves = analysis.value.gear_curves.filter((g) => g.gear >= 2)
|
||||
return {
|
||||
datasets: curves.map((curve, i) => ({
|
||||
label: `${curve.gear_display} (${curve.run_label})`,
|
||||
data: curve.data_points.map((p) => ({ x: p.speed_kmh, y: p.rpm })),
|
||||
borderColor: colors[i % colors.length],
|
||||
backgroundColor: colors[i % colors.length] + '20',
|
||||
showLine: true,
|
||||
fill: false,
|
||||
tension: 0.3,
|
||||
pointRadius: 0,
|
||||
borderWidth: 2,
|
||||
})),
|
||||
}
|
||||
})
|
||||
|
||||
const speedVsRpmChartOptions = {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { labels: { color: '#8b8fa3' } },
|
||||
title: { display: true, text: 'Speed vs. RPM (Gear Ratios)', color: '#e2e4ea' },
|
||||
},
|
||||
scales: {
|
||||
x: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'Speed (km/h)', color: '#8b8fa3' } },
|
||||
y: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'RPM', color: '#8b8fa3' } },
|
||||
y: { ticks: { color: '#8b8fa3' }, grid: { color: '#2a2e3f' }, title: { display: true, text: 'Acceleration (g)', color: '#8b8fa3' } },
|
||||
},
|
||||
}
|
||||
|
||||
|
|
@ -233,21 +157,11 @@ const crossoverChartOptions = {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RPM vs. Force Chart -->
|
||||
<div v-if="rpmVsAccelChartData" class="card mb-3">
|
||||
<Scatter :data="rpmVsAccelChartData" :options="rpmVsAccelChartOptions" />
|
||||
</div>
|
||||
|
||||
<!-- Speed vs. Force Chart -->
|
||||
<!-- Gear Acceleration Curves Chart -->
|
||||
<div v-if="gearCurvesChartData" class="card mb-3">
|
||||
<Scatter :data="gearCurvesChartData" :options="gearCurvesOptions" />
|
||||
</div>
|
||||
|
||||
<!-- Speed vs. RPM Chart -->
|
||||
<div v-if="speedVsRpmChartData" class="card mb-3">
|
||||
<Scatter :data="speedVsRpmChartData" :options="speedVsRpmChartOptions" />
|
||||
</div>
|
||||
|
||||
<!-- Crossover Points Chart -->
|
||||
<div v-if="crossoverChartData" class="card mb-3">
|
||||
<Bar :data="crossoverChartData" :options="crossoverChartOptions" />
|
||||
|
|
|
|||
|
|
@ -1,579 +0,0 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, computed, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useTracksStore } from '@/stores/tracks'
|
||||
import { useCanvasZoom } from '@/composables/useCanvasZoom'
|
||||
import type { Corner } from '@/types'
|
||||
|
||||
let resizeRafId: number | null = null
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const store = useTracksStore()
|
||||
|
||||
const game = computed(() => route.params.game as string)
|
||||
const trackName = computed(() => route.params.trackName as string)
|
||||
const canvas = ref<HTMLCanvasElement | null>(null)
|
||||
|
||||
const showCurvature = ref(true)
|
||||
const showCorners = ref(true)
|
||||
const showSectors = ref(true)
|
||||
|
||||
const { zoom, onWheel, onMouseDown, onMouseMove, onMouseUp, reset: resetZoom, applyTransform } = useCanvasZoom(canvas, drawTrack)
|
||||
|
||||
onMounted(async () => {
|
||||
await store.fetchTrack(game.value, trackName.value)
|
||||
})
|
||||
|
||||
watch([() => store.currentTrack, canvas], () => {
|
||||
if (store.currentTrack && canvas.value) {
|
||||
drawTrack()
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
function drawTrack() {
|
||||
if (!canvas.value || !store.currentTrack) return
|
||||
const model = store.currentTrack
|
||||
const ctx = canvas.value.getContext('2d')
|
||||
if (!ctx) return
|
||||
|
||||
const width = canvas.value.width
|
||||
const height = canvas.value.height
|
||||
const padding = 50
|
||||
const drawWidth = width - padding * 2
|
||||
const drawHeight = height - padding * 2
|
||||
|
||||
ctx.fillStyle = '#0f1117'
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.save()
|
||||
applyTransform(ctx)
|
||||
|
||||
ctx.strokeStyle = '#1a1d27'
|
||||
ctx.lineWidth = 1
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
const x = padding + (drawWidth / 10) * i
|
||||
const y = padding + (drawHeight / 10) * i
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x, padding)
|
||||
ctx.lineTo(x, height - padding)
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(padding, y)
|
||||
ctx.lineTo(width - padding, y)
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
const allPoints = [...model.left_boundary, ...model.right_boundary, ...model.center_line]
|
||||
if (allPoints.length === 0) return
|
||||
|
||||
const minX = allPoints.reduce((m, p) => p[0] < m ? p[0] : m, Infinity)
|
||||
const maxX = allPoints.reduce((m, p) => p[0] > m ? p[0] : m, -Infinity)
|
||||
const minY = allPoints.reduce((m, p) => p[1] < m ? p[1] : m, Infinity)
|
||||
const maxY = allPoints.reduce((m, p) => p[1] > m ? p[1] : m, -Infinity)
|
||||
|
||||
const rangeX = maxX - minX || 1
|
||||
const rangeY = maxY - minY || 1
|
||||
const scale = Math.min(drawWidth / rangeX, drawHeight / rangeY)
|
||||
|
||||
const offsetX = padding + (drawWidth - rangeX * scale) / 2
|
||||
const offsetY = padding + (drawHeight - rangeY * scale) / 2
|
||||
|
||||
function toCanvas(pt: number[]): [number, number] {
|
||||
return [
|
||||
offsetX + (pt[0] - minX) * scale,
|
||||
offsetY + (maxY - pt[1]) * scale,
|
||||
]
|
||||
}
|
||||
|
||||
function drawPolyline(c: CanvasRenderingContext2D, points: number[][], color: string, lineWidth: number, alpha = 1) {
|
||||
if (points.length < 2) return
|
||||
c.strokeStyle = color
|
||||
c.lineWidth = lineWidth
|
||||
c.globalAlpha = alpha
|
||||
c.beginPath()
|
||||
const [sx, sy] = toCanvas(points[0])
|
||||
c.moveTo(sx, sy)
|
||||
for (let i = 1; i < points.length; i++) {
|
||||
const [px, py] = toCanvas(points[i])
|
||||
c.lineTo(px, py)
|
||||
}
|
||||
c.stroke()
|
||||
c.globalAlpha = 1
|
||||
}
|
||||
|
||||
if (showSectors.value && model.sectors.length > 0) {
|
||||
const totalPoints = model.center_line.length
|
||||
for (const sector of model.sectors) {
|
||||
const startIdx = Math.floor(sector.start_s * totalPoints)
|
||||
const sectorPoints = model.center_line.slice(
|
||||
startIdx,
|
||||
Math.floor(sector.end_s * totalPoints) + 1,
|
||||
)
|
||||
if (sectorPoints.length < 2) continue
|
||||
const sectorColors = ['rgba(79, 143, 247, 0.12)', 'rgba(52, 211, 153, 0.12)', 'rgba(251, 191, 36, 0.12)']
|
||||
ctx.fillStyle = sectorColors[sector.index % sectorColors.length]
|
||||
ctx.beginPath()
|
||||
const [sx, sy] = toCanvas(sectorPoints[0])
|
||||
ctx.moveTo(sx, sy)
|
||||
for (let i = 1; i < sectorPoints.length; i++) {
|
||||
const [px, py] = toCanvas(sectorPoints[i])
|
||||
ctx.lineTo(px, py)
|
||||
}
|
||||
for (let i = sectorPoints.length - 1; i >= 0; i--) {
|
||||
const [px, py] = toCanvas(sectorPoints[i])
|
||||
ctx.lineTo(px, py)
|
||||
}
|
||||
ctx.closePath()
|
||||
ctx.fill()
|
||||
}
|
||||
}
|
||||
|
||||
drawPolyline(ctx, model.left_boundary, '#f87171', 2, 0.5)
|
||||
drawPolyline(ctx, model.right_boundary, '#60a5fa', 2, 0.5)
|
||||
|
||||
if (showCurvature.value && model.curvature.length > 0) {
|
||||
const centerLine = model.center_line
|
||||
const maxCurv = model.curvature.reduce((m, k) => { const a = Math.abs(k); return a > m ? a : m; }, 0.001)
|
||||
const steps = 16
|
||||
ctx.lineWidth = 4
|
||||
for (let s = 0; s < steps; s++) {
|
||||
const lo = s / steps
|
||||
const hi = (s + 1) / steps
|
||||
const mid = (lo + hi) / 2
|
||||
const r = Math.round(mid * 200)
|
||||
const g = Math.round((1 - mid) * 200 + 55)
|
||||
const b = Math.round(100)
|
||||
ctx.strokeStyle = `rgb(${r}, ${g}, ${b})`
|
||||
ctx.beginPath()
|
||||
let moved = false
|
||||
for (let i = 0; i < centerLine.length - 1; i++) {
|
||||
const normalized = Math.min(Math.abs(model.curvature[i]) / maxCurv, 1)
|
||||
if (normalized >= lo && normalized < hi) {
|
||||
const [x1, y1] = toCanvas(centerLine[i])
|
||||
if (!moved) { ctx.moveTo(x1, y1); moved = true }
|
||||
const [x2, y2] = toCanvas(centerLine[i + 1])
|
||||
ctx.lineTo(x2, y2)
|
||||
} else {
|
||||
moved = false
|
||||
}
|
||||
}
|
||||
ctx.stroke()
|
||||
}
|
||||
} else {
|
||||
drawPolyline(ctx, model.center_line, '#34d399', 3, 0.9)
|
||||
}
|
||||
|
||||
if (showCorners.value) {
|
||||
for (const corner of model.corners) {
|
||||
const totalPoints = model.center_line.length
|
||||
const apexIdx = Math.min(
|
||||
Math.floor(corner.apex_s * totalPoints),
|
||||
totalPoints - 1,
|
||||
)
|
||||
const [cx, cy] = toCanvas(model.center_line[apexIdx])
|
||||
|
||||
ctx.fillStyle = 'rgba(251, 191, 36, 0.3)'
|
||||
ctx.beginPath()
|
||||
ctx.arc(cx, cy, 12, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
|
||||
ctx.strokeStyle = '#fbbf24'
|
||||
ctx.lineWidth = 1.5
|
||||
ctx.beginPath()
|
||||
ctx.arc(cx, cy, 12, 0, Math.PI * 2)
|
||||
ctx.stroke()
|
||||
|
||||
ctx.fillStyle = '#fbbf24'
|
||||
ctx.font = 'bold 10px sans-serif'
|
||||
ctx.textAlign = 'center'
|
||||
ctx.fillText(`${corner.number}`, cx, cy + 3.5)
|
||||
}
|
||||
}
|
||||
|
||||
if (model.center_line.length > 0) {
|
||||
const [startX, startY] = toCanvas(model.center_line[0])
|
||||
ctx.fillStyle = '#34d399'
|
||||
ctx.beginPath()
|
||||
ctx.arc(startX, startY, 6, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
ctx.strokeStyle = '#fff'
|
||||
ctx.lineWidth = 1.5
|
||||
ctx.beginPath()
|
||||
ctx.arc(startX, startY, 6, 0, Math.PI * 2)
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
ctx.restore()
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
if (canvas.value) {
|
||||
const container = canvas.value.parentElement
|
||||
if (container) {
|
||||
canvas.value.width = container.clientWidth
|
||||
canvas.value.height = Math.max(500, container.clientWidth * 0.6)
|
||||
drawTrack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const debouncedResize = () => {
|
||||
if (resizeRafId !== null) cancelAnimationFrame(resizeRafId)
|
||||
resizeRafId = requestAnimationFrame(() => {
|
||||
handleResize()
|
||||
resizeRafId = null
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleResize()
|
||||
window.addEventListener('resize', debouncedResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (resizeRafId !== null) cancelAnimationFrame(resizeRafId)
|
||||
window.removeEventListener('resize', debouncedResize)
|
||||
})
|
||||
|
||||
function formatTime(iso: string): string {
|
||||
return new Date(iso).toLocaleString()
|
||||
}
|
||||
|
||||
function gameLabel(g: string): string {
|
||||
const labels: Record<string, string> = {
|
||||
assetto_corsa: 'Assetto Corsa',
|
||||
assetto_corsa_competizione: 'ACC',
|
||||
project_cars_1: 'Project CARS 1',
|
||||
project_cars_2: 'Project CARS 2',
|
||||
}
|
||||
return labels[g] ?? g
|
||||
}
|
||||
|
||||
function curvatureLabel(corner: Corner): string {
|
||||
return corner.curvature_peak.toFixed(4)
|
||||
}
|
||||
|
||||
async function handleDelete() {
|
||||
if (store.currentTrack && confirm(`Delete track model "${store.currentTrack.track_name}"?`)) {
|
||||
await store.deleteTrack(store.currentTrack.game, store.currentTrack.track_name)
|
||||
router.push('/tracks')
|
||||
}
|
||||
}
|
||||
|
||||
watch([showCurvature, showCorners, showSectors], () => {
|
||||
if (store.currentTrack && canvas.value) {
|
||||
drawTrack()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="track-detail">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<button class="btn btn-secondary btn-sm" @click="router.push('/tracks')">← Back</button>
|
||||
<h2 class="page-title">
|
||||
{{ store.currentTrack?.track_name ?? 'Track' }}
|
||||
</h2>
|
||||
<span v-if="store.currentTrack" class="badge badge-primary">{{ gameLabel(store.currentTrack.game) }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="store.error" class="card mb-3 text-error">{{ store.error }}</div>
|
||||
<div v-if="store.loading && !store.currentTrack" class="card text-secondary">Loading track model...</div>
|
||||
|
||||
<template v-if="store.currentTrack">
|
||||
<!-- Stats -->
|
||||
<div class="grid grid-4 mb-3">
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Corners</span>
|
||||
<span class="stat-value mono">{{ store.currentTrack.corners.length }}</span>
|
||||
</div>
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Sectors</span>
|
||||
<span class="stat-value mono">{{ store.currentTrack.sectors.length }}</span>
|
||||
</div>
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Center Line Points</span>
|
||||
<span class="stat-value mono">{{ store.currentTrack.center_line.length.toLocaleString() }}</span>
|
||||
</div>
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Source</span>
|
||||
<span class="stat-value" style="font-size: 1rem; color: var(--color-text-secondary)">
|
||||
{{ store.currentTrack.source.replace(/_/g, ' ') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Track Map Canvas -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Track Map</h2>
|
||||
<div class="flex gap-2 items-center">
|
||||
<label class="toggle-label">
|
||||
<input type="checkbox" v-model="showCurvature" />
|
||||
<span>Curvature</span>
|
||||
</label>
|
||||
<label class="toggle-label">
|
||||
<input type="checkbox" v-model="showCorners" />
|
||||
<span>Corners</span>
|
||||
</label>
|
||||
<label class="toggle-label">
|
||||
<input type="checkbox" v-model="showSectors" />
|
||||
<span>Sectors</span>
|
||||
</label>
|
||||
<button class="btn btn-secondary btn-sm" @click="resetZoom">
|
||||
Reset View ({{ zoom.toFixed(1) }}x)
|
||||
</button>
|
||||
<button class="btn btn-danger btn-sm" @click="handleDelete">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="legend-bar">
|
||||
<span class="legend-item">
|
||||
<span class="legend-dot" style="background: #f87171" />
|
||||
Left boundary
|
||||
</span>
|
||||
<span class="legend-item">
|
||||
<span class="legend-dot" style="background: #60a5fa" />
|
||||
Right boundary
|
||||
</span>
|
||||
<span class="legend-item">
|
||||
<span class="legend-dot" style="background: #34d399" />
|
||||
Start / Center
|
||||
</span>
|
||||
<span class="legend-item">
|
||||
<span class="legend-dot" style="background: #fbbf24" />
|
||||
Corners
|
||||
</span>
|
||||
</div>
|
||||
<div class="canvas-container">
|
||||
<canvas
|
||||
ref="canvas"
|
||||
style="cursor: grab"
|
||||
@wheel="onWheel"
|
||||
@mousedown="onMouseDown"
|
||||
@mousemove="onMouseMove"
|
||||
@mouseup="onMouseUp"
|
||||
@mouseleave="onMouseUp"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Corners Table -->
|
||||
<div v-if="store.currentTrack.corners.length > 0" class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Corners</h2>
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Entry (s)</th>
|
||||
<th>Apex (s)</th>
|
||||
<th>Exit (s)</th>
|
||||
<th>Peak Curvature (1/m)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="corner in store.currentTrack.corners" :key="corner.number">
|
||||
<td class="mono">{{ corner.number }}</td>
|
||||
<td class="mono">{{ corner.entry_s.toFixed(3) }}</td>
|
||||
<td class="mono">{{ corner.apex_s.toFixed(3) }}</td>
|
||||
<td class="mono">{{ corner.exit_s.toFixed(3) }}</td>
|
||||
<td class="mono">{{ curvatureLabel(corner) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sectors Table -->
|
||||
<div v-if="store.currentTrack.sectors.length > 0" class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Sectors</h2>
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Sector</th>
|
||||
<th>Start (s)</th>
|
||||
<th>End (s)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="sector in store.currentTrack.sectors" :key="sector.index">
|
||||
<td class="mono">{{ sector.index + 1 }}</td>
|
||||
<td class="mono">{{ sector.start_s.toFixed(3) }}</td>
|
||||
<td class="mono">{{ sector.end_s.toFixed(3) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Metadata -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Metadata</h2>
|
||||
</div>
|
||||
<div class="info-grid">
|
||||
<div class="info-item">
|
||||
<span class="info-label">Game</span>
|
||||
<span>{{ gameLabel(store.currentTrack.game) }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Track</span>
|
||||
<span>{{ store.currentTrack.track_name }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Created</span>
|
||||
<span>{{ formatTime(store.currentTrack.created_at) }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">Boundary Points</span>
|
||||
<span class="mono">{{ store.currentTrack.left_boundary.length.toLocaleString() }} / {{ store.currentTrack.right_boundary.length.toLocaleString() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.canvas-container {
|
||||
width: 100%;
|
||||
min-height: 500px;
|
||||
border-radius: var(--radius-sm);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legend-bar {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.legend-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.toggle-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
}
|
||||
|
||||
.info-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-bottom: 2px solid var(--color-border);
|
||||
color: var(--color-text-muted);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0.4rem 0.75rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
tr:hover td {
|
||||
background: var(--color-surface-hover);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.grid-4 {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
330
src/views/TrackMapView.vue
Normal file
330
src/views/TrackMapView.vue
Normal file
|
|
@ -0,0 +1,330 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted, computed, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import type { TrackMapAnalysis, TrackPoint } from '@/types'
|
||||
import * as api from '@/api/client'
|
||||
|
||||
const BOUNDARY_COLORS = ['#f87171', '#60a5fa', '#fbbf24', '#34d399', '#a78bfa']
|
||||
let resizeRafId: number | null = null
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const sessionId = computed(() => route.params.id as string)
|
||||
const analysis = ref<TrackMapAnalysis | null>(null)
|
||||
const loading = ref(true)
|
||||
const error = ref<string | null>(null)
|
||||
const canvas = ref<HTMLCanvasElement | null>(null)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const data = await api.getAnalysis(sessionId.value)
|
||||
if (data && 'boundaries' in data) {
|
||||
analysis.value = data as unknown as TrackMapAnalysis
|
||||
} else {
|
||||
error.value = 'Track map analysis not available'
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
error.value = e instanceof Error ? e.message : 'Failed to load analysis'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
|
||||
watch([analysis, canvas], () => {
|
||||
if (analysis.value && canvas.value) {
|
||||
drawTrackMap()
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
function drawTrackMap() {
|
||||
if (!canvas.value || !analysis.value) return
|
||||
|
||||
const ctx = canvas.value.getContext('2d')
|
||||
if (!ctx) return
|
||||
|
||||
const allPoints = analysis.value.boundaries.flatMap((b) => b.points)
|
||||
if (analysis.value.center_line) {
|
||||
allPoints.push(...analysis.value.center_line.points)
|
||||
}
|
||||
|
||||
if (allPoints.length === 0) return
|
||||
|
||||
const minX = allPoints.reduce((m, p) => p.x < m ? p.x : m, Infinity)
|
||||
const maxX = allPoints.reduce((m, p) => p.x > m ? p.x : m, -Infinity)
|
||||
const minY = allPoints.reduce((m, p) => p.y < m ? p.y : m, Infinity)
|
||||
const maxY = allPoints.reduce((m, p) => p.y > m ? p.y : m, -Infinity)
|
||||
|
||||
const width = canvas.value.width
|
||||
const height = canvas.value.height
|
||||
const padding = 40
|
||||
const drawWidth = width - padding * 2
|
||||
const drawHeight = height - padding * 2
|
||||
|
||||
const rangeX = maxX - minX || 1
|
||||
const rangeY = maxY - minY || 1
|
||||
const scale = Math.min(drawWidth / rangeX, drawHeight / rangeY)
|
||||
|
||||
const offsetX = padding + (drawWidth - rangeX * scale) / 2
|
||||
const offsetY = padding + (drawHeight - rangeY * scale) / 2
|
||||
|
||||
function toCanvas(point: TrackPoint): [number, number] {
|
||||
return [
|
||||
offsetX + (point.x - minX) * scale,
|
||||
offsetY + (maxY - point.y) * scale,
|
||||
]
|
||||
}
|
||||
|
||||
ctx.fillStyle = '#0f1117'
|
||||
ctx.fillRect(0, 0, width, height)
|
||||
|
||||
ctx.strokeStyle = '#1a1d27'
|
||||
ctx.lineWidth = 1
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
const x = padding + (drawWidth / 10) * i
|
||||
const y = padding + (drawHeight / 10) * i
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(x, padding)
|
||||
ctx.lineTo(x, height - padding)
|
||||
ctx.stroke()
|
||||
ctx.beginPath()
|
||||
ctx.moveTo(padding, y)
|
||||
ctx.lineTo(width - padding, y)
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
analysis.value.boundaries.forEach((boundary, idx) => {
|
||||
if (boundary.points.length < 2) return
|
||||
const color = BOUNDARY_COLORS[idx % BOUNDARY_COLORS.length]
|
||||
ctx.strokeStyle = color
|
||||
ctx.lineWidth = 2
|
||||
ctx.globalAlpha = 0.7
|
||||
ctx.beginPath()
|
||||
const [sx, sy] = toCanvas(boundary.points[0])
|
||||
ctx.moveTo(sx, sy)
|
||||
for (let i = 1; i < boundary.points.length; i++) {
|
||||
const [px, py] = toCanvas(boundary.points[i])
|
||||
ctx.lineTo(px, py)
|
||||
}
|
||||
ctx.stroke()
|
||||
ctx.globalAlpha = 1
|
||||
|
||||
const labelPoint = boundary.points[Math.floor(boundary.points.length / 2)]
|
||||
const [lx, ly] = toCanvas(labelPoint)
|
||||
ctx.fillStyle = color
|
||||
ctx.font = '12px sans-serif'
|
||||
ctx.fillText(boundary.label, lx + 5, ly - 5)
|
||||
})
|
||||
|
||||
if (analysis.value.center_line && analysis.value.center_line.points.length >= 2) {
|
||||
ctx.strokeStyle = '#34d399'
|
||||
ctx.lineWidth = 3
|
||||
ctx.globalAlpha = 0.9
|
||||
ctx.beginPath()
|
||||
const [sx, sy] = toCanvas(analysis.value.center_line.points[0])
|
||||
ctx.moveTo(sx, sy)
|
||||
for (let i = 1; i < analysis.value.center_line.points.length; i++) {
|
||||
const [px, py] = toCanvas(analysis.value.center_line.points[i])
|
||||
ctx.lineTo(px, py)
|
||||
}
|
||||
ctx.stroke()
|
||||
ctx.globalAlpha = 1
|
||||
|
||||
const [startX, startY] = toCanvas(analysis.value.center_line.points[0])
|
||||
const [endX, endY] = toCanvas(analysis.value.center_line.points[analysis.value.center_line.points.length - 1])
|
||||
ctx.fillStyle = '#34d399'
|
||||
ctx.beginPath()
|
||||
ctx.arc(startX, startY, 5, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
ctx.fillStyle = '#f87171'
|
||||
ctx.beginPath()
|
||||
ctx.arc(endX, endY, 5, 0, Math.PI * 2)
|
||||
ctx.fill()
|
||||
}
|
||||
}
|
||||
|
||||
function handleResize() {
|
||||
if (canvas.value) {
|
||||
const container = canvas.value.parentElement
|
||||
if (container) {
|
||||
canvas.value.width = container.clientWidth
|
||||
canvas.value.height = Math.max(500, container.clientWidth * 0.6)
|
||||
drawTrackMap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const debouncedResize = () => {
|
||||
if (resizeRafId !== null) cancelAnimationFrame(resizeRafId)
|
||||
resizeRafId = requestAnimationFrame(() => {
|
||||
handleResize()
|
||||
resizeRafId = null
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleResize()
|
||||
window.addEventListener('resize', debouncedResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (resizeRafId !== null) cancelAnimationFrame(resizeRafId)
|
||||
window.removeEventListener('resize', debouncedResize)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="track-map-view">
|
||||
<div class="flex items-center gap-2 mb-3">
|
||||
<button class="btn btn-secondary btn-sm" @click="router.back()">← Back</button>
|
||||
<h2 class="page-title">Track Map</h2>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="card text-secondary">Loading analysis...</div>
|
||||
<div v-else-if="error" class="card text-error">{{ error }}</div>
|
||||
|
||||
<template v-else-if="analysis">
|
||||
<div class="grid grid-3 mb-3">
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Boundaries</span>
|
||||
<span class="stat-value mono">{{ analysis.boundaries.length }}</span>
|
||||
</div>
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Total Points</span>
|
||||
<span class="stat-value mono">{{ analysis.total_points.toLocaleString() }}</span>
|
||||
</div>
|
||||
<div class="card stat-card">
|
||||
<span class="stat-label">Center Line</span>
|
||||
<span class="stat-value" :class="analysis.center_line ? 'text-success' : 'text-muted'">
|
||||
{{ analysis.center_line ? '✓ Computed' : '✗ N/A' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h2>Track Map</h2>
|
||||
<div class="flex gap-2">
|
||||
<span v-for="(boundary, idx) in analysis.boundaries" :key="boundary.label" class="legend-item">
|
||||
<span class="legend-dot" :style="{ background: BOUNDARY_COLORS[idx % BOUNDARY_COLORS.length] }" />
|
||||
{{ boundary.label }} ({{ boundary.point_count }})
|
||||
</span>
|
||||
<span v-if="analysis.center_line" class="legend-item">
|
||||
<span class="legend-dot" style="background: #34d399" />
|
||||
Center Line
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="canvas-container">
|
||||
<canvas ref="canvas" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Boundaries</h2>
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Label</th>
|
||||
<th>Points</th>
|
||||
<th>Spline Range</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="boundary in analysis.boundaries" :key="boundary.label">
|
||||
<td>{{ boundary.label }}</td>
|
||||
<td class="mono">{{ boundary.point_count.toLocaleString() }}</td>
|
||||
<td class="mono">
|
||||
{{ boundary.points.length > 0 ? boundary.points[0].spline.toFixed(3) : '-' }}
|
||||
–
|
||||
{{ boundary.points.length > 0 ? boundary.points[boundary.points.length - 1].spline.toFixed(3) : '-' }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.canvas-container {
|
||||
width: 100%;
|
||||
min-height: 500px;
|
||||
border-radius: var(--radius-sm);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.legend-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding: 0.5rem 0.75rem;
|
||||
border-bottom: 2px solid var(--color-border);
|
||||
color: var(--color-text-muted);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 0.4rem 0.75rem;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
<!-- racecraft — Vue.js web client for sim racing telemetry analysis -->
|
||||
<!-- Copyright (C) 2026 Jan-Peter v. Hunnius -->
|
||||
<!-- -->
|
||||
<!-- This program is free software: you can redistribute it and/or modify -->
|
||||
<!-- it under the terms of the GNU Affero General Public License as -->
|
||||
<!-- published by the Free Software Foundation, either version 3 of the -->
|
||||
<!-- License, or (at your option) any later version. -->
|
||||
<!-- -->
|
||||
<!-- This program is distributed in the hope that it will be useful, -->
|
||||
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
|
||||
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
|
||||
<!-- GNU Affero General Public License for more details. -->
|
||||
<!-- -->
|
||||
<!-- You should have received a copy of the GNU Affero General Public License -->
|
||||
<!-- along with this program. If not, see <https://www.gnu.org/licenses/>. -->
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { RouterLink } from 'vue-router'
|
||||
import { useTracksStore } from '@/stores/tracks'
|
||||
|
||||
const store = useTracksStore()
|
||||
|
||||
onMounted(() => {
|
||||
store.fetchTracks()
|
||||
})
|
||||
|
||||
function formatTime(iso: string): string {
|
||||
return new Date(iso).toLocaleString()
|
||||
}
|
||||
|
||||
function gameLabel(game: string): string {
|
||||
const labels: Record<string, string> = {
|
||||
assetto_corsa: 'Assetto Corsa',
|
||||
assetto_corsa_competizione: 'ACC',
|
||||
project_cars_1: 'Project CARS 1',
|
||||
project_cars_2: 'Project CARS 2',
|
||||
}
|
||||
return labels[game] ?? game
|
||||
}
|
||||
|
||||
async function handleDelete(game: string, trackName: string) {
|
||||
if (confirm(`Delete track model "${trackName}" (${gameLabel(game)})?`)) {
|
||||
await store.deleteTrack(game, trackName)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="tracks-view">
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<h2 class="page-title">Tracks</h2>
|
||||
<RouterLink to="/sessions" class="btn btn-secondary">
|
||||
+ Map a Track
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
<div v-if="store.error" class="card mb-3 text-error">{{ store.error }}</div>
|
||||
<div v-if="store.loading && store.tracks.length === 0" class="card text-secondary">Loading tracks...</div>
|
||||
|
||||
<div v-if="store.tracks.length === 0 && !store.loading" class="card text-secondary">
|
||||
<p class="mb-2">No track models stored yet.</p>
|
||||
<p style="font-size: 0.85rem; color: var(--color-text-muted)">
|
||||
Create a Track Mapping session, record left and right boundary laps, then build the track model.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div v-else class="track-cards">
|
||||
<div v-for="track in store.tracks" :key="`${track.game}-${track.track_name}`" class="card track-card">
|
||||
<div class="flex items-center justify-between mb-1">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="badge badge-primary">{{ gameLabel(track.game) }}</span>
|
||||
<span class="track-name">{{ track.track_name }}</span>
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
<RouterLink
|
||||
:to="`/tracks/${track.game}/${track.track_name}`"
|
||||
class="btn btn-secondary btn-sm"
|
||||
>
|
||||
View
|
||||
</RouterLink>
|
||||
<button
|
||||
class="btn btn-danger btn-sm"
|
||||
@click="handleDelete(track.game, track.track_name)"
|
||||
>
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="track-meta">
|
||||
<span class="text-secondary">{{ track.corner_count }} corners</span>
|
||||
<span class="text-muted">·</span>
|
||||
<span class="text-muted" style="font-size: 0.8rem">{{ formatTime(track.created_at) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.track-cards {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.track-card {
|
||||
transition: border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.track-card:hover {
|
||||
border-color: var(--color-primary);
|
||||
}
|
||||
|
||||
.track-name {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.track-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.85rem;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue