mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-31 21:23:49 +08:00
Visuals - Custom Alerts - Green light alert
Get an alert when a traffic light changes from red to green.
This commit is contained in:
@@ -32,7 +32,7 @@ from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
|
||||
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
|
||||
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import FrogPilotVariables
|
||||
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_variables import CRUISING_SPEED, FrogPilotVariables
|
||||
from openpilot.selfdrive.frogpilot.controls.lib.speed_limit_controller import SpeedLimitController
|
||||
|
||||
SOFT_DISABLE_TIME = 3 # seconds
|
||||
@@ -201,6 +201,7 @@ class Controls:
|
||||
self.resume_previously_pressed = False
|
||||
self.speed_check = False
|
||||
self.speed_limit_changed = False
|
||||
self.stopped_for_light = False
|
||||
self.update_toggles = False
|
||||
|
||||
self.display_timer = 0
|
||||
@@ -913,6 +914,13 @@ class Controls:
|
||||
if frogpilotPlan.forcingStop:
|
||||
self.events.add(EventName.forcingStop)
|
||||
|
||||
if self.frogpilot_toggles.green_light_alert and not self.sm['longitudinalPlan'].hasLead and CS.standstill:
|
||||
if frogpilotPlan.greenLight and self.stopped_for_light:
|
||||
self.events.add(EventName.greenLight)
|
||||
self.stopped_for_light = frogpilotPlan.redLight
|
||||
else:
|
||||
self.stopped_for_light = False
|
||||
|
||||
if not self.openpilot_crashed_triggered and os.path.isfile(os.path.join(sentry.CRASHES_DIR, 'error.txt')):
|
||||
self.events.add(EventName.openpilotCrashed)
|
||||
self.openpilot_crashed_triggered = True
|
||||
|
||||
@@ -994,6 +994,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 1.),
|
||||
},
|
||||
|
||||
EventName.greenLight: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Light turned green",
|
||||
"",
|
||||
AlertStatus.frogpilot, AlertSize.small,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 3.),
|
||||
},
|
||||
|
||||
EventName.noLaneAvailable: {
|
||||
ET.PERMANENT: no_lane_available_alert,
|
||||
},
|
||||
|
||||
@@ -318,6 +318,8 @@ class FrogPilotPlanner:
|
||||
|
||||
frogpilotPlan.forcingStop = self.forcing_stop
|
||||
|
||||
frogpilotPlan.greenLight = not self.model_stopped
|
||||
|
||||
frogpilotPlan.laneWidthLeft = self.lane_width_left
|
||||
frogpilotPlan.laneWidthRight = self.lane_width_right
|
||||
|
||||
|
||||
Reference in New Issue
Block a user