|
|
|
@ -4,7 +4,6 @@ from dataclasses import dataclass |
|
|
|
|
from openpilot.selfdrive.ui.ui_state import ui_state, UI_BORDER_SIZE |
|
|
|
|
from openpilot.system.ui.lib.application import gui_app |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Default 3D coordinates for face keypoints as a NumPy array |
|
|
|
|
DEFAULT_FACE_KPTS_3D = np.array([ |
|
|
|
|
[-5.98, -51.20, 8.00], [-17.64, -49.14, 8.00], [-23.81, -46.40, 8.00], [-29.98, -40.91, 8.00], |
|
|
|
@ -31,6 +30,7 @@ SCALES_NEG = np.array([0.7, 0.4, 0.4], dtype=np.float32) |
|
|
|
|
ARC_POINT_COUNT = 37 # Number of points in the arc |
|
|
|
|
ARC_ANGLES = np.linspace(0.0, np.pi, ARC_POINT_COUNT, dtype=np.float32) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass |
|
|
|
|
class ArcData: |
|
|
|
|
"""Data structure for arc rendering parameters.""" |
|
|
|
@ -40,6 +40,7 @@ class ArcData: |
|
|
|
|
height: float |
|
|
|
|
thickness: float |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DriverStateRenderer: |
|
|
|
|
def __init__(self): |
|
|
|
|
# Initial state with NumPy arrays |
|
|
|
@ -114,7 +115,7 @@ class DriverStateRenderer: |
|
|
|
|
def _update_state(self, sm, rect): |
|
|
|
|
"""Update the driver monitoring state based on model data""" |
|
|
|
|
if not sm.updated["driverMonitoringState"]: |
|
|
|
|
if self.state_updated and (rect.x != self.last_rect.x or rect.y != self.last_rect.y or \ |
|
|
|
|
if self.state_updated and (rect.x != self.last_rect.x or rect.y != self.last_rect.y or |
|
|
|
|
rect.width != self.last_rect.width or rect.height != self.last_rect.height): |
|
|
|
|
self._pre_calculate_drawing_elements(rect) |
|
|
|
|
return |
|
|
|
|