This commit is contained in:
Your Name
2024-05-03 01:12:47 -05:00
parent b94be3e23e
commit 02513c94c6
5 changed files with 49 additions and 37 deletions

View File

@@ -311,28 +311,30 @@ class Controls:
# Handle lane change # Handle lane change
# CLEARPILOT - Disabled lane change helper # CLEARPILOT - Disabled lane change helper
# CLEARPILOT TODO: Make this a toggle # CLEARPILOT TODO: Make this a toggle
# if self.sm['modelV2'].meta.laneChangeState == LaneChangeState.preLaneChange: NoLaneChange = False
# direction = self.sm['modelV2'].meta.laneChangeDirection if not NoLaneChange:
# if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \ if self.sm['modelV2'].meta.laneChangeState == LaneChangeState.preLaneChange:
# (CS.rightBlindspot and direction == LaneChangeDirection.right): direction = self.sm['modelV2'].meta.laneChangeDirection
# if self.loud_blindspot_alert: if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
# self.events.add(EventName.laneChangeBlockedLoud) (CS.rightBlindspot and direction == LaneChangeDirection.right):
# else: if self.loud_blindspot_alert:
# self.events.add(EventName.laneChangeBlocked) self.events.add(EventName.laneChangeBlockedLoud)
# else: else:
# if direction == LaneChangeDirection.left: self.events.add(EventName.laneChangeBlocked)
# if self.sm['frogpilotPlan'].laneWidthLeft >= self.lane_detection_width: else:
# self.events.add(EventName.preLaneChangeLeft) if direction == LaneChangeDirection.left:
# else: if self.sm['frogpilotPlan'].laneWidthLeft >= self.lane_detection_width:
# self.events.add(EventName.noLaneAvailable) self.events.add(EventName.preLaneChangeLeft)
# else: else:
# if self.sm['frogpilotPlan'].laneWidthRight >= self.lane_detection_width: self.events.add(EventName.noLaneAvailable)
# self.events.add(EventName.preLaneChangeRight) else:
# else: if self.sm['frogpilotPlan'].laneWidthRight >= self.lane_detection_width:
# self.events.add(EventName.noLaneAvailable) self.events.add(EventName.preLaneChangeRight)
# elif self.sm['modelV2'].meta.laneChangeState in (LaneChangeState.laneChangeStarting, else:
# LaneChangeState.laneChangeFinishing): self.events.add(EventName.noLaneAvailable)
# self.events.add(EventName.laneChange) elif self.sm['modelV2'].meta.laneChangeState in (LaneChangeState.laneChangeStarting,
LaneChangeState.laneChangeFinishing):
self.events.add(EventName.laneChange)
for i, pandaState in enumerate(self.sm['pandaStates']): for i, pandaState in enumerate(self.sm['pandaStates']):
# All pandas must match the list of safetyConfigs, and if outside this list, must be silent or noOutput # All pandas must match the list of safetyConfigs, and if outside this list, must be silent or noOutput
@@ -628,10 +630,15 @@ class Controls:
actuators = CC.actuators actuators = CC.actuators
actuators.longControlState = self.LoC.long_control_state actuators.longControlState = self.LoC.long_control_state
# CLEARPILOT test lane change
clearpilot_disable_lat_on_lane_change = True
# Enable blinkers while lane changing # Enable blinkers while lane changing
if model_v2.meta.laneChangeState != LaneChangeState.off: if model_v2.meta.laneChangeState != LaneChangeState.off:
CC.leftBlinker = model_v2.meta.laneChangeDirection == LaneChangeDirection.left CC.leftBlinker = model_v2.meta.laneChangeDirection == LaneChangeDirection.left
CC.rightBlinker = model_v2.meta.laneChangeDirection == LaneChangeDirection.right CC.rightBlinker = model_v2.meta.laneChangeDirection == LaneChangeDirection.right
if clearpilot_disable_lat_on_lane_change:
CC.latActive = False
if CS.leftBlinker or CS.rightBlinker: if CS.leftBlinker or CS.rightBlinker:
self.last_blinker_frame = self.sm.frame self.last_blinker_frame = self.sm.frame

View File

