Skip to content

Time 70mai clips logged without GPS time by the camera's clock - #991

Merged
caglarpir merged 2 commits into
mapillary:mainfrom
caglarpir:70mai-untimed-sessions
Dec 3, 2026
Merged

caglarpir merged 2 commits into
mapillary:mainfrom
caglarpir:70mai-untimed-sessions

Conversation

@caglarpir

@caglarpir caglarpir commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Some 70mai dashcams log whole sessions without the time of the GPS: their rows have positions, but the placeholder time -28801. In one sample log, 24 of 42 sessions are logged this way, 644 of its 759 clips, and those clips get no GPS.

Change

  • Such a clip is now timed by the camera's clock, as it is in the clip's name. The clock is set by the clips with GPS time in the logs:
    • For a clip that continues a recording and whose rows are all fixes, the first fix is its start. So the time in its name less that fix is how far the clock is ahead of UTC, once the 8-hour shift is applied if the log has it.
    • The median of the 5 such clips nearest by that clock is used, as the clock drifts seconds a day: 11–24 s over a week in one sample log, about 4 minutes over 7 months in another.
  • The camera writes rows at a steady rate whether it has a fix or not: every 1.5 s on one camera, every second on another. The same clips give the rate. Rows are placed at that rate from the start of the clip, or up to its end if the clip is the first after $V02 and its rows span much less than it, as for clips with GPS time.
  • Only clips with GPS time within 3 days of the clip by the camera's clock set it, which keeps the drift to about 15 s. In the sample log above, the 5th nearest is at most 11 hours from every clip. They must also agree within a minute: the 5 that set it, and the nearest before and after the clip. Otherwise the clip fails with a warning that says why, as after the clock was reset (to its 2021 default) or changed (as for summer time).
  • If the logs have no such clip, or the clip's name has no time, or the rows span more than the clip, the clip fails with a warning, as before.
  • Limit: a change of the clock with the clips with GPS time all on one side of it isn't noticed, and the clips on the other side are off by the change.
  • Clips with any row with GPS time are unchanged.
  • Command reference: a gotcha for such clips.

Rebased onto main after #974 and #990 were merged. A rear camera clip (#990) whose front clip was logged without GPS time gets the same points as the front clip.

Testing

  • Unit tests for a clip without GPS time:

    • with a log in UTC, and with one 8 hours behind;
    • the nearest clock, when the camera's clock drifts;
    • a clip at the start of a session;
    • no clip with GPS time;
    • rows that span more than the clip;
    • a clock reset to 2021, a clock set back an hour (clips with GPS time on both sides, or all before), and a name without a time, each failing with its own reason;
    • a clip whose first fix came late, at the start of a session or after rows without a fix, not setting the clock.

    Each test fails when its code path is broken.

  • On three sample logs from three cameras, sessions with GPS time were turned into sessions without it, and their clips were timed this way. Of 502 clips, 3 failed because their rows spanned more than the clip. For 95% of the rows, the time given is within 1.7 to 3.8 s of their GPS time, depending on the camera, and at most 7.1 s off.

  • All 644 clips without GPS time in the log above now get GPS. The camera's clock comes out 5 hours (UTC+5) less 11 to 24 s ahead of UTC, as in its sessions with GPS time, and the clips with GPS time around each clip agree within 7 s.

  • ruff, usort, and mypy on 3.9 and 3.13. Unit tests on 3.9 and 3.13, merged with main.

Some 70mai cameras log whole sessions without the time of the GPS: their rows
have positions, but the placeholder time -28801. In one sample log, 24 of 42
sessions are logged so, 644 of its 759 clips, which got no GPS.

The rows of such a clip are now timed by the camera's clock, as it is in the
name of the clip. The clock is set by the clips with GPS time in the logs: for
a clip that continues a recording and whose rows are all fixes, its first fix
is its start, so the time in its name less that fix is how far the clock is
ahead of UTC (with the clip's shift of 8 hours, if any). The median of the 5
such clips nearest by that clock is taken, as the clock drifts seconds a day.
The camera writes rows at a steady rate, a fix or not (every 1.5 seconds on
that camera, every second on another), which those clips give too. So the rows
are placed at that rate from the start of the clip, or up to its end if it is
the first clip after "$V02" and they span much less than it, as for clips with
GPS time. Without a clip with GPS time in the logs, or if the rows span more
than the clip, the clip fails with a warning, as before.

In all three sample logs, sessions with GPS time were turned into sessions
without it (-28801), and their clips timed this way: 502 clips, 3 of which
failed as their rows spanned more than the clip. For 95% of the rows, the time
given is within 1.7 to 3.8 seconds of their GPS time, depending on the camera,
and at most 7.1 seconds off. All 644 clips of the log above get GPS now, with
the camera's clock 5 hours (UTC+5) less 11 to 24 seconds ahead of UTC.
…hat agree

A clip without GPS time took the camera's clock from the 5 clips with GPS
time nearest to it by that clock, however far they were, and whether or not
they agreed. A clock reset to its default (the start of 2021) took clips
years away, and a clip came out dated 2020. A clock set back an hour between
the clips with GPS time and the clip took the old clock, and the clip came
out an hour early.

Only clips with GPS time within 3 days of the clip by the camera's clock now
set it. The clock drifts seconds a day, up to about 5 on the cameras seen, so
that keeps the drift to about 15 seconds; in the sample log with sessions
without GPS time, the 5th nearest is at most 11 hours from every clip. They
must also agree within a minute: the 5 that set it, and the nearest before
and after the clip by that clock. Otherwise the clip fails with a warning
that says why, as for a name without the time of the camera's clock. A change
of the clock with the clips with GPS time all on one side of it is still not
noticed, which the docstring and the command reference say.

All 644 clips without GPS time in that log still get GPS: the clips with GPS
time on both sides of each agree within 7 seconds.
@caglarpir
caglarpir force-pushed the 70mai-untimed-sessions branch from ec205be to 5f52fb8 Compare December 3, 2026 12:50
@caglarpir
caglarpir merged commit 6ac63df into mapillary:main Dec 3, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant