Forum Discussion

adaoduque's avatar
2 years ago
Solved

F1 23 gap calculation

Hello everyone, I'm having trouble correctly calculating the GAP of the current lap to the previous lap.

I collected the telemetry data:

Lap time: (Current lap time milliseconds)
Speed: (Current speed km/h)
Lap Distance: (Distance vehicle is around current lap in meters)
Last Lap Time: (Last lap time milliseconds)
Track length: (sector 1 or sector1+sector2 or sector1+sector2+sector3..)

I am calculating with the following formula:
speedMedia = (trackLength/(lapTime/1000))
estimateTime = lapDistance/speedMedia
gap = ((lapTime/1000)-(estimateTime/1000)-(lastLapTime/1000))*1000


Sector1 Test:
Lap time: 18493
Speed: 316
Lap Distance: 1165.7295
Last Lap Time: 17941
Track length: 1167 (Sector1)
Gap: ~ 0.533

Now, vehicle open sector 2:
Test:
Lap time: 18512
Speed: 316
Lap Distance: 1168,0742
Last Lap Time: 56074
Track length: 3113(Sector1+sector2)
Gap: ~ -37.568  ????

This gap (-37.568) is wrong.

Anyone know how to calculate correctly this gap, keep in mind, i don't want you to do my work, but i want to understand all of the formula to calculate correctly.

Any comment, technical article or link is very useful.

Regards

  • Okay, I haven't done this, so I am just talking from how I would try it first time. And I am aware that it introduces considerable error. I'll use examples from your table lap2 and lap3, at lap3 distance of 8.

    Values that are used are lap3time=93, lap3distance=8, lap2time=(66+93)/2=79.5 (as they are closest to lapdistance of 8 on lap2) and this is where error is introduced. So, lap3 would be +0.013 compared to lap2

    Another example for laps 2 and 3, from your full table, at lap3distance=100. Values are: lap3time=1148, lap2time=1081. So lap3 would be -0.067.

    lap3distance=1002, Values are: lap3time=16019, lap2time=(16565+16591)/2=16578. So lap3 is -0.559

    There are for sure better and more precise ways to do it and I am not sure how big is error without comparing it during lap with what game shows. Looking at speed in these laps it should be correct that lap3 is faster, but even with speed in first meters I would expect it to be faster, which it is not as seen in first example.

4 Replies

  • XanderSjx's avatar
    XanderSjx
    Seasoned Newcomer
    2 years ago

    Hi, in second part when you enter sector 2. Your current laptime is the moment of entry in sector 2. But last laptime looks like time at the end of sector 2. That is why you get minus value. There are some better ways to calculate, but first thing that comes to mind is that you need to have sort of lookup table for previous lap, where each lapdistance has assigned laptime. So then, during new lap you compare current laptime with previous laptime that coresponds to lapdisstance (from lookup table) closest to currentLapDistance.

  • Hi @XanderSjx, i appreciate your answer, thank you.

    I have a lookup table, but the "checkpoint" (time or distance) is not the same every lap.

    First data in my lookup table:

    Lap2-lapTimeLap2-speedLap2-lapDistance Lap3-lapTimeLap3-speedLap3-lapDistance Lap4-lapTimeLap4-speedLap4-lapDistance
    133292 133121 143372
    403294 403124 313374
    533296 533125 683377
    663297 803127 863389
    933299 933128 12033812
    10633011 12031211 20833820
    13332913 13331212 22233821
    14632914 14631213 24933824

    Full lookup table: https://docs.google.com/spreadsheets/d/1u-mcqNITrFZPVUao7WcgWlv4kEmUvILVeQ23bbg8FY0/edit?usp=sharing


    Thanks in advance.


  • XanderSjx's avatar
    XanderSjx
    Seasoned Newcomer
    2 years ago

    Okay, I haven't done this, so I am just talking from how I would try it first time. And I am aware that it introduces considerable error. I'll use examples from your table lap2 and lap3, at lap3 distance of 8.

    Values that are used are lap3time=93, lap3distance=8, lap2time=(66+93)/2=79.5 (as they are closest to lapdistance of 8 on lap2) and this is where error is introduced. So, lap3 would be +0.013 compared to lap2

    Another example for laps 2 and 3, from your full table, at lap3distance=100. Values are: lap3time=1148, lap2time=1081. So lap3 would be -0.067.

    lap3distance=1002, Values are: lap3time=16019, lap2time=(16565+16591)/2=16578. So lap3 is -0.559

    There are for sure better and more precise ways to do it and I am not sure how big is error without comparing it during lap with what game shows. Looking at speed in these laps it should be correct that lap3 is faster, but even with speed in first meters I would expect it to be faster, which it is not as seen in first example.

  • You're right.

    Finding the distance of the current lap (lap 3) in the lookup table for the previous lap (lap 2) worked perfectly.

    Now I have the gap without absurd distortions.

    You helped me a lot, thank you very much.

About F1® 23

Join the community forums and talk with us about your experiences in F1® 23.4,617 PostsLatest Activity: 9 months ago