This commit is contained in:
Your Name
2024-02-05 01:15:52 -06:00
parent 072ed7e50f
commit a81f6285c1
5 changed files with 62 additions and 47 deletions

View File

@@ -171,13 +171,13 @@ class CarState(CarStateBase):
self.custom_speed_up = False self.custom_speed_up = False
self.custom_speed_down = False self.custom_speed_down = False
if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0: # if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0:
self.custom_speed_down = True # self.custom_speed_down = True
lkas_pressed = cp.vl["BCM_PO_11"]["LFA_Pressed"] # lkas_pressed = cp.vl["BCM_PO_11"]["LFA_Pressed"]
if lkas_pressed and not self.lkas_previously_pressed: # if lkas_pressed and not self.lkas_previously_pressed:
self.custom_speed_up = True # self.custom_speed_up = True
self.lkas_previously_pressed = lkas_pressed # self.lkas_previously_pressed = lkas_pressed
# Driving personalities function # Driving personalities function
# if self.personalities_via_wheel and ret.cruiseState.available: # if self.personalities_via_wheel and ret.cruiseState.available:
@@ -295,36 +295,48 @@ class CarState(CarStateBase):
self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING
else cp_cam.vl["CAM_0x2a4"]) else cp_cam.vl["CAM_0x2a4"])
self.custom_speed_up = False
self.custom_speed_down = False
if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0:
self.custom_speed_down = True
lkas_pressed = cp.vl[self.cruise_btns_msg_canfd]["LKAS_BTN"]
if lkas_pressed and not self.lkas_previously_pressed:
self.custom_speed_up = True
self.lkas_previously_pressed = lkas_pressed
# Driving personalities function # Driving personalities function
if self.personalities_via_wheel and ret.cruiseState.available: # if self.personalities_via_wheel and ret.cruiseState.available:
# Sync with the onroad UI button # # Sync with the onroad UI button
if self.param_memory.get_bool("PersonalityChangedViaUI"): # if self.param_memory.get_bool("PersonalityChangedViaUI"):
self.personality_profile = self.param.get_int("LongitudinalPersonality") # self.personality_profile = self.param.get_int("LongitudinalPersonality")
self.param_memory.put_bool("PersonalityChangedViaUI", False) # self.param_memory.put_bool("PersonalityChangedViaUI", False)
# Change personality upon steering wheel button press # # Change personality upon steering wheel button press
if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0: # if self.cruise_buttons[-1] == Buttons.GAP_DIST and self.prev_cruise_buttons == 0:
self.param_memory.put_bool("PersonalityChangedViaWheel", True) # self.param_memory.put_bool("PersonalityChangedViaWheel", True)
self.personality_profile = (self.previous_personality_profile + 2) % 3 # self.personality_profile = (self.previous_personality_profile + 2) % 3
if self.personality_profile != self.previous_personality_profile and self.personality_profile >= 0: # if self.personality_profile != self.previous_personality_profile and self.personality_profile >= 0:
self.param.put_int("LongitudinalPersonality", self.personality_profile) # self.param.put_int("LongitudinalPersonality", self.personality_profile)
self.previous_personality_profile = self.personality_profile # self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function # # Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_lkas and ret.cruiseState.available: # if self.experimental_mode_via_lkas and ret.cruiseState.available:
lkas_pressed = cp.vl[self.cruise_btns_msg_canfd]["LKAS_BTN"] # lkas_pressed = cp.vl[self.cruise_btns_msg_canfd]["LKAS_BTN"]
if lkas_pressed and not self.lkas_previously_pressed: # if lkas_pressed and not self.lkas_previously_pressed:
if self.conditional_experimental_mode: # if self.conditional_experimental_mode:
# Set "CEStatus" to work with "Conditional Experimental Mode" # # Set "CEStatus" to work with "Conditional Experimental Mode"
conditional_status = self.param_memory.get_int("CEStatus") # conditional_status = self.param_memory.get_int("CEStatus")
override_value = 0 if conditional_status in (1, 2, 3, 4) else 1 if conditional_status >= 5 else 2 # override_value = 0 if conditional_status in (1, 2, 3, 4) else 1 if conditional_status >= 5 else 2
self.param_memory.put_int("CEStatus", override_value) # self.param_memory.put_int("CEStatus", override_value)
else: # else:
experimental_mode = self.param.get_bool("ExperimentalMode") # experimental_mode = self.param.get_bool("ExperimentalMode")
# Invert the value of "ExperimentalMode" # # Invert the value of "ExperimentalMode"
put_bool_nonblocking("ExperimentalMode", not experimental_mode) # put_bool_nonblocking("ExperimentalMode", not experimental_mode)
self.lkas_previously_pressed = lkas_pressed # self.lkas_previously_pressed = lkas_pressed
return ret return ret

