public bool TryGetDefaultSettings(string simName, string carName, out CarPropertiesDto carProperties)
        {
            if (simName != "R3E")
            {
                carProperties = null;
                return(false);
            }

            var r3EProperties = CarProperties.CarsProperties.FirstOrDefault(x => x.CarName == carName.Replace(" ", "").ToLower());

            if (r3EProperties == null)
            {
                carProperties = null;
                return(false);
            }

            carProperties = new CarPropertiesDto()
            {
                CarName   = carName,
                Simulator = simName,
            };

            carProperties.FrontLeftTyre.BumpTransition  = Velocity.FromMs(r3EProperties.BumpTransitionFront);
            carProperties.FrontRightTyre.BumpTransition = Velocity.FromMs(r3EProperties.BumpTransitionFront);
            carProperties.RearLeftTyre.BumpTransition   = Velocity.FromMs(r3EProperties.BumpTransitionRear);
            carProperties.RearRightTyre.BumpTransition  = Velocity.FromMs(r3EProperties.BumpTransitionRear);

            carProperties.FrontLeftTyre.ReboundTransition  = Velocity.FromMs(r3EProperties.ReboundTransitionFront);
            carProperties.FrontRightTyre.ReboundTransition = Velocity.FromMs(r3EProperties.ReboundTransitionFront);
            carProperties.RearLeftTyre.ReboundTransition   = Velocity.FromMs(r3EProperties.ReboundTransitionRear);
            carProperties.RearRightTyre.ReboundTransition  = Velocity.FromMs(r3EProperties.ReboundTransitionRear);

            return(true);
        }
示例#2
0
        private void AddSpeedInfo(SimulatorDataSet data, bool computeNewSpeed, DriverInfo driverInfo)
        {
            if (!computeNewSpeed && _pcarsConnector.PreviousTickInfo.ContainsKey(driverInfo.DriverName))
            {
                driverInfo.Speed = _pcarsConnector.PreviousTickInfo[driverInfo.DriverName].Speed;
            }

            if (_pcarsConnector.PreviousTickInfo.ContainsKey(driverInfo.DriverName) && computeNewSpeed && _lastSpeedComputationSet != null)
            {
                Point3D currentWorldPosition  = driverInfo.WorldPosition;
                Point3D previousWorldPosition = _pcarsConnector.PreviousTickInfo[driverInfo.DriverName].WorldPosition;
                double  duration = data.SessionInfo.SessionTime
                                   .Subtract(_lastSpeedComputationSet.SessionInfo.SessionTime).TotalSeconds;

                // double speed = lastTickDuration.TotalMilliseconds;
                double speed = Point3D.GetDistance(currentWorldPosition, previousWorldPosition).InMeters / duration;

                // if (speed < 200)
                driverInfo.Speed = Velocity.FromMs(speed);
            }

            if (computeNewSpeed)
            {
                _pcarsConnector.PreviousTickInfo[driverInfo.DriverName] = driverInfo;
            }
        }
示例#3
0
        public void Mph_WhenConvertedToMph_ThenCalueInMphIsCorrect(double valueInMs)
        {
            // Arrange
            Velocity _testee = Velocity.FromMs(valueInMs);

            // Act
            double inMph = _testee.InMph;

            // Assert
            Assert.That(inMph, Is.EqualTo(valueInMs * 2.23694).Within(0.001));
        }
        private Velocity ComputeSuspensionVelocity(WheelInfo wheel, Distance lastSuspTravel, Velocity lastSuspensionVelocity, double sessionTimeSeconds)
        {
            double interval = sessionTimeSeconds - _lastSessionTimeSeconds;

            if (interval <= 0)
            {
                wheel.SuspensionVelocity = lastSuspensionVelocity;
                return(lastSuspensionVelocity);
            }

            Distance distanceTraveled   = wheel.SuspensionTravel - lastSuspTravel;
            Velocity suspensionVelocity = Velocity.FromMs(distanceTraveled.InMeters / interval);

            wheel.SuspensionVelocity = suspensionVelocity;
            return(suspensionVelocity);
        }
