From c9e2c38f9119f639f086ade03b8e666e370e8256 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Fri, 19 Jun 2020 14:11:23 -0700 Subject: [PATCH] Only show gps event after 1 km (#1747) old-commit-hash: 24de8174dcb59fea10402060b8dd1db6ecdaf0f5 --- selfdrive/controls/controlsd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index c078b3c4b6..37b7e802d6 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -128,6 +128,7 @@ class Controls: self.can_error_counter = 0 self.last_blinker_frame = 0 self.saturated_count = 0 + self.distance_traveled = 0 self.events_prev = [] self.current_alert_types = [] @@ -213,8 +214,9 @@ class Controls: if not self.sm['liveLocationKalman'].inputsOK and os.getenv("NOSENSOR") is None: if self.sm.frame > 5 / DT_CTRL: # Give locationd some time to receive all the inputs self.events.add(EventName.sensorDataInvalid) - if not self.sm['liveLocationKalman'].gpsOK and os.getenv("NOSENSOR") is None: - self.events.add(EventName.noGps) + if not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000) and os.getenv("NOSENSOR") is None: + # Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes + self.events.add(EventName.noGps) if not self.sm['pathPlan'].paramsValid: self.events.add(EventName.vehicleModelInvalid) if not self.sm['liveLocationKalman'].posenetOK: @@ -259,6 +261,8 @@ class Controls: if not self.sm['health'].controlsAllowed and self.enabled: self.mismatch_counter += 1 + self.distance_traveled += CS.vEgo * DT_CTRL + return CS def state_transition(self, CS):