Esempio n. 1
0
 public void CheckMyApex(uint frame, CarTelemetryData data)
 {
     lock (locker)
     {
         lastCarTelemetryData = data;
         lastTelemetryFrame = frame;
         CheckMyApex();
     }
 }
Esempio n. 2
0
 internal void AddTelemetryData(int lapNumber, PacketHeader context, CarTelemetryData carTelemetryData)
 {
     if (currentLapIndex == lapNumber)
     {
         GetLap(lapNumber).lapTelemetry.Add(new TelemetryInContext()
         {
             context = context, carTelemetry = carTelemetryData
         });
         lastTelemetry = carTelemetryData;
     }
 }
Esempio n. 3
0
        internal void AnalyzeApex(LapData lapData, CarTelemetryData carTelemetryData, CarMotionData motionData)
        {
            var nextSpeed = carTelemetryData.speed;
            if ((lastSpeed < 50 || lastSpeed > 230) && (nextSpeed < 50 || nextSpeed > 230))
            {
                // ignore
                Breaking = -1;
                return;
            }
            
           
            lock (Locker)
            {
                var m = motionData;
                var t = carTelemetryData;
                var l = lapData;
                var distance = (int)Math.Round(l.lapDistance, 0);

                if (Breaking == -1 && t.brake > 0 && l.lapDistance > 0)
                {
                    Breaking = l.lapDistance;
                    BreakingSpeed = t.speed;
                    lastCandidate = -1;
                }
                else if (Breaking > 0 && t.speed > 0 && t.brake == 0 && t.throttle > 0.2f)
                {
                    if (lastCandidate == -1)
                    {
                        lastCandidate = l.lapDistance;
                        ApexSpeed = t.speed;
                    }
                }
                
                if (Breaking!=-1 && BreakingSpeed - ApexSpeed > 50 && lastCandidate > 0 && (t.speed - ApexSpeed)> 10)
                {
                    AddApex((int)Math.Round(lastCandidate, 0));
                    Breaking = -1;
                }
            }
            lastSpeed = nextSpeed;
        }