示例#5
0
        private DriverInfo CreateDriverInfo(RfShared rfData, RfVehicleInfo rfVehicleInfo)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = StringExtensions.FromArray(rfVehicleInfo.DriverName),
                CompletedLaps = rfVehicleInfo.TotalLaps,
                CarName       = StringExtensions.FromArray(rfVehicleInfo.VehicleClass),
                InPits        = rfVehicleInfo.InPits == 1
            };

            driverInfo.IsPlayer      = rfVehicleInfo.IsPlayer == 1;
            driverInfo.Position      = rfVehicleInfo.Place;
            driverInfo.Speed         = Velocity.FromMs(rfVehicleInfo.Speed);
            driverInfo.LapDistance   = rfVehicleInfo.LapDist >= 0 ? rfVehicleInfo.LapDist : rfData.LapDist + rfVehicleInfo.LapDist;
            driverInfo.TotalDistance = rfVehicleInfo.TotalLaps * rfData.LapDist + driverInfo.LapDistance;
            driverInfo.FinishStatus  = FromRFStatus(rfVehicleInfo.FinishStatus);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(rfVehicleInfo.Pos.X), Distance.FromMeters(rfVehicleInfo.Pos.Y), Distance.FromMeters(rfVehicleInfo.Pos.Z));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, rfData);
            return(driverInfo);
        }
示例#6
0
        private DriverInfo CreateDriverInfo(R3ESharedData r3RData, DriverData r3RDriverData, string playerName)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = FromByteArray(r3RDriverData.DriverInfo.Name),
                CompletedLaps = r3RDriverData.CompletedLaps,
                CarName       = string.Empty,
                InPits        = r3RDriverData.InPitlane == 1
            };

            driverInfo.IsPlayer      = driverInfo.DriverName == playerName;
            driverInfo.Position      = r3RDriverData.Place;
            driverInfo.Speed         = Velocity.FromMs(r3RDriverData.CarSpeed);
            driverInfo.LapDistance   = r3RDriverData.LapDistance;
            driverInfo.TotalDistance = r3RDriverData.CompletedLaps * r3RData.LayoutLength + r3RDriverData.LapDistance;
            driverInfo.CarName       = _database.GetCarName(r3RDriverData.DriverInfo.ModelId);
            driverInfo.FinishStatus  = FromR3RStatus(r3RDriverData.FinishStatus);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(r3RDriverData.Position.X), Distance.FromMeters(r3RDriverData.Position.Y), Distance.FromMeters(r3RDriverData.Position.Z));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, r3RData);
            return(driverInfo);
        }
示例#7
0
        private DriverInfo CreateDriverInfo(PCars2SharedMemory pcarsData, ParticipantInfo pcVehicleInfo, int vehicleIndex)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = StringExtensions.FromArray(pcVehicleInfo.mName),
                CompletedLaps = (int)pcVehicleInfo.mLapsCompleted,
                CarName       = StringExtensions.FromArray(pcarsData.mCarNames, vehicleIndex * 64),
                CarClassName  = StringExtensions.FromArray(pcarsData.mCarClassNames, vehicleIndex * 64),
                InPits        = pcarsData.mPitModes[vehicleIndex] != 0
            };

            driverInfo.CarClassId    = driverInfo.CarClassName;
            driverInfo.IsPlayer      = vehicleIndex == pcarsData.mViewedParticipantIndex;
            driverInfo.Position      = (int)pcVehicleInfo.mRacePosition;
            driverInfo.Speed         = Velocity.FromMs(pcarsData.mSpeeds[vehicleIndex]);
            driverInfo.LapDistance   = pcVehicleInfo.mCurrentLapDistance;
            driverInfo.TotalDistance = (pcVehicleInfo.mLapsCompleted * pcarsData.mTrackLength) + driverInfo.LapDistance;
            driverInfo.FinishStatus  = FromPCarStatus((RaceState)pcarsData.mRaceStates[vehicleIndex]);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(-pcVehicleInfo.mWorldPosition[0]), Distance.FromMeters(pcVehicleInfo.mWorldPosition[1]), Distance.FromMeters(pcVehicleInfo.mWorldPosition[2]));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, pcarsData.mTrackLength);
            return(driverInfo);
        }
