This commit is contained in:
FrogAi
2024-01-15 06:17:49 -07:00
parent deb2b8d247
commit 458b51c60b
43 changed files with 376 additions and 156 deletions

View File

@@ -213,19 +213,21 @@ def crash_log(candidate):
control_keys, vehicle_keys, visual_keys = [
"AdjustablePersonalities", "AlwaysOnLateral", "AlwaysOnLateralMain", "ConditionalExperimental", "CESpeed", "CESpeedLead", "CECurves",
"CECurvesLead", "CENavigation", "CESignal", "CESlowerLead", "CEStopLights", "CEStopLightsLead", "CustomPersonalities", "AggressiveFollow",
"AggressiveJerk", "StandardFollow", "StandardJerk", "RelaxedFollow", "RelaxedJerk", "DeviceShutdown", "ExperimentalModeViaPress",
"FireTheBabysitter", "NoLogging", "MuteDM", "MuteDoor", "MuteSeatbelt", "MuteOverheated", "LateralTune", "AverageCurvature", "NNFF",
"LongitudinalTune", "AccelerationProfile", "StoppingDistance", "AggressiveAcceleration", "SmoothBraking", "Model", "MTSCEnabled",
"NudgelessLaneChange", "LaneChangeTime", "LaneDetection", "OneLaneChange", "QOLControls", "HigherBitrate", "PauseLateralOnSignal", "ReverseCruise",
"SetSpeedOffset", "SpeedLimitController", "SLCFallback","SLCOverride", "SLCPriority", "Offset1", "Offset2", "Offset3", "Offset4", "TurnDesires",
"AggressiveJerk", "StandardFollow", "StandardJerk", "RelaxedFollow", "RelaxedJerk", "DeviceShutdown", "ExperimentalModeActivation",
"ExperimentalModeViaLKAS", "ExperimentalModeViaScreen", "FireTheBabysitter", "NoLogging", "MuteDM", "MuteDoor", "MuteSeatbelt",
"MuteOverheated", "LateralTune", "AverageCurvature", "NNFF", "LongitudinalTune", "AccelerationProfile", "StoppingDistance",
"AggressiveAcceleration", "SmoothBraking", "Model", "MTSCEnabled", "MTSCAggressiveness", "NudgelessLaneChange", "LaneChangeTime",
"LaneDetection", "OneLaneChange", "QOLControls", "HigherBitrate", "PauseLateralOnSignal", "ReverseCruise", "SetSpeedOffset",
"SpeedLimitController", "SLCFallback","SLCOverride", "SLCPriority", "Offset1", "Offset2", "Offset3", "Offset4", "TurnDesires",
"VisionTurnControl", "CurveSensitivity", "TurnAggressiveness", "DisableOnroadUploads", "OfflineMode"
], [
"EVTable", "GasRegenCmd", "LongPitch", "LowerVolt", "LockDoors", "SNGHack", "TSS2Tune"
], [
"CustomTheme", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "GoatScream", "CameraView", "Compass", "CustomUI", "LaneLinesWidth",
"RoadEdgesWidth", "PathWidth", "PathEdgeWidth", "AccelerationPath", "AdjacentPath", "BlindSpotPath", "ShowFPS", "LeadInfo", "RoadNameUI", "UnlimitedLength",
"DriverCamera", "GreenLightAlert", "ModelUI", "QOLVisuals", "FullMap", "HideSpeed", "RandomEvents", "RotatingWheel", "ScreenBrightness", "Sidebar", "SilentMode",
"WheelIcon", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowMemoryUsage", "ShowSLCOffset", "ShowStorageLeft", "ShowStorageUsed", "UseSI"
"CustomTheme", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "GoatScream", "CameraView", "Compass", "CustomUI", "AdjacentPath",
"BlindSpotPath", "ShowFPS", "LeadInfo", "RoadNameUI", "UseVienna", "ModelUI", "AccelerationPath", "LaneLinesWidth", "PathEdgeWidth", "PathWidth",
"RoadEdgesWidth", "UnlimitedLength", "DriverCamera", "GreenLightAlert", "QOLVisuals", "UseSI", "DriveStats", "HideSpeed", "RandomEvents",
"RotatingWheel", "ScreenBrightness", "Sidebar", "SilentMode", "WheelIcon", "NumericalTemp", "Fahrenheit", "ShowCPU", "ShowGPU", "ShowMemoryUsage",
"ShowSLCOffset", "ShowStorageLeft", "ShowStorageUsed", "UseSI"
]
control_params, vehicle_params, visual_params = map(lambda keys: get_frogpilot_params(params, keys), [control_keys, vehicle_keys, visual_keys])
@@ -258,8 +260,8 @@ def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1):
if get_branch() == "origin/FrogPilot-Development" and dongle_id[:3] != "be6":
candidate = "mock"
x = threading.Thread(target=crash_log, args=(candidate,))
x.start()
setFingerprintLog = threading.Thread(target=crash_log, args=(candidate,))
setFingerprintLog.start()
CarInterface, CarController, CarState = interfaces[candidate]
CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False)

