minolin / acplugins

R&D about the upcoming server plugin infrastrucure of Assetto Corsa, driving simulator by Kunos simulazioni
Apache License 2.0
18 stars 4 forks source link

Track length estimate via SplinePos #24

Closed minolin closed 9 years ago

minolin commented 9 years ago

What a nemesis to me. I tried to estimate the TrackLength, so we can just multiply this by a SplinePos difference and know the meters. A typical 5min-hack that consumed hours now.

First approach was to let the TrackLength float with the calculations until there is almost no error. Didn't work at all, highly oscilating results. Probably because of the 1Hz updates. Is the spline mid-track or race-line? Couldn't figure it out. Then I tried to sum meters driven and spline-differences, would always give vastly wrong spline sums. Now I calculate the estimated TrackLength per compared position (=CarUpdate) and divide by the count. At least sensible track lengths as result, but still very, very different. +-50%.

:(

Thomas, how would you do this? MR-Plugin.OnBulkCarUpdateFinished, is deactivated by && false)

flitzi commented 9 years ago

I've implemented a method to calculate the lap length for each lap driven, which is stored in LapInfo.LapLength. I've done only some tests, but it seems to work quite nicely. You could use Median of all LapLength to get a good value.