示例#8
0
        private DriverInfo CreateDriverInfo(Rf2FullData rfData, rF2VehicleScoring rfVehicleInfo)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = StringExtensions.FromArray(rfVehicleInfo.mDriverName),
                CompletedLaps = rfVehicleInfo.mTotalLaps,
                CarName       = StringExtensions.FromArray(rfVehicleInfo.mVehicleName),
                InPits        = rfVehicleInfo.mInPits == 1
            };

            driverInfo.IsPlayer = rfVehicleInfo.mIsPlayer == 1;
            driverInfo.Position = rfVehicleInfo.mPlace;
            driverInfo.Speed    = Velocity.FromMs(Math.Sqrt((rfVehicleInfo.mLocalVel.x * rfVehicleInfo.mLocalVel.x)
                                                            + (rfVehicleInfo.mLocalVel.y * rfVehicleInfo.mLocalVel.y)
                                                            + (rfVehicleInfo.mLocalVel.z * rfVehicleInfo.mLocalVel.z)));
            driverInfo.LapDistance   = rfVehicleInfo.mLapDist;
            driverInfo.TotalDistance = rfVehicleInfo.mTotalLaps * rfData.scoring.mScoringInfo.mLapDist + rfVehicleInfo.mLapDist;
            driverInfo.FinishStatus  = FromRFStatus(rfVehicleInfo.mFinishStatus);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(rfVehicleInfo.mPos.x), Distance.FromMeters(rfVehicleInfo.mPos.y), Distance.FromMeters(rfVehicleInfo.mPos.z));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, rfData);
            return(driverInfo);
        }
示例#9
0
        private DriverInfo CreateDriverInfo(AssettoCorsaShared acData, AcsVehicleInfo acVehicleInfo, SimulatorDataSet dataSet)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = StringExtensions.FromArray(acVehicleInfo.driverName),
                CompletedLaps = acVehicleInfo.lapCount,
                CarName       = FormatACName(StringExtensions.FromArray(acVehicleInfo.carModel)),
            };

            driverInfo.InPits = acVehicleInfo.isCarInPit == 1 || acVehicleInfo.isCarInPitlane == 1;


            driverInfo.IsPlayer      = acVehicleInfo.carId == 0;
            driverInfo.Position      = dataSet.SessionInfo.SessionType == SessionType.Race ? acVehicleInfo.carRealTimeLeaderboardPosition + 1 : acVehicleInfo.carLeaderboardPosition;
            driverInfo.Speed         = Velocity.FromMs(acVehicleInfo.speedMS);
            driverInfo.LapDistance   = acData.AcsStatic.trackSPlineLength * acVehicleInfo.spLineLength;
            driverInfo.TotalDistance = acVehicleInfo.lapCount * acData.AcsStatic.trackSPlineLength + acVehicleInfo.spLineLength * acData.AcsStatic.trackSPlineLength;
            driverInfo.FinishStatus  = FromAcStatus(acVehicleInfo.finishedStatus);
            driverInfo.WorldPosition = new Point3D(Distance.FromMeters(acVehicleInfo.worldPosition.x), Distance.FromMeters(acVehicleInfo.worldPosition.y), Distance.FromMeters(acVehicleInfo.worldPosition.z));
            ComputeDistanceToPlayer(_lastPlayer, driverInfo, acData);
            return(driverInfo);
        }
