Skip to content

[mock_uss] Better slow update check #1334

Open
the-glu wants to merge 2 commits intointeruss:mainfrom
Orbitalize:1330_faster_interval
Open

[mock_uss] Better slow update check #1334
the-glu wants to merge 2 commits intointeruss:mainfrom
Orbitalize:1330_faster_interval

Conversation

@the-glu
Copy link
Contributor

@the-glu the-glu commented Feb 11, 2026

Follow #1333

Improve slow update check in mock_uss by doing a proper slow update check.

This also make notification coming faster instead of having arbitrarily in the middle of the flight.

Idea is the following:

  • Compute average update rate with a moving window of 3 seconds.
  • Check for % of update rate bellow the required rate with a moving window of 10 (over the averages update rates)

Notifications are created for each "non-compliant bucket", and placed in time at the end of the bucket, making them more realistic. However, windows spans are quite arbitrary.

@the-glu the-glu force-pushed the 1330_faster_interval branch from 4f5c32c to df517da Compare February 11, 2026 12:49
@the-glu the-glu force-pushed the 1330_faster_interval branch from df517da to 0b59e5b Compare February 11, 2026 17:46

# Check in a moving windows of 10s, that NetMinUasLocRefreshPercentage
# samples are >= NetMinUasLocRefreshFrequency
if len(rates) < 10:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this value (10s window) is used in 4 places, it's important to understand exactly what it is, and we may want to change it, let's make it a constant defined and documented once and then used in all applicable places. We probably also want to type-annotate it as an int since a float value would not work even though conceptually it seems like that would be ok.

Comment on lines +252 to +259
current = start + datetime.timedelta(seconds=2)

while current < end:
bucket = int((current - start).total_seconds())
rates.append(
(buckets[bucket] + buckets[bucket - 1] + buckets[bucket - 2]) / 3.0
)
current += datetime.timedelta(seconds=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we've already quantized to buckets, wouldn't it be simpler to do this computation in that quantized frame?

Suggested change
current = start + datetime.timedelta(seconds=2)
while current < end:
bucket = int((current - start).total_seconds())
rates.append(
(buckets[bucket] + buckets[bucket - 1] + buckets[bucket - 2]) / 3.0
)
current += datetime.timedelta(seconds=1)
last_bucket = int((end - start).total_seconds())
bucket = 2
while bucket <= last_bucket:
rates.append(
(buckets[bucket] + buckets[bucket - 1] + buckets[bucket - 2]) / 3.0
)
bucket += 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants