only store the last 10 speeds like score history

This commit is contained in:
Josh Hawkins 2024-12-22 16:08:24 -06:00
parent 8d74e7b3ae
commit eaf362b424

View File

@ -209,6 +209,9 @@ class TrackedObject:
)
if self.active:
# only keep the last 10 speeds
if len(self.speed_history) > 10:
self.speed_history = self.speed_history[-10:]
self.speed_history.append(self.current_estimated_speed)
self.average_estimated_speed = sum(self.speed_history) / len(
self.speed_history