示例#10
0
        private DriverInfo CreateDriverInfo(AssettoCorsaShared acData, AcsVehicleInfo acVehicleInfo, SimulatorDataSet dataSet)
        {
            DriverInfo driverInfo = new DriverInfo
            {
                DriverName    = acVehicleInfo.driverName.FromArray(),
                CompletedLaps = acVehicleInfo.lapCount,
                CarName       = FormatACName(name: acVehicleInfo.carModel.FromArray()),
                InPits        = (acVehicleInfo.isCarInPit == 1 || acVehicleInfo.isCarInPitlane == 1) && (dataSet.SessionInfo.SessionType != SessionType.Race || acVehicleInfo.lapCount > 0),
                IsPlayer      = acVehicleInfo.carId == 0,
                Position      = dataSet.SessionInfo.SessionType == SessionType.Race ? acVehicleInfo.carRealTimeLeaderboardPosition + 1 : acVehicleInfo.carLeaderboardPosition,
                Speed         = Velocity.FromMs(acVehicleInfo.speedMS),
                LapDistance   = acData.AcsStatic.trackSPlineLength * acVehicleInfo.spLineLength,
                TotalDistance = acVehicleInfo.lapCount * acData.AcsStatic.trackSPlineLength + acVehicleInfo.spLineLength * acData.AcsStatic.trackSPlineLength,
                FinishStatus  = FromAcStatus(acVehicleInfo.finishedStatus),
                WorldPosition = new Point3D(Distance.FromMeters(acVehicleInfo.worldPosition.x), Distance.FromMeters(acVehicleInfo.worldPosition.y), Distance.FromMeters(acVehicleInfo.worldPosition.z)),
            };

            driverInfo.CarClassId   = driverInfo.CarName;
            driverInfo.CarClassName = driverInfo.CarName;


            ComputeDistanceToPlayer(_lastPlayer, driverInfo, acData);
            return(driverInfo);
        }
