diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 38a613b0e7..1e55e72ac4 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -61,6 +61,7 @@ class CarInterfaceBase(ABC): self.steering_unpressed = 0 self.low_speed_alert = False self.silent_steer_warning = True + self.v_ego_cluster_seen = False self.CS = None self.can_parsers = [] @@ -162,8 +163,10 @@ class CarInterfaceBase(ABC): ret.canValid = all(cp.can_valid for cp in self.can_parsers if cp is not None) ret.canTimeout = any(cp.bus_timeout for cp in self.can_parsers if cp is not None) - if ret.vEgoCluster == 0.0: + if ret.vEgoCluster == 0.0 and not self.v_ego_cluster_seen: ret.vEgoCluster = ret.vEgo + else: + self.v_ego_cluster_seen = True if ret.cruiseState.speedCluster == 0: ret.cruiseState.speedCluster = ret.cruiseState.speed @@ -321,7 +324,7 @@ class CarStateBase(ABC): def parse_gear_shifter(gear: Optional[str]) -> car.CarState.GearShifter: if gear is None: return GearShifter.unknown - + d: Dict[str, car.CarState.GearShifter] = { 'P': GearShifter.park, 'PARK': GearShifter.park, 'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse, diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 0ab1424023..4414e602e6 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -193,7 +193,13 @@ void NvgWindow::updateState(const UIState &s) { } // Handle older routes where vEgoCluster is not set - float v_ego = sm["carState"].getCarState().getVEgoCluster() == 0.0 ? sm["carState"].getCarState().getVEgo() : sm["carState"].getCarState().getVEgoCluster(); + float v_ego; + if (sm["carState"].getCarState().getVEgoCluster() == 0.0 && !v_ego_cluster_seen) { + v_ego = sm["carState"].getCarState().getVEgo(); + } else { + v_ego = sm["carState"].getCarState().getVEgoCluster(); + v_ego_cluster_seen = true; + } float cur_speed = cs_alive ? std::max(0.0, v_ego) : 0.0; cur_speed *= s.scene.is_metric ? MS_TO_KPH : MS_TO_MPH; diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 7f51a73510..25920ccc6a 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -66,6 +66,7 @@ private: bool rightHandDM = false; bool has_us_speed_limit = false; bool has_eu_speed_limit = false; + bool v_ego_cluster_seen = false; int status = STATUS_DISENGAGED; protected: diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index be0611f49a..555aa52fb8 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -490,30 +490,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX 最高速度 - - + + SPEED 速度 - - + + LIMIT 制限速度 diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 626373a955..65762e09db 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -490,30 +490,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX MAX - - + + SPEED SPEED - - + + LIMIT LIMIT diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index 02bda87829..1e9173395d 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -488,30 +488,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX 最高定速 - - + + SPEED SPEED - - + + LIMIT LIMIT diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index 0ea8e95f52..d8cebe2861 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -490,30 +490,30 @@ location set NvgWindow - + km/h km/h - + mph mph - - + + MAX 最高 - - + + SPEED 速度 - - + + LIMIT 速限