Skip to content

Commit a426816

Browse files
committed
Initial commit
0 parents  commit a426816

File tree

69 files changed

+154590
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+154590
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.vs/TelemetryPC3/v15/.suo

55.5 KB
Binary file not shown.

.vs/TelemetryPC3/v15/Server/sqlite3/db.lock

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 CodeSailer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# TelemetryPC3
2+
Simple telemetry software for Project CARS 3

TelemetryPC3.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.1209
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TelemetryPC3", "TelemetryPC3\TelemetryPC3.csproj", "{F66355AB-38B9-470F-AF05-814BD81F4CAE}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F66355AB-38B9-470F-AF05-814BD81F4CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F66355AB-38B9-470F-AF05-814BD81F4CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F66355AB-38B9-470F-AF05-814BD81F4CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F66355AB-38B9-470F-AF05-814BD81F4CAE}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {56CB1A3C-4FC3-4431-9956-02EC4A578B02}
24+
EndGlobalSection
25+
EndGlobal

TelemetryPC3/App.config

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />
5+
</startup>
6+
</configuration>

TelemetryPC3/Form1.Designer.cs

+418
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TelemetryPC3/Form1.cs

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.IO;
7+
using System.Linq;
8+
using System.Text;
9+
using System.Threading.Tasks;
10+
using System.Windows.Forms;
11+
12+
using OxyPlot;
13+
using OxyPlot.Series;
14+
15+
namespace TelemetryPC3
16+
{
17+
public partial class Form1 : Form
18+
{
19+
PlotModel myModel = new PlotModel { };
20+
21+
LineSeries speedSeries = new LineSeries() { Title = "speed"};
22+
LineSeries tFLSeries = new LineSeries() { Title = "t° FL" };
23+
LineSeries tFRSeries = new LineSeries() { Title = "t° FR" };
24+
LineSeries tRLSeries = new LineSeries() { Title = "t° RL" };
25+
LineSeries tRRSeries = new LineSeries() { Title = "t° RR" };
26+
LineSeries throttleSeries = new LineSeries() { Title = "throttle" };
27+
LineSeries brakeSeries = new LineSeries() { Title = "brake" };
28+
LineSeries steeringSeries = new LineSeries() { Title = "steering" };
29+
string telemetryFileName;
30+
31+
List<float> gforce_x = new List<float>();
32+
List<float> gforce_y = new List<float>();
33+
List<float> gforce_z = new List<float>();
34+
35+
public Form1( string telemetryFile = null)
36+
{
37+
if(telemetryFile != null)
38+
{
39+
telemetryFileName = telemetryFile;
40+
}
41+
InitializeComponent();
42+
43+
speedSeries.Color = OxyColors.Blue;
44+
tFLSeries.Color = OxyColors.Orange;
45+
tFRSeries.Color = OxyColors.DarkOrange;
46+
tRLSeries.Color = OxyColors.Purple;
47+
tRRSeries.Color = OxyColors.DarkViolet;
48+
throttleSeries.Color = OxyColors.Green;
49+
brakeSeries.Color = OxyColors.Red;
50+
steeringSeries.Color = OxyColors.Black;
51+
}
52+
53+
private void openToolStripMenuItem_Click(object sender, EventArgs e)
54+
{
55+
OpenFileDialog ofd = new OpenFileDialog();
56+
if(ofd.ShowDialog() == DialogResult.OK)
57+
{
58+
ClearPlot();
59+
telemetryFileName = ofd.FileName;
60+
openTelemetryFile(telemetryFileName, LapBox.Text);
61+
}
62+
}
63+
64+
public void openTelemetryFile(string fileName, string lapNumber)
65+
{
66+
List<string> tmp = File.ReadAllLines(fileName).ToList();
67+
for (int i = 0; i < tmp.Count; i++)
68+
{
69+
string[] line_part = tmp[i].Split(' ');
70+
if (lapNumber != "all")
71+
{
72+
if (line_part[0] == lapNumber)
73+
{
74+
speedSeries.Points.Add(new DataPoint(i, double.Parse(line_part[1]) * 3.6));
75+
s1time.Text = line_part[2];
76+
s2time.Text = line_part[3];
77+
s3time.Text = line_part[4];
78+
laptime.Text = line_part[5];
79+
tFLSeries.Points.Add(new DataPoint(i, double.Parse(line_part[6])+(-273.15)));
80+
tFRSeries.Points.Add(new DataPoint(i, double.Parse(line_part[7]) + (-273.15)));
81+
tRLSeries.Points.Add(new DataPoint(i, double.Parse(line_part[8]) + (-273.15)));
82+
tRRSeries.Points.Add(new DataPoint(i, double.Parse(line_part[9]) + (-273.15)));
83+
84+
throttleSeries.Points.Add(new DataPoint(i, double.Parse(line_part[10])/255*100));
85+
brakeSeries.Points.Add(new DataPoint(i, double.Parse(line_part[11])/255*100));
86+
steeringSeries.Points.Add(new DataPoint(i, double.Parse(line_part[12])));
87+
gforce_x.Add(float.Parse(line_part[13]) / 10);
88+
gforce_y.Add(float.Parse(line_part[14]) / 10);
89+
gforce_z.Add(float.Parse(line_part[15]) / 10);
90+
}
91+
}
92+
else
93+
{
94+
speedSeries.Points.Add(new DataPoint(i, double.Parse(line_part[1]) * 3.6));
95+
s1time.Text = line_part[2];
96+
s2time.Text = line_part[3];
97+
s3time.Text = line_part[4];
98+
laptime.Text = line_part[5];
99+
tFLSeries.Points.Add(new DataPoint(i, double.Parse(line_part[6]) + (-273.15)));
100+
tFRSeries.Points.Add(new DataPoint(i, double.Parse(line_part[7]) + (-273.15)));
101+
tRLSeries.Points.Add(new DataPoint(i, double.Parse(line_part[8]) + (-273.15)));
102+
tRRSeries.Points.Add(new DataPoint(i, double.Parse(line_part[9]) + (-273.15)));
103+
104+
throttleSeries.Points.Add(new DataPoint(i, double.Parse(line_part[10]) / 255 * 100));
105+
brakeSeries.Points.Add(new DataPoint(i, double.Parse(line_part[11])/255*100));
106+
steeringSeries.Points.Add(new DataPoint(i, double.Parse(line_part[12])));
107+
gforce_x.Add(float.Parse(line_part[13]) / 10);
108+
gforce_y.Add(float.Parse(line_part[14]) / 10);
109+
gforce_z.Add(float.Parse(line_part[15]) / 10);
110+
}
111+
112+
}
113+
myModel.Series.Add(speedSeries);
114+
myModel.Series.Add(tFLSeries);
115+
myModel.Series.Add(tFRSeries);
116+
myModel.Series.Add(tRLSeries);
117+
myModel.Series.Add(tRRSeries);
118+
myModel.Series.Add(throttleSeries);
119+
myModel.Series.Add(brakeSeries);
120+
myModel.Series.Add(steeringSeries);
121+
if (gforce_x.Count() != 0)
122+
{
123+
gforce_x_min.Text = gforce_x.Min().ToString("0.0");
124+
gforce_x_max.Text = gforce_x.Max().ToString("0.0");
125+
gforce_y_min.Text = gforce_y.Min().ToString("0.0");
126+
gforce_y_max.Text = gforce_y.Max().ToString("0.0");
127+
gforce_z_min.Text = gforce_z.Min().ToString("0.0");
128+
gforce_z_max.Text = gforce_z.Max().ToString("0.0");
129+
}
130+
this.plotView1.Model = myModel;
131+
}
132+
133+
private void btn_update_Click(object sender, EventArgs e)
134+
{
135+
/*Form1 nf = new Form1(telemetryFileName);
136+
nf.Show();
137+
nf.LapBox.Text = LapBox.Text;
138+
nf.openTelemetryFile(telemetryFileName, LapBox.Text);*/
139+
ClearPlot();
140+
openTelemetryFile(telemetryFileName, LapBox.Text);
141+
}
142+
143+
public void ClearPlot()
144+
{
145+
// reset plot
146+
myModel.InvalidatePlot(true);
147+
myModel.Series.Clear();
148+
//reset series data
149+
speedSeries.Points.Clear();
150+
tFLSeries.Points.Clear();
151+
tFRSeries.Points.Clear();
152+
tRLSeries.Points.Clear();
153+
tRRSeries.Points.Clear();
154+
throttleSeries.Points.Clear();
155+
brakeSeries.Points.Clear();
156+
steeringSeries.Points.Clear();
157+
}
158+
159+
private void newWindowToolStripMenuItem_Click(object sender, EventArgs e)
160+
{
161+
Form1 nf = new Form1(telemetryFileName);
162+
nf.Show();
163+
}
164+
}
165+
}

TelemetryPC3/Form1.resx

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121+
<value>17, 17</value>
122+
</metadata>
123+
</root>

TelemetryPC3/Program.cs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using System.Windows.Forms;
6+
7+
namespace TelemetryPC3
8+
{
9+
static class Program
10+
{
11+
/// <summary>
12+
/// Punto di ingresso principale dell'applicazione.
13+
/// </summary>
14+
[STAThread]
15+
static void Main()
16+
{
17+
Application.EnableVisualStyles();
18+
Application.SetCompatibleTextRenderingDefault(false);
19+
Application.Run(new Form1());
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)