示例#11
0
        private void AddTyresAndFuelInfo(PCars2SharedMemory data, SimulatorDataSet simData)
        {
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyrePressure.ActualQuantity  = Pressure.FromKiloPascals(data.mAirPressure[(int)WheelIndex.TyreFrontLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.mAirPressure[(int)WheelIndex.TyreFrontRight]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyrePressure.ActualQuantity   = Pressure.FromKiloPascals(data.mAirPressure[(int)WheelIndex.TyreRearLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyrePressure.ActualQuantity  = Pressure.FromKiloPascals(data.mAirPressure[(int)WheelIndex.TyreRearRight]);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreWear.ActualWear  = data.mTyreWear[(int)WheelIndex.TyreFrontLeft];
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreWear.ActualWear = data.mTyreWear[(int)WheelIndex.TyreFrontRight];
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreWear.ActualWear   = data.mTyreWear[(int)WheelIndex.TyreRearLeft];
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreWear.ActualWear  = data.mTyreWear[(int)WheelIndex.TyreRearRight];

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.Rps  = data.mTyreRPS[(int)WheelIndex.TyreFrontLeft] * -1;  // -6.283185300;
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Rps = data.mTyreRPS[(int)WheelIndex.TyreFrontRight] * -1; // -6.283185300;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Rps   = data.mTyreRPS[(int)WheelIndex.TyreRearLeft] * -1;   //-6.283185300;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Rps  = data.mTyreRPS[(int)WheelIndex.TyreRearRight] * -1;  //-6.283185300;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.SuspensionTravel  = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreFrontLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.SuspensionTravel = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreFrontRight]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.SuspensionTravel   = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreRearLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.SuspensionTravel  = Distance.FromMeters(data.mSuspensionTravel[(int)WheelIndex.TyreRearRight]);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.SuspensionVelocity  = Velocity.FromMs(data.mSuspensionVelocity[(int)WheelIndex.TyreFrontLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.SuspensionVelocity = Velocity.FromMs(data.mSuspensionVelocity[(int)WheelIndex.TyreFrontRight]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.SuspensionVelocity   = Velocity.FromMs(data.mSuspensionVelocity[(int)WheelIndex.TyreRearLeft]);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.SuspensionVelocity  = Velocity.FromMs(data.mSuspensionVelocity[(int)WheelIndex.TyreRearRight]);

            int direDeflatedFlag = (int)TyreFlags.TyreAttached | (int)TyreFlags.TyreInflated;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.Detached  = (data.mTyreFlags[(int)WheelIndex.TyreFrontLeft] & direDeflatedFlag) != direDeflatedFlag;
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Detached = (data.mTyreFlags[(int)WheelIndex.TyreFrontRight] & direDeflatedFlag) != direDeflatedFlag;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Detached   = (data.mTyreFlags[(int)WheelIndex.TyreRearLeft] & direDeflatedFlag) != direDeflatedFlag;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Detached  = (data.mTyreFlags[(int)WheelIndex.TyreRearRight] & direDeflatedFlag) != direDeflatedFlag;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreType  = StringExtensions.FromArray(data.mLFTyreCompoundName);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreType = StringExtensions.FromArray(data.mRFTyreCompoundName);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreType   = StringExtensions.FromArray(data.mLRTyreCompoundName);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreType  = StringExtensions.FromArray(data.mRRTyreCompoundName);

            // Front Left Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius(data.mTyreTemp[(int)WheelIndex.TyreFrontLeft]);


            // Front Right Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius(data.mTyreTemp[(int)WheelIndex.TyreFrontRight]);


            // Rear Left Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius(data.mTyreTemp[(int)WheelIndex.TyreRearLeft]);

            // Rear Right Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius(data.mTyreTemp[(int)WheelIndex.TyreRearRight]);

            // Fuel System
            simData.PlayerInfo.CarInfo.FuelSystemInfo.FuelCapacity  = Volume.FromLiters(data.mFuelCapacity);
            simData.PlayerInfo.CarInfo.FuelSystemInfo.FuelRemaining = Volume.FromLiters(data.mFuelLevel * data.mFuelCapacity);

            if (UdpTelemetryData.sRideHeight != null)
            {
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RideHeight  = Distance.FromMeters(UdpTelemetryData.sRideHeight[(int)WheelIndex.TyreFrontLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.RideHeight = Distance.FromMeters(UdpTelemetryData.sRideHeight[(int)WheelIndex.TyreFrontRight]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.RideHeight   = Distance.FromMeters(UdpTelemetryData.sRideHeight[(int)WheelIndex.TyreRearLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.RideHeight  = Distance.FromMeters(UdpTelemetryData.sRideHeight[(int)WheelIndex.TyreRearRight]);
            }

            if (UdpTelemetryData.sTyreTempLeft != null && UdpTelemetryData.sTyreTempRight != null && UdpTelemetryData.sTyreTempCenter != null)
            {
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.LeftTyreTemp.ActualQuantity   = Temperature.FromCelsius(UdpTelemetryData.sTyreTempLeft[(int)WheelIndex.TyreFrontLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RightTyreTemp.ActualQuantity  = Temperature.FromCelsius(UdpTelemetryData.sTyreTempRight[(int)WheelIndex.TyreFrontLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.CenterTyreTemp.ActualQuantity = Temperature.FromCelsius(UdpTelemetryData.sTyreTempCenter[(int)WheelIndex.TyreFrontLeft]);

                simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.LeftTyreTemp.ActualQuantity   = Temperature.FromCelsius(UdpTelemetryData.sTyreTempLeft[(int)WheelIndex.TyreFrontRight]);
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.RightTyreTemp.ActualQuantity  = Temperature.FromCelsius(UdpTelemetryData.sTyreTempRight[(int)WheelIndex.TyreFrontRight]);
                simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.CenterTyreTemp.ActualQuantity = Temperature.FromCelsius(UdpTelemetryData.sTyreTempCenter[(int)WheelIndex.TyreFrontRight]);

                simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.LeftTyreTemp.ActualQuantity   = Temperature.FromCelsius(UdpTelemetryData.sTyreTempLeft[(int)WheelIndex.TyreRearLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.RightTyreTemp.ActualQuantity  = Temperature.FromCelsius(UdpTelemetryData.sTyreTempRight[(int)WheelIndex.TyreRearLeft]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.CenterTyreTemp.ActualQuantity = Temperature.FromCelsius(UdpTelemetryData.sTyreTempCenter[(int)WheelIndex.TyreRearLeft]);

                simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.LeftTyreTemp.ActualQuantity   = Temperature.FromCelsius(UdpTelemetryData.sTyreTempLeft[(int)WheelIndex.TyreRearRight]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.RightTyreTemp.ActualQuantity  = Temperature.FromCelsius(UdpTelemetryData.sTyreTempRight[(int)WheelIndex.TyreRearRight]);
                simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.CenterTyreTemp.ActualQuantity = Temperature.FromCelsius(UdpTelemetryData.sTyreTempCenter[(int)WheelIndex.TyreRearRight]);
            }
        }
示例#12
0
        private static void AddTyresInfo(R3ESharedData data, SimulatorDataSet simData)
        {
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyrePressure.ActualQuantity  = Pressure.FromKiloPascals(data.TirePressure.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyrePressure.ActualQuantity = Pressure.FromKiloPascals(data.TirePressure.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyrePressure.ActualQuantity   = Pressure.FromKiloPascals(data.TirePressure.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyrePressure.ActualQuantity  = Pressure.FromKiloPascals(data.TirePressure.RearRight);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreWear.ActualWear  = 1 - data.TireWear.FrontLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreWear.ActualWear = 1 - data.TireWear.FrontRight;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreWear.ActualWear   = 1 - data.TireWear.RearLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreWear.ActualWear  = 1 - data.TireWear.RearRight;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.Rps  = -data.TireRps.FrontLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Rps = -data.TireRps.FrontRight;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Rps   = -data.TireRps.RearLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Rps  = -data.TireRps.RearRight;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.DirtLevel  = data.TireDirt.FrontLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.DirtLevel = data.TireDirt.FrontRight;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.DirtLevel   = data.TireDirt.RearLeft;
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.DirtLevel  = data.TireDirt.RearRight;

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.SuspensionTravel  = Distance.FromMeters(data.Player.SuspensionDeflection.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.SuspensionTravel = Distance.FromMeters(data.Player.SuspensionDeflection.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.SuspensionTravel   = Distance.FromMeters(data.Player.SuspensionDeflection.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.SuspensionTravel  = Distance.FromMeters(data.Player.SuspensionDeflection.RearRight);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.SuspensionVelocity  = Velocity.FromMs(data.Player.SuspensionVelocity.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.SuspensionVelocity = Velocity.FromMs(data.Player.SuspensionVelocity.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.SuspensionVelocity   = Velocity.FromMs(data.Player.SuspensionVelocity.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.SuspensionVelocity  = Velocity.FromMs(data.Player.SuspensionVelocity.RearRight);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.Camber  = Angle.GetFromRadians(data.Player.Camber.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.Camber = Angle.GetFromRadians(data.Player.Camber.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.Camber   = Angle.GetFromRadians(data.Player.Camber.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.Camber  = Angle.GetFromRadians(data.Player.Camber.RearRight);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RideHeight  = Distance.FromMeters(data.Player.RideHeight.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.RideHeight = Distance.FromMeters(data.Player.RideHeight.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.RideHeight   = Distance.FromMeters(data.Player.RideHeight.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.RideHeight  = Distance.FromMeters(data.Player.RideHeight.RearRight);

            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreLoad  = Force.GetFromNewtons(data.TyreLoad.FrontLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreLoad = Force.GetFromNewtons(data.TyreLoad.FrontRight);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreLoad   = Force.GetFromNewtons(data.TyreLoad.RearLeft);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreLoad  = Force.GetFromNewtons(data.TyreLoad.RearRight);

            // Front Left Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.CenterTyreTemp.IdealQuantity       = Temperature.FromCelsius(data.TireTemp.FrontLeft.OptimalTemp);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.CenterTyreTemp.IdealQuantityWindow = Temperature.FromCelsius((data.TireTemp.FrontLeft.HotTemp - data.TireTemp.FrontLeft.OptimalTemp) * 0.5);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.LeftTyreTemp.ActualQuantity        = Temperature.FromCelsius(data.TireTemp.FrontLeft.CurrentTemp.Left);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.RightTyreTemp.ActualQuantity       = Temperature.FromCelsius(data.TireTemp.FrontLeft.CurrentTemp.Right);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.CenterTyreTemp.ActualQuantity      = Temperature.FromCelsius(data.TireTemp.FrontLeft.CurrentTemp.Center);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontLeft.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius((data.TireTemp.FrontLeft.CurrentTemp.Left + data.TireTemp.FrontLeft.CurrentTemp.Center + data.TireTemp.FrontLeft.CurrentTemp.Right) / 3);


            // Front Right Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.CenterTyreTemp.IdealQuantity       = Temperature.FromCelsius(data.TireTemp.FrontLeft.OptimalTemp);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.CenterTyreTemp.IdealQuantityWindow = Temperature.FromCelsius((data.TireTemp.FrontLeft.HotTemp - data.TireTemp.FrontLeft.OptimalTemp) * 0.5);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.LeftTyreTemp.ActualQuantity        = Temperature.FromCelsius(data.TireTemp.FrontRight.CurrentTemp.Left);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.RightTyreTemp.ActualQuantity       = Temperature.FromCelsius(data.TireTemp.FrontRight.CurrentTemp.Right);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.CenterTyreTemp.ActualQuantity      = Temperature.FromCelsius(data.TireTemp.FrontRight.CurrentTemp.Center);
            simData.PlayerInfo.CarInfo.WheelsInfo.FrontRight.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius((data.TireTemp.FrontRight.CurrentTemp.Left + data.TireTemp.FrontRight.CurrentTemp.Center + data.TireTemp.FrontRight.CurrentTemp.Right) / 3);


            // Rear Left Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.CenterTyreTemp.IdealQuantity       = Temperature.FromCelsius(data.TireTemp.FrontLeft.OptimalTemp);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.CenterTyreTemp.IdealQuantityWindow = Temperature.FromCelsius((data.TireTemp.FrontLeft.HotTemp - data.TireTemp.FrontLeft.OptimalTemp) * 0.5);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.LeftTyreTemp.ActualQuantity        = Temperature.FromCelsius(data.TireTemp.RearLeft.CurrentTemp.Left);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.RightTyreTemp.ActualQuantity       = Temperature.FromCelsius(data.TireTemp.RearLeft.CurrentTemp.Right);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.CenterTyreTemp.ActualQuantity      = Temperature.FromCelsius(data.TireTemp.RearLeft.CurrentTemp.Center);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearLeft.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius((data.TireTemp.RearLeft.CurrentTemp.Left + data.TireTemp.RearLeft.CurrentTemp.Center + data.TireTemp.RearLeft.CurrentTemp.Right) / 3);

            // Rear Right Tyre Temps
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.CenterTyreTemp.IdealQuantity       = Temperature.FromCelsius(data.TireTemp.FrontLeft.OptimalTemp);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.CenterTyreTemp.IdealQuantityWindow = Temperature.FromCelsius((data.TireTemp.FrontLeft.HotTemp - data.TireTemp.FrontLeft.OptimalTemp) * 0.5);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.LeftTyreTemp.ActualQuantity        = Temperature.FromCelsius(data.TireTemp.RearRight.CurrentTemp.Left);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.RightTyreTemp.ActualQuantity       = Temperature.FromCelsius(data.TireTemp.RearRight.CurrentTemp.Right);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.CenterTyreTemp.ActualQuantity      = Temperature.FromCelsius(data.TireTemp.RearRight.CurrentTemp.Center);
            simData.PlayerInfo.CarInfo.WheelsInfo.RearRight.TyreCoreTemperature.ActualQuantity = Temperature.FromCelsius((data.TireTemp.RearRight.CurrentTemp.Left + data.TireTemp.RearRight.CurrentTemp.Center + data.TireTemp.RearRight.CurrentTemp.Right) / 3);

            // Fuel System
            simData.PlayerInfo.CarInfo.FuelSystemInfo.FuelCapacity  = Volume.FromLiters(data.FuelCapacity);
            simData.PlayerInfo.CarInfo.FuelSystemInfo.FuelRemaining = Volume.FromLiters(data.FuelLeft);
            simData.PlayerInfo.CarInfo.FuelSystemInfo.FuelPressure  = Pressure.FromKiloPascals(data.FuelPressure);
        }
示例#13
0
 public DriverInfo()
 {
     WorldPosition = new Point3D();
     Speed         = Velocity.FromMs(0);
 }
 public SuspensionVelocityHistogram()
 {
     Minimum  = Velocity.FromMs(-0.2);
     Maximum  = Velocity.FromMs(0.2);
     BandSize = Velocity.FromMs(0.005);
 }
示例#15
0
 public WheelPropertiesDto()
 {
     BumpTransition    = Velocity.FromMs(0.030);
     ReboundTransition = Velocity.FromMs(-0.030);
     IdealCamber       = Angle.GetFromDegrees(0);
 }