~bosco/race_replay

Web app to replay sailboat NMEA data
edf8692b — Ryan Tolboom 2 years ago
Updated requirements.txt
041fb3fd — Ryan Tolboom 2 years ago
Added timing logic
483211b9 — Ryan Tolboom 2 years ago
Responsivness fixes

refs

main
browse  log 

clone

read-only
https://git.sr.ht/~bosco/race_replay
read/write
git@git.sr.ht:~bosco/race_replay

You can also use your local clone with git send-email.

#Race Replay

#Weird Time Offsets

All NMEA sentences should be reporting times in UTC, but they seem to be shifted by a weird offset from the actual time. Since most time calculations are relative (how long was this race, how longs was this leg, etc.) in practice it doesn't make a huge difference. The JS side of the code uses timestamps in UTC milliseconds since the UNIX epoch.

#Finding Start and End Times

The following algorithm is used to approximate the start line:

  • Start at the first data point
  • Travel forward through points until you are within the threshold distance of a marker that isn't CM
  • This is the first mark of the course
  • Set the line such that it is orthogonal to the line from CM to the first mark (line is given as two other mark locations on the Olympic circle)

To determine the start time:

  • Travel forward through points until you hit the first mark
  • Calculate the sign of the displacement to the line
  • Travel backwards through points until the sign of displacement to the line changes
  • This is the start

To determine the end time:

  • Travel backwards through points from the last point recorded until you hit the last mark
  • Calculate the sign of the displacement to the line
  • Travel forwards through points until the sign of displacement to the line changes
  • This is the end (my only friend, the end)

Using this and calculating the total time of the 2022-08-03 race yielded a result within 10 s of the result reported by the race committee.

#Calculating Rounding Times and Leg Times

Once the boat is within BUOY_THRESHOLD (0.05 nm) of a mark, the absolute change in heading between points (mod 180) is monitored. Once a change in heading is greater than TURN_THRESHOLD (20 degrees) the boat is considered to be rounding a mark. Once the change in heading is less than TURN_THRESHOLD the boat is considered to be done rounding a mark.

Rounding times and leg times are shown in the analysis output.