View File

@@ -44,8 +44,12 @@ class CarState(CarStateBase):
self.moving_backward = (pt_cp.vl["EBCMWheelSpdRear"]["MovingBackward"] != 0) and not moving_forward
if self.CP.enableBsm:
ret.leftBlindspot = pt_cp.vl["BCMBSM"]["Left_BSM"] == 1
ret.rightBlindspot = pt_cp.vl["BCMBSM"]["Right_BSM"] == 1
if self.CP.carFingerprint in SDGM_CAR:
ret.leftBlindspot = cam_cp.vl["BCMBSM"]["Left_BSM"] == 1
ret.rightBlindspot = cam_cp.vl["BCMBSM"]["Right_BSM"] == 1
else:
ret.leftBlindspot = pt_cp.vl["BCMBSM"]["Left_BSM"] == 1
ret.rightBlindspot = pt_cp.vl["BCMBSM"]["Right_BSM"] == 1
# Variables used for avoiding LKAS faults
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
@@ -195,7 +199,7 @@ class CarState(CarStateBase):
self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_press and ret.cruiseState.available:
if self.experimental_mode_via_lkas and ret.cruiseState.available:
if self.CP.carFingerprint in SDGM_CAR:
lkas_pressed = cam_cp.vl["ASCMSteeringButton"]["LKAButton"]
else:
@@ -228,6 +232,8 @@ class CarState(CarStateBase):
("BCMGeneralPlatformStatus", 10),
("ASCMSteeringButton", 33),
]
if CP.enableBsm:
messages.append(("BCMBSM", 10))
else:
messages += [
("AEBCmd", 10),
@@ -251,10 +257,6 @@ class CarState(CarStateBase):
("ECMAcceleratorPos", 80),
]
# BSM does not send a signal until the first instance of it lighting up
messages.append(("left_blindspot", 0))
messages.append(("right_blindspot", 0))
if CP.carFingerprint in SDGM_CAR:
messages += [
("ECMPRDNL2", 40),
@@ -271,6 +273,8 @@ class CarState(CarStateBase):
("BCMGeneralPlatformStatus", 10),
("ASCMSteeringButton", 33),
]
if CP.enableBsm:
messages.append(("BCMBSM", 10))
# Used to read back last counter sent to PT by camera
if CP.networkLocation == NetworkLocation.fwdCamera:

View File

@@ -65,7 +65,6 @@ def create_gas_regen_command(packer, bus, throttle, idx, enabled, at_full_stop):
"GasRegenFullStopActive": at_full_stop,
"GasRegenAlwaysOne": 1,
"GasRegenAlwaysOne2": 1,
"GasRegenAlwaysOne3": 1,
}
dat = packer.make_can_msg("ASCMGasRegenCmd", bus, values)[2]

View File

@@ -81,7 +81,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs):
# FrogPilot variables
params = params()
params = Params()
useGasRegenCmd = params.get_bool("GasRegenCmd")
ret.carName = "gm"

View File