@@ -10,6 +10,7 @@ TurnDirection = log.Desire
LANE_CHANGE_SPEED_MIN = 20 * CV.MPH_TO_MS LANE_CHANGE_SPEED_MIN = 20 * CV.MPH_TO_MS
LANE_CHANGE_TIME_MAX = 10. LANE_CHANGE_TIME_MAX = 10.
DESIRES = { DESIRES = {
LaneChangeDirection.none: { LaneChangeDirection.none: {
LaneChangeState.off: log.Desire.none, LaneChangeState.off: log.Desire.none,
@@ -61,6 +62,9 @@ class DesireHelper:
self.update_frogpilot_params() self.update_frogpilot_params()
def update(self, carstate, lateral_active, lane_change_prob, frogpilotPlan): def update(self, carstate, lateral_active, lane_change_prob, frogpilotPlan):
# Clearpilot test lane change no lat
clearpilot_disable_lat_on_lane_change = True
v_ego = carstate.vEgo v_ego = carstate.vEgo
one_blinker = carstate.leftBlinker != carstate.rightBlinker one_blinker = carstate.leftBlinker != carstate.rightBlinker
below_lane_change_speed = v_ego < LANE_CHANGE_SPEED_MIN below_lane_change_speed = v_ego < LANE_CHANGE_SPEED_MIN
@@ -71,7 +75,7 @@ class DesireHelper:
desired_lane = frogpilotPlan.laneWidthLeft if carstate.leftBlinker else frogpilotPlan.laneWidthRight desired_lane = frogpilotPlan.laneWidthLeft if carstate.leftBlinker else frogpilotPlan.laneWidthRight
lane_available = desired_lane >= self.lane_detection_width lane_available = desired_lane >= self.lane_detection_width
if not lateral_active or self.lane_change_timer > LANE_CHANGE_TIME_MAX: if (not clearpilot_disable_lat_on_lane_change and not lateral_active) or self.lane_change_timer > LANE_CHANGE_TIME_MAX:
self.lane_change_state = LaneChangeState.off self.lane_change_state = LaneChangeState.off
self.lane_change_direction = LaneChangeDirection.none self.lane_change_direction = LaneChangeDirection.none
self.turn_direction = TurnDirection.none self.turn_direction = TurnDirection.none
@@ -115,12 +119,16 @@ class DesireHelper:
# LaneChangeState.laneChangeStarting # LaneChangeState.laneChangeStarting
elif self.lane_change_state == LaneChangeState.laneChangeStarting: elif self.lane_change_state == LaneChangeState.laneChangeStarting:
# fade out over .5s if clearpilot_disable_lat_on_lane_change:
self.lane_change_ll_prob = max(self.lane_change_ll_prob - 2 * DT_MDL, 0.0) if not one_blinker:
self.lane_change_state = LaneChangeState.laneChangeFinishing
else:
# fade out over .5s
self.lane_change_ll_prob = max(self.lane_change_ll_prob - 2 * DT_MDL, 0.0)
# 98% certainty # 98% certainty
if lane_change_prob < 0.02 and self.lane_change_ll_prob < 0.01: if lane_change_prob < 0.02 and self.lane_change_ll_prob < 0.01:
self.lane_change_state = LaneChangeState.laneChangeFinishing self.lane_change_state = LaneChangeState.laneChangeFinishing
# LaneChangeState.laneChangeFinishing # LaneChangeState.laneChangeFinishing
elif self.lane_change_state == LaneChangeState.laneChangeFinishing: elif self.lane_change_state == LaneChangeState.laneChangeFinishing:

View File

@@ -5,9 +5,7 @@ from openpilot.common.params import Params
from openpilot.system.hardware import PC, TICI from openpilot.system.hardware import PC, TICI
from openpilot.selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess from openpilot.selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
from openpilot.selfdrive.frogpilot.controls.lib.model_manager import RADARLESS_MODELS
RADARLESS = Params().get("Model", encoding='utf-8') in RADARLESS_MODELS
WEBCAM = os.getenv("USE_WEBCAM") is not None WEBCAM = os.getenv("USE_WEBCAM") is not None
def driverview(started: bool, params: Params, CP: car.CarParams) -> bool: def driverview(started: bool, params: Params, CP: car.CarParams) -> bool:
@@ -80,16 +78,15 @@ procs = [
PythonProcess("controlsd", "selfdrive.controls.controlsd", only_onroad), PythonProcess("controlsd", "selfdrive.controls.controlsd", only_onroad),
PythonProcess("deleter", "system.loggerd.deleter", always_run), PythonProcess("deleter", "system.loggerd.deleter", always_run),
PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(not PC or WEBCAM)), PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(not PC or WEBCAM)),
PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", always_run, enabled=TICI), PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI),
# PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI), #PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
PythonProcess("navd", "selfdrive.navd.navd", only_onroad), PythonProcess("navd", "selfdrive.navd.navd", only_onroad),
PythonProcess("pandad", "selfdrive.boardd.pandad", always_run), PythonProcess("pandad", "selfdrive.boardd.pandad", always_run),
PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad), PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad),
NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI), NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI),
PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI), PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI),
PythonProcess("plannerd", "selfdrive.controls.plannerd", only_onroad), PythonProcess("plannerd", "selfdrive.controls.plannerd", only_onroad),
PythonProcess("radard", "selfdrive.controls.radard", only_onroad, enabled=not RADARLESS), PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
PythonProcess("radardless", "selfdrive.controls.radardless", only_onroad, enabled=RADARLESS),
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run), PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC), PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC),
PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC), PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC),