From bcd69adc334bed084aec90a3f640b1e1b2c7a30c Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 29 Sep 2022 11:02:27 -0700 Subject: [PATCH] UI: remove imu tap detection (#25924) old-commit-hash: 391780551a362faf9c6c290d47313583d14aa594 --- selfdrive/ui/ui.cc | 32 ++------------------------------ selfdrive/ui/ui.h | 2 +- 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index b9fdaf329e..fcee00d1c8 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -162,21 +162,6 @@ static void update_state(UIState *s) { if (sm.updated("carParams")) { scene.longitudinal_control = sm["carParams"].getCarParams().getOpenpilotLongitudinalControl(); } - if (!scene.started && sm.updated("sensorEvents")) { - for (auto sensor : sm["sensorEvents"].getSensorEvents()) { - if (sensor.which() == cereal::SensorEventData::ACCELERATION) { - auto accel = sensor.getAcceleration().getV(); - if (accel.totalSize().wordCount) { // TODO: sometimes empty lists are received. Figure out why - scene.accel_sensor = accel[2]; - } - } else if (sensor.which() == cereal::SensorEventData::GYRO_UNCALIBRATED) { - auto gyro = sensor.getGyroUncalibrated().getV(); - if (gyro.totalSize().wordCount) { - scene.gyro_sensor = gyro[1]; - } - } - } - } if (sm.updated("wideRoadCameraState")) { scene.light_sensor = 100.0f - sm["wideRoadCameraState"].getWideRoadCameraState().getExposureValPercent(); } @@ -221,7 +206,7 @@ void UIState::updateStatus() { UIState::UIState(QObject *parent) : QObject(parent) { sm = std::make_unique>({ "modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", "roadCameraState", - "pandaStates", "carParams", "driverMonitoringState", "sensorEvents", "carState", "liveLocationKalman", + "pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "wideRoadCameraState", "managerState", "navInstruction", "navRoute", "gnssMeasurements", }); @@ -304,24 +289,11 @@ void Device::updateBrightness(const UIState &s) { } } -bool Device::motionTriggered(const UIState &s) { - static float accel_prev = 0; - static float gyro_prev = 0; - - bool accel_trigger = abs(s.scene.accel_sensor - accel_prev) > 0.2; - bool gyro_trigger = abs(s.scene.gyro_sensor - gyro_prev) > 0.15; - - gyro_prev = s.scene.gyro_sensor; - accel_prev = (accel_prev * (accel_samples - 1) + s.scene.accel_sensor) / accel_samples; - - return (!awake && accel_trigger && gyro_trigger); -} - void Device::updateWakefulness(const UIState &s) { bool ignition_just_turned_off = !s.scene.ignition && ignition_on; ignition_on = s.scene.ignition; - if (ignition_just_turned_off || motionTriggered(s)) { + if (ignition_just_turned_off) { resetInteractiveTimout(); } else if (interactive_timeout > 0 && --interactive_timeout == 0) { emit interactiveTimout(); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index b4ec900eef..887b7ee841 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -100,7 +100,7 @@ typedef struct UIScene { // lead QPointF lead_vertices[2]; - float light_sensor, accel_sensor, gyro_sensor; + float light_sensor; bool started, ignition, is_metric, map_on_left, longitudinal_control, end_to_end_long; uint64_t started_frame; } UIScene;