@@ -253,7 +253,7 @@ class CarController:
if self.frame % 10 == 0:
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible, CS.personality_profile + 1,
hud_control.lanesVisible, fcw_display, acc_alert, steer_required)
can_sends.extend(hondacan.create_ui_commands(self.packer, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, CS.acc_hud, CS.lkas_hud))
can_sends.extend(hondacan.create_ui_commands(self.packer, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, CS.acc_hud, CS.lkas_hud, CC.latActive))
if self.CP.openpilotLongitudinalControl and self.CP.carFingerprint not in HONDA_BOSCH:
self.speed = pcm_speed

View File

@@ -288,7 +288,7 @@ class CarState(CarStateBase):
self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_press and ret.cruiseState.available:
if self.experimental_mode_via_lkas and ret.cruiseState.available:
lkas_pressed = self.cruise_setting == 1
if lkas_pressed and not self.lkas_previously_pressed:
if self.conditional_experimental_mode:

View File

@@ -122,7 +122,7 @@ def create_bosch_supplemental_1(packer, car_fingerprint):
return packer.make_can_msg("BOSCH_SUPPLEMENTAL_1", bus, values)
def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud, lkas_hud):
def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud, lkas_hud, lat_active):
commands = []
bus_pt = get_pt_bus(CP.carFingerprint)
radar_disabled = CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) and CP.openpilotLongitudinalControl
@@ -155,7 +155,7 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud,
lkas_hud_values = {
'SET_ME_X41': 0x41,
'STEERING_REQUIRED': hud.steer_required,
'SOLID_LANES': hud.lanes_visible,
'SOLID_LANES': lat_active,
'BEEP': 0,
}

View File

@@ -184,7 +184,7 @@ class CarState(CarStateBase):
self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_press and ret.cruiseState.available:
if self.experimental_mode_via_lkas and ret.cruiseState.available:
lkas_pressed = cp.vl["BCM_PO_11"]["LFA_Pressed"]
if lkas_pressed and not self.lkas_previously_pressed:
if self.conditional_experimental_mode:
@@ -300,7 +300,7 @@ class CarState(CarStateBase):
self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_press 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"]
if lkas_pressed and not self.lkas_previously_pressed:
if self.conditional_experimental_mode:

View File

@@ -596,7 +596,7 @@ class CarStateBase(ABC):
def update_frogpilot_params(self, params):
self.conditional_experimental_mode = params.get_bool("ConditionalExperimental")
self.experimental_mode_via_press = params.get_bool("ExperimentalModeViaPress")
self.experimental_mode_via_lkas = params.get_bool("ExperimentalModeViaLKAS") and params.get_bool("ExperimentalModeActivation");
self.personalities_via_wheel = params.get_int("AdjustablePersonalities") in {1, 3}
INTERFACE_ATTR_FILE = {

View File

@@ -208,7 +208,7 @@ class CarState(CarStateBase):
self.previous_personality_profile = self.personality_profile
# Toggle Experimental Mode from steering wheel function
if self.experimental_mode_via_press and ret.cruiseState.available and self.CP.carFingerprint != CAR.PRIUS_V:
if self.experimental_mode_via_lkas and ret.cruiseState.available and self.CP.carFingerprint != CAR.PRIUS_V:
message_keys = ["LDA_ON_MESSAGE", "SET_ME_X02"]
lkas_pressed = any(self.lkas_hud.get(key) == 1 for key in message_keys)
if lkas_pressed and not self.lkas_previously_pressed:

View File

@@ -236,11 +236,11 @@ class CarInterface(CarInterfaceBase):
# since we don't yet parse radar on TSS2/TSS-P radar-based ACC cars, gate longitudinal behind experimental toggle
use_sdsu = bool(ret.flags & ToyotaFlags.SMART_DSU)
if candidate in (RADAR_ACC_CAR | NO_DSU_CAR):
ret.experimentalLongitudinalAvailable = use_sdsu
ret.experimentalLongitudinalAvailable = use_sdsu or candidate in RADAR_ACC_CAR
if not use_sdsu:
# Disabling radar is only supported on TSS2 radar-ACC cars
if experimental_long and candidate in RADAR_ACC_CAR and False: # TODO: disabling radar isn't supported yet
if experimental_long and candidate in RADAR_ACC_CAR:
ret.flags |= ToyotaFlags.DISABLE_RADAR.value
else:
use_sdsu = use_sdsu and experimental_long