diff --git a/selfdrive/ui/qt/onroad/alerts.cc b/selfdrive/ui/qt/onroad/alerts.cc index d5d2e6c0de..0236e20f16 100644 --- a/selfdrive/ui/qt/onroad/alerts.cc +++ b/selfdrive/ui/qt/onroad/alerts.cc @@ -19,34 +19,34 @@ void OnroadAlerts::clear() { } OnroadAlerts::Alert OnroadAlerts::getAlert(const SubMaster &sm, uint64_t started_frame) { - const cereal::SelfdriveState::Reader &cs = sm["selfdriveState"].getSelfdriveState(); - const uint64_t controls_frame = sm.rcv_frame("selfdriveState"); + const cereal::SelfdriveState::Reader &ss = sm["selfdriveState"].getSelfdriveState(); + const uint64_t selfdrive_frame = sm.rcv_frame("selfdriveState"); Alert a = {}; - if (controls_frame >= started_frame) { // Don't get old alert. - a = {cs.getAlertText1().cStr(), cs.getAlertText2().cStr(), - cs.getAlertType().cStr(), cs.getAlertSize(), cs.getAlertStatus()}; + if (selfdrive_frame >= started_frame) { // Don't get old alert. + a = {ss.getAlertText1().cStr(), ss.getAlertText2().cStr(), + ss.getAlertType().cStr(), ss.getAlertSize(), ss.getAlertStatus()}; } if (!sm.updated("selfdriveState") && (sm.frame - started_frame) > 5 * UI_FREQ) { - const int CONTROLS_TIMEOUT = 5; - const int controls_missing = (nanos_since_boot() - sm.rcv_time("selfdriveState")) / 1e9; + const int SELFDRIVE_STATE_TIMEOUT = 5; + const int ss_missing = (nanos_since_boot() - sm.rcv_time("selfdriveState")) / 1e9; - // Handle controls timeout - if (controls_frame < started_frame) { + // Handle selfdrive timeout + if (selfdrive_frame < started_frame) { // car is started, but selfdriveState hasn't been seen at all - a = {tr("openpilot Unavailable"), tr("Waiting for controls to start"), - "controlsWaiting", cereal::SelfdriveState::AlertSize::MID, + a = {tr("openpilot Unavailable"), tr("Waiting to start"), + "selfdriveWaiting", cereal::SelfdriveState::AlertSize::MID, cereal::SelfdriveState::AlertStatus::NORMAL}; - } else if (controls_missing > CONTROLS_TIMEOUT && !Hardware::PC()) { - // car is started, but controls is lagging or died - if (cs.getEnabled() && (controls_missing - CONTROLS_TIMEOUT) < 10) { - a = {tr("TAKE CONTROL IMMEDIATELY"), tr("Controls Unresponsive"), - "controlsUnresponsive", cereal::SelfdriveState::AlertSize::FULL, + } else if (ss_missing > SELFDRIVE_STATE_TIMEOUT && !Hardware::PC()) { + // car is started, but selfdrive is lagging or died + if (ss.getEnabled() && (ss_missing - SELFDRIVE_STATE_TIMEOUT) < 10) { + a = {tr("TAKE CONTROL IMMEDIATELY"), tr("System Unresponsive"), + "selfdriveUnresponsive", cereal::SelfdriveState::AlertSize::FULL, cereal::SelfdriveState::AlertStatus::CRITICAL}; } else { - a = {tr("Controls Unresponsive"), tr("Reboot Device"), - "controlsUnresponsivePermanent", cereal::SelfdriveState::AlertSize::MID, + a = {tr("System Unresponsive"), tr("Reboot Device"), + "selfdriveUnresponsivePermanent", cereal::SelfdriveState::AlertSize::MID, cereal::SelfdriveState::AlertStatus::NORMAL}; } } diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index cc9940f275..b538f19dde 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -25,13 +25,13 @@ void AnnotatedCameraWidget::updateState(const UIState &s) { const int SET_SPEED_NA = 255; const SubMaster &sm = *(s.sm); - const bool cs_alive = sm.alive("controlsState"); + const bool cs_alive = sm.alive("carState"); const auto cs = sm["controlsState"].getControlsState(); const auto car_state = sm["carState"].getCarState(); is_metric = s.scene.is_metric; - // Handle older routes where vCruiseCluster is not set + // Handle older routes where vCruise was in controlsState float v_cruise = car_state.getVCruiseCluster() == 0.0 ? cs.getVCruiseDEPRECATED() : car_state.getVCruiseCluster(); setSpeed = cs_alive ? v_cruise : SET_SPEED_NA; is_cruise_set = setSpeed > 0 && (int)setSpeed != SET_SPEED_NA; diff --git a/selfdrive/ui/soundd.py b/selfdrive/ui/soundd.py index 4055fcfd35..3cd6ae5820 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -17,7 +17,7 @@ SAMPLE_RATE = 48000 SAMPLE_BUFFER = 4096 # (approx 100ms) MAX_VOLUME = 1.0 MIN_VOLUME = 0.1 -CONTROLS_TIMEOUT = 5 # 5 seconds +SELFDRIVE_STATE_TIMEOUT = 5 # 5 seconds FILTER_DT = 1. / (micd.SAMPLE_RATE / micd.FFT_SAMPLES) AMBIENT_DB = 30 # DB where MIN_VOLUME is applied @@ -40,11 +40,11 @@ sound_list: dict[int, tuple[str, int | None, float]] = { AudibleAlert.warningImmediate: ("warning_immediate.wav", None, MAX_VOLUME), } -def check_controls_timeout_alert(sm): - controls_missing = time.monotonic() - sm.recv_time['selfdriveState'] +def check_selfdrive_timeout_alert(sm): + ss_missing = time.monotonic() - sm.recv_time['selfdriveState'] - if controls_missing > CONTROLS_TIMEOUT: - if sm['selfdriveState'].enabled and (controls_missing - CONTROLS_TIMEOUT) < 10: + if ss_missing > SELFDRIVE_STATE_TIMEOUT: + if sm['selfdriveState'].enabled and (ss_missing - SELFDRIVE_STATE_TIMEOUT) < 10: return True return False @@ -58,7 +58,7 @@ class Soundd: self.current_volume = MIN_VOLUME self.current_sound_frame = 0 - self.controls_timeout_alert = False + self.selfdrive_timeout_alert = False self.spl_filter_weighted = FirstOrderFilter(0, 2.5, FILTER_DT, initialized=False) @@ -114,12 +114,12 @@ class Soundd: if sm.updated['selfdriveState']: new_alert = sm['selfdriveState'].alertSound.raw self.update_alert(new_alert) - elif check_controls_timeout_alert(sm): + elif check_selfdrive_timeout_alert(sm): self.update_alert(AudibleAlert.warningImmediate) - self.controls_timeout_alert = True - elif self.controls_timeout_alert: + self.selfdrive_timeout_alert = True + elif self.selfdrive_timeout_alert: self.update_alert(AudibleAlert.none) - self.controls_timeout_alert = False + self.selfdrive_timeout_alert = False def calculate_volume(self, weighted_db): volume = ((weighted_db - AMBIENT_DB) / DB_SCALE) * (MAX_VOLUME - MIN_VOLUME) + MIN_VOLUME diff --git a/selfdrive/ui/tests/test_soundd.py b/selfdrive/ui/tests/test_soundd.py index f40af8696a..a9da8455eb 100644 --- a/selfdrive/ui/tests/test_soundd.py +++ b/selfdrive/ui/tests/test_soundd.py @@ -1,7 +1,7 @@ from cereal import car from cereal import messaging from cereal.messaging import SubMaster, PubMaster -from openpilot.selfdrive.ui.soundd import CONTROLS_TIMEOUT, check_controls_timeout_alert +from openpilot.selfdrive.ui.soundd import SELFDRIVE_STATE_TIMEOUT, check_selfdrive_timeout_alert import time @@ -9,7 +9,7 @@ AudibleAlert = car.CarControl.HUDControl.AudibleAlert class TestSoundd: - def test_check_controls_timeout_alert(self): + def test_check_selfdrive_timeout_alert(self): sm = SubMaster(['selfdriveState']) pm = PubMaster(['selfdriveState']) @@ -23,13 +23,13 @@ class TestSoundd: sm.update(0) - assert not check_controls_timeout_alert(sm) + assert not check_selfdrive_timeout_alert(sm) - for _ in range(CONTROLS_TIMEOUT * 110): + for _ in range(SELFDRIVE_STATE_TIMEOUT * 110): sm.update(0) time.sleep(0.01) - assert check_controls_timeout_alert(sm) + assert check_selfdrive_timeout_alert(sm) # TODO: add test with micd for checking that soundd actually outputs sounds diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index 0116f3c152..ebfcd1ec0b 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -418,22 +418,22 @@ openpilot Unavailable openpilot غير متوفر - - Waiting for controls to start - في انتظار بدء عناصر التحكم - TAKE CONTROL IMMEDIATELY تحكم على الفور - - Controls Unresponsive - الضوابط غير مستجيبة - Reboot Device إعادة التشغيل + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index 48180eef92..4e8bbe0a18 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -413,20 +413,20 @@ openpilot Unavailable - - Waiting for controls to start - - TAKE CONTROL IMMEDIATELY - Controls Unresponsive + Reboot Device - Reboot Device + Waiting to start + + + + System Unresponsive diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index 150c00d117..083d2c25e1 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -414,22 +414,22 @@ openpilot Unavailable openpilot no disponible - - Waiting for controls to start - Esperando que los controles inicien - TAKE CONTROL IMMEDIATELY TOME CONTROL INMEDIATAMENTE - - Controls Unresponsive - Controles no responden - Reboot Device Reiniciar Dispositivo + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index a678742f74..16adcaa081 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -414,20 +414,20 @@ openpilot Unavailable - - Waiting for controls to start - - TAKE CONTROL IMMEDIATELY - Controls Unresponsive + Reboot Device - Reboot Device + Waiting to start + + + + System Unresponsive diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 096fa95091..daac99ce09 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -412,20 +412,20 @@ openpilot Unavailable - - Waiting for controls to start - - TAKE CONTROL IMMEDIATELY - Controls Unresponsive + Reboot Device - Reboot Device + Waiting to start + + + + System Unresponsive diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index df012d3e85..9541067119 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -413,22 +413,22 @@ openpilot Unavailable 오픈파일럿을 사용할수없습니다 - - Waiting for controls to start - 프로세스가 준비중입니다 - TAKE CONTROL IMMEDIATELY 핸들을 잡아주세요 - - Controls Unresponsive - 프로세스가 응답하지않습니다 - Reboot Device 장치를 재부팅하세요 + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index 1500f07e63..e92e7748b3 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -414,22 +414,22 @@ openpilot Unavailable openpilot Indisponível - - Waiting for controls to start - Aguardando controles para iniciar - TAKE CONTROL IMMEDIATELY ASSUMA IMEDIATAMENTE - - Controls Unresponsive - Controles Não Respondem - Reboot Device Reinicie o Dispositivo + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index bae326d532..d0dea811c6 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -413,22 +413,22 @@ openpilot Unavailable openpilot ไม่สามารถใช้งานได้ - - Waiting for controls to start - กำลังรอให้ controls เริ่มทำงาน - TAKE CONTROL IMMEDIATELY เข้าควบคุมรถเดี๋ยวนี้ - - Controls Unresponsive - Controls ไม่ตอบสนอง - Reboot Device รีบูตอุปกรณ์ + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 72148807d4..746425cb4e 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -412,20 +412,20 @@ openpilot Unavailable - - Waiting for controls to start - - TAKE CONTROL IMMEDIATELY - Controls Unresponsive + Reboot Device - Reboot Device + Waiting to start + + + + System Unresponsive diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index 976b58b31d..ec1884521b 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -413,22 +413,22 @@ openpilot Unavailable 无法使用 openpilot - - Waiting for controls to start - 等待控制服务啟動 - TAKE CONTROL IMMEDIATELY 立即接管 - - Controls Unresponsive - 控制服务无响应 - Reboot Device 重启设备 + + Waiting to start + + + + System Unresponsive + + PairingPopup diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index de8d3ff701..835a0af30f 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -413,22 +413,22 @@ openpilot Unavailable 無法使用 openpilot - - Waiting for controls to start - 等待操控服務開始 - TAKE CONTROL IMMEDIATELY 立即接管 - - Controls Unresponsive - 操控服務沒有反應 - Reboot Device 請重新啟裝置 + + Waiting to start + + + + System Unresponsive + + PairingPopup