Skip to content

Commit

Permalink
take CFshockDefl into account for Rumble
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesClonk committed Nov 14, 2018
1 parent cc860de commit 53ca37b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
56 changes: 33 additions & 23 deletions iR60TelemetryProvider/iR60TelemetryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,35 @@ public TelemetryValue TelemetryValueByName(string name)
return tv;
}

private float GetFloat(string name, float defaultValue = 0.0f)
{
if (_sdk.VarHeaders.ContainsKey(name))
{
return (float)_sdk.GetData(name);
}
else
{
return defaultValue;
}
}

private float RadianToDegree(string name)
{
return (float)_sdk.GetData(name) * (float)(180 / Math.PI);
return GetFloat(name) * (float)(180 / Math.PI);
}

private float SlipAngle
{
get
{
float v = 0.0f;
float speed = (float)_sdk.GetData("Speed");
float speed = GetFloat("Speed");

if (speed > 5)
{
float VelocityX = (float)_sdk.GetData("VelocityX");
float VelocityY = (float)_sdk.GetData("VelocityY");
float YawRate = (float)_sdk.GetData("YawRate");
float VelocityX = GetFloat("VelocityX");
float VelocityY = GetFloat("VelocityY");
float YawRate = GetFloat("YawRate");
// Porsche GT3 Cup
// Fahrzeug Länge: 4.564
// Radstand: 1.980 x 2.456
Expand All @@ -119,20 +131,23 @@ private float Rumble
{
get
{
float _LFshockDefl = (float)_sdk.GetData("LFshockDefl");
float _LRshockDefl = (float)_sdk.GetData("LRshockDefl");
float _RFshockDefl = (float)_sdk.GetData("RFshockDefl");
float _RRshockDefl = (float)_sdk.GetData("RRshockDefl");
float _CFshockDefl = GetFloat("CFshockDefl");
float _LFshockDefl = GetFloat("LFshockDefl");
float _LRshockDefl = GetFloat("LRshockDefl");
float _RFshockDefl = GetFloat("RFshockDefl");
float _RRshockDefl = GetFloat("RRshockDefl");

const float x = 1000.0f;
float[] data =
{
_CFshockDefl - (float)_session.Get("CFshockDefl", 0.0f),
_LFshockDefl - (float)_session.Get("LFshockDefl", 0.0f),
_LRshockDefl - (float)_session.Get("LRshockDefl", 0.0f),
_RFshockDefl - (float)_session.Get("RFshockDefl", 0.0f),
_RRshockDefl - (float)_session.Get("RRshockDefl", 0.0f)
};

_session.Set("CFshockDefl", _CFshockDefl);
_session.Set("LFshockDefl", _LFshockDefl);
_session.Set("LRshockDefl", _LRshockDefl);
_session.Set("RFshockDefl", _RFshockDefl);
Expand All @@ -148,10 +163,10 @@ private float RumbleHz
{
float[] data =
{
(float)_sdk.GetData("TireLF_RumblePitch"),
(float)_sdk.GetData("TireRF_RumblePitch"),
(float)_sdk.GetData("TireLR_RumblePitch"),
(float)_sdk.GetData("TireRR_RumblePitch")
GetFloat("TireLF_RumblePitch"),
GetFloat("TireRF_RumblePitch"),
GetFloat("TireLR_RumblePitch"),
GetFloat("TireRR_RumblePitch")
};

return data.Max();
Expand All @@ -162,30 +177,25 @@ private float VertAccel
{
get
{
return (float)(
(float)_sdk.GetData("VertAccel")
* Math.Cos((float)_sdk.GetData("Pitch"))
* Math.Cos((float)_sdk.GetData("Roll")) - G) / G;
return (float)(GetFloat("VertAccel")
* Math.Cos(GetFloat("Pitch"))
* Math.Cos(GetFloat("Roll")) - G) / G;
}
}

private float LongAccel
{
get
{
return (float)(
(float)_sdk.GetData("LongAccel")
* (Math.Cos((float)_sdk.GetData("Pitch")) / G));
return (float)(GetFloat("LongAccel") * (Math.Cos(GetFloat("Pitch")) / G));
}
}

private float LatAccel
{
get
{
return (float)(
(float)_sdk.GetData("LatAccel")
* (Math.Cos((float)_sdk.GetData("Roll")) / G));
return (float)(GetFloat("LatAccel") * (Math.Cos(GetFloat("Roll")) / G));
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion iR60TelemetryProvider/iR60TelemetryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class iR60TelemetryProvider : AbstractTelemetryProvider
public iR60TelemetryProvider() : base()
{
Author = "JamesClonk";
Version = "v1.0-rc.7";
Version = "v1.0-rc.8";
BannerImage = @"img\banner_iracing.png"; // Image shown on top of the profiles tab
IconImage = @"img\iracing.jpg"; // Icon used in the tree view for the profile
TelemetryUpdateFrequency = 60; // the update frequency in samples per second
Expand All @@ -48,6 +48,7 @@ public override string[] GetValueList()
{
string[] values = {
"Brake", "BrakeRaw", "Clutch",
"CFshockDefl", "CFshockVel",
"DriverMarker", "EngineWarnings",
"FuelLevel", "FuelLevelPct", "FuelPress",
"Gear", "HandbrakeRaw", "IsOnTrack",
Expand Down
2 changes: 1 addition & 1 deletion iracing_60hz_iRacing_-_60hz_testing.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Profile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Active="false" Name="iRacing - 60hz testing" TelemetryProvider="iracing_60hz" OverallSmoothnessEnabled="false" OverallSmoothness="0.3" overallIntensity="1" acceleration="60" minSpeed="64704" maxSpeed="65304">
<author>JamesClonk</author>
<version>v1.0-rc.7</version>
<version>v1.0-rc.8</version>
<info>Test profile for iRacing 60hz telemetry.
Right click on the profile name (left) and copy.
Activate your copy and get started!
Expand Down

0 comments on commit 53ca37b

Please sign in to comment.