0

I am currently developing an app that calculates the time difference (in seconds) between the driver in front and behind of the current player.

I know the total distance driven by all cars, same with the distance driven that lap, lap distance, speed and X and Y coordinates on the track. Click here for the full list of data

With this information, I can some how know the time from the other two cars. How would I do this mathematically?

giusti
  • 145
iProgram
  • 103
  • If driver $A$ is behind driver $B$ then I think the best solution is to get a list of position and time data of driver $B$ over the past 10 or 20 seconds. Maybe the list looks like ${(x_0,t_0),(x_1,t_1),...}$ for position vectors $x_0,x_1,...$. Find the position $x_i$ in that list which is closest to $A$'s current position $y$ (a minimization problem). Find the corresponding time $t_i$ that $B$ was at position $x_i$ and subtract from the current time. That is approximately how long $A$ will take to reach $B$'s current position. –  Sep 04 '18 at 22:16
  • @M.Nestor I would need this data to be in real time. Would maybe 500ms still work? I will be getting a lot of data in that time. – iProgram Sep 04 '18 at 22:39
  • I think it will depend on how close the racers are. If it's a tight race, a small time frame like 500ms might work! –  Sep 04 '18 at 22:46
  • @M.Nestor see my answer to get it working. – iProgram Sep 05 '18 at 09:32

1 Answers1

0

As I am getting the data in real time, I only have to care about distance and speed.

By getting the distance driven of the car in front (e.g. FD = 100m) and the distance driven of the player (e.g PD = 50m) and the speed of the player speed (e.g. PS = 90m/s), I can then work out difference = FD-PD = 50m time delta = difference/PS = 50/90 = 0.5s.

Due to the data arriving in real time, there may be a small error with acceleration, however, there is such small error that it gives me results I expect.

iProgram
  • 103