mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-25 20:32:07 +08:00
the
This commit is contained in:
@@ -132,6 +132,7 @@ struct OnroadEvent @0xc4fa6047f024e718 {
|
||||
userBookmark @95;
|
||||
excessiveActuation @96;
|
||||
audioFeedback @97;
|
||||
wgpuModeldLagging @100;
|
||||
|
||||
soundsUnavailableDEPRECATED @47;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"UsbGpuPresent", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}},
|
||||
{"UsbGpuCompiled", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}},
|
||||
{"Version", {PERSISTENT, STRING}},
|
||||
{"WgpuBenchMode", {CLEAR_ON_MANAGER_START | CLEAR_ON_IGNITION_ON | DEVELOPMENT_ONLY, BOOL}},
|
||||
{"WgpuEnabled", {CLEAR_ON_MANAGER_START | DEVELOPMENT_ONLY, BOOL}},
|
||||
|
||||
// --- sunnypilot params --- //
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import math
|
||||
import os
|
||||
import time
|
||||
|
||||
from openpilot.cereal import log
|
||||
from opendbc.car.structs import car
|
||||
@@ -190,6 +191,13 @@ def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
|
||||
return NormalPermanentAlert("Driving Model Lagging", f"{sm['modelV2'].frameDropPerc:.1f}% frames dropped")
|
||||
|
||||
|
||||
def wgpu_modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool,
|
||||
soft_disable_time: int, personality) -> Alert:
|
||||
model_age_ms = max(0., (time.monotonic_ns() - sm['modelV2'].timestampEof) / 1e6)
|
||||
return NormalPermanentAlert("WGPU Model Lagging",
|
||||
f"{model_age_ms:.0f} ms old · {sm['modelV2'].frameDropPerc:.1f}% frames dropped")
|
||||
|
||||
|
||||
def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
||||
gb = sm['carControl'].actuators.accel / 4.
|
||||
steer = sm['carControl'].actuators.torque
|
||||
@@ -722,6 +730,9 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
ET.NO_ENTRY: NoEntryAlert("Driving Model Lagging"),
|
||||
ET.PERMANENT: modeld_lagging_alert,
|
||||
},
|
||||
EventName.wgpuModeldLagging: {
|
||||
ET.PERMANENT: wgpu_modeld_lagging_alert,
|
||||
},
|
||||
|
||||
# Besides predicting the path, lane lines and lead car data the model also
|
||||
# predicts the current velocity and rotation speed of the car. If the model is
|
||||
|
||||
@@ -111,6 +111,8 @@ class SelfdriveD(CruiseHelper):
|
||||
self.is_metric = self.params.get_bool("IsMetric")
|
||||
self.is_ldw_enabled = self.params.get_bool("IsLdwEnabled")
|
||||
self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator")
|
||||
self.wgpu_enabled = self.params.get_bool("WgpuEnabled")
|
||||
self.wgpu_bench_mode = self.params.get_bool("WgpuBenchMode")
|
||||
|
||||
car_recognized = self.CP.brand != 'mock'
|
||||
|
||||
@@ -469,7 +471,7 @@ class SelfdriveD(CruiseHelper):
|
||||
# TODO: fix simulator
|
||||
if not SIMULATION or REPLAY:
|
||||
if self.sm['modelV2'].frameDropPerc > 1:
|
||||
self.events.add(EventName.modeldLagging)
|
||||
self.events.add(EventName.wgpuModeldLagging if self.wgpu_enabled and self.wgpu_bench_mode else EventName.modeldLagging)
|
||||
|
||||
# mute canBusMissing event if in Park, as it sometimes may trigger a false alarm with MADS in Paused state
|
||||
if CS.gearShifter == car.CarState.GearShifter.park and self.mads.enabled:
|
||||
@@ -625,6 +627,8 @@ class SelfdriveD(CruiseHelper):
|
||||
self.is_metric = self.params.get_bool("IsMetric")
|
||||
self.is_ldw_enabled = self.params.get_bool("IsLdwEnabled")
|
||||
self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator")
|
||||
self.wgpu_enabled = self.params.get_bool("WgpuEnabled")
|
||||
self.wgpu_bench_mode = self.params.get_bool("WgpuBenchMode")
|
||||
self.experimental_mode = self.params.get_bool("ExperimentalMode") and self.CP.openpilotLongitudinalControl
|
||||
self.personality = self.params.get("LongitudinalPersonality", return_default=True)
|
||||
|
||||
|
||||
@@ -57,3 +57,20 @@ Add `--big-model` after `COMMA_IP` to use the locally compiled big model.
|
||||
|
||||
The first remote `carParams` packet can take up to 50 seconds. Stop either side
|
||||
with Ctrl+C. Stop the device helper before changing branches or rebooting.
|
||||
|
||||
For stationary bench testing only, model lag can be changed from a blocking
|
||||
event to a live warning showing model age and dropped frames. After ignition is
|
||||
on and manager is running, enable the temporary override on the device:
|
||||
|
||||
```sh
|
||||
cd /data/openpilot
|
||||
python3 -c 'from openpilot.common.params import Params; Params().put_bool("WgpuBenchMode", True)'
|
||||
```
|
||||
|
||||
The override requires `WgpuEnabled` and clears on manager restart or the next
|
||||
ignition-on transition. Disable it immediately with:
|
||||
|
||||
```sh
|
||||
cd /data/openpilot
|
||||
python3 -c 'from openpilot.common.params import Params; Params().remove("WgpuBenchMode")'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user