View File

@@ -343,11 +343,11 @@ class Controls:
# self.events.add(EventName.laneChange) # self.events.add(EventName.laneChange)
# Handle turning # Handle turning
# if not CS.standstill: if not CS.standstill:
# if self.sm['lateralPlan'].desire == Desire.turnLeft: if self.sm['lateralPlan'].desire == Desire.turnLeft:
# self.events.add(FrogPilotEventName.turningLeft) self.events.add(FrogPilotEventName.turningLeft)
# elif self.sm['lateralPlan'].desire == Desire.turnRight: elif self.sm['lateralPlan'].desire == Desire.turnRight:
# self.events.add(FrogPilotEventName.turningRight) self.events.add(FrogPilotEventName.turningRight)
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

View File

@@ -91,11 +91,11 @@ class DesireHelper:
if not lateral_active or self.lane_change_timer > LANE_CHANGE_TIME_MAX: if 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
# elif one_blinker and below_lane_change_speed and frogpilot_planner.turn_desires: elif one_blinker and below_lane_change_speed and frogpilot_planner.turn_desires:
# BBOT # BBOT
# self.turn_direction = TurnDirection.turnLeft if carstate.leftBlinker else TurnDirection.turnRight self.turn_direction = TurnDirection.turnLeft if carstate.leftBlinker else TurnDirection.turnRight
# Set the "turn_completed" flag to prevent lane changes after completing a turn # Set the "turn_completed" flag to prevent lane changes after completing a turn
# self.turn_completed = True self.turn_completed = True
else: else:
# TurnDirection.turnLeft / turnRight # TurnDirection.turnLeft / turnRight
self.turn_direction = TurnDirection.none self.turn_direction = TurnDirection.none

View File

@@ -231,7 +231,7 @@ def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
if "REPLAY" in os.environ: if "REPLAY" in os.environ:
branch = "replay" branch = "replay"
return StartupAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot) return StartupAlert("Openpilot Ready", "", alert_status=AlertStatus.frogpilot)
def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert: def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage") return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage")

View File

@@ -19,12 +19,15 @@ class DRIVER_MONITOR_SETTINGS():
def __init__(self): def __init__(self):
self._DT_DMON = DT_DMON self._DT_DMON = DT_DMON
# ref (page15-16): https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:42018X1947&rid=2 # ref (page15-16): https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=CELEX:42018X1947&rid=2
self._AWARENESS_TIME = 90. # passive wheeltouch total timeout # self._AWARENESS_TIME = 90. # passive wheeltouch total timeout
self._AWARENESS_PRE_TIME_TILL_TERMINAL = 60. # self._AWARENESS_PRE_TIME_TILL_TERMINAL = 60.
self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 30. # self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 30.
self._DISTRACTED_TIME = 90. # active monitoring total timeout self._AWARENESS_TIME = 30. # passive wheeltouch total timeout
self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 60. self._AWARENESS_PRE_TIME_TILL_TERMINAL = 15.
self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 30. self._AWARENESS_PROMPT_TIME_TILL_TERMINAL = 6.
self._DISTRACTED_TIME = 60. # active monitoring total timeout
self._DISTRACTED_PRE_TIME_TILL_TERMINAL = 15.
self._DISTRACTED_PROMPT_TIME_TILL_TERMINAL = 10.
self._FACE_THRESHOLD = 0.7 self._FACE_THRESHOLD = 0.7
self._EYE_THRESHOLD = 0.65 self._EYE_THRESHOLD = 0.65