mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 11:23:49 +08:00
PathEdge cleanup
This commit is contained in:
@@ -76,6 +76,7 @@ class ModelRenderer(Widget):
|
||||
self._adjacent_path_vertices = [np.empty((0, 2), dtype=np.float32), np.empty((0, 2), dtype=np.float32)]
|
||||
# Outer path polygon for edge rendering
|
||||
self._track_edge_vertices = np.empty((0, 2), dtype=np.float32)
|
||||
self._path_edge_width = 0.0
|
||||
|
||||
# Initialize ModelPoints objects
|
||||
self._path = ModelPoints()
|
||||
@@ -254,6 +255,8 @@ class ModelRenderer(Widget):
|
||||
else:
|
||||
path_width *= 0.50
|
||||
|
||||
self._path_edge_width = path_width * path_edge_width_pct
|
||||
|
||||
unclipped_max_distance = np.clip(path_x_array[-1], MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE)
|
||||
unclipped_max_idx = self._get_path_length_idx(self._lane_lines[0].raw_points[:, 0], unclipped_max_distance)
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ class StarPilotOnroadView(AugmentedRoadView):
|
||||
mr = self.model_renderer
|
||||
|
||||
if mr._path.projected_points.size:
|
||||
# Path edges (always rendered if track_edge_vertices exist)
|
||||
if mr._track_edge_vertices.size >= 4:
|
||||
# The default path-edge width is zero, which produces no visible strip.
|
||||
if mr._path_edge_width > 0.0 and mr._track_edge_vertices.size >= 4:
|
||||
render_path_edges(mr)
|
||||
|
||||
# Render adjacent lanes (incorporates both adjacent path and blind spot warnings)
|
||||
|
||||
@@ -51,6 +51,7 @@ def _load_starpilot_onroad_view(monkeypatch):
|
||||
dummy_widget = type("DummyWidget", (), {})
|
||||
color = SimpleNamespace(r=0, g=0, b=0, a=255)
|
||||
|
||||
stub_module("openpilot.selfdrive.ui.onroad.starpilot.pip_sidecam", PipSideCamera=dummy_widget)
|
||||
stub_module("openpilot.selfdrive.ui.onroad.augmented_road_view", AugmentedRoadView=AugmentedRoadView)
|
||||
stub_module(
|
||||
"openpilot.selfdrive.ui.onroad.starpilot.starpilot_border",
|
||||
@@ -192,6 +193,7 @@ def test_starpilot_road_overlays_use_the_parent_scissor(monkeypatch):
|
||||
view.model_renderer = SimpleNamespace(
|
||||
_path=SimpleNamespace(projected_points=SimpleNamespace(size=1)),
|
||||
_track_edge_vertices=SimpleNamespace(size=4),
|
||||
_path_edge_width=0.3,
|
||||
)
|
||||
view._font_bold = object()
|
||||
view._get_border_width = lambda: 0
|
||||
@@ -209,3 +211,9 @@ def test_starpilot_road_overlays_use_the_parent_scissor(monkeypatch):
|
||||
view._render_extra_road_overlays(object())
|
||||
|
||||
assert events == ["path_edges", "adjacent_lanes", "stopping_point"]
|
||||
|
||||
events.clear()
|
||||
view.model_renderer._path_edge_width = 0.0
|
||||
view._render_extra_road_overlays(object())
|
||||
|
||||
assert events == ["adjacent_lanes", "stopping_point"]
|
||||
|
||||
Reference in New Issue
Block a user