From df8fe2299abfd774a12ac85373c0242d347dbab1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 6 Nov 2024 16:56:22 -0600 Subject: [PATCH 1/3] Ford: enable long by default (#1446) * enable by default * whoops --- opendbc/car/ford/interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opendbc/car/ford/interface.py b/opendbc/car/ford/interface.py index ebd8f5443d..92c89f4f6d 100644 --- a/opendbc/car/ford/interface.py +++ b/opendbc/car/ford/interface.py @@ -42,8 +42,9 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime cfgs.insert(0, get_safety_config(structs.CarParams.SafetyModel.noOutput)) ret.safetyConfigs = cfgs - ret.experimentalLongitudinalAvailable = True - if experimental_long: + # TODO: verify stock AEB compatibility and longitudinal limit safety before shipping to release + ret.experimentalLongitudinalAvailable = ret.radarUnavailable + if experimental_long or not ret.radarUnavailable: ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_FORD_LONG_CONTROL ret.openpilotLongitudinalControl = True From 6be3d044933c4a9999b2f7de11dcbf66c4c2f879 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 6 Nov 2024 16:58:04 -0600 Subject: [PATCH 2/3] Toyota: set pcm_accel_net when possible (#1448) set always --- opendbc/car/toyota/carstate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opendbc/car/toyota/carstate.py b/opendbc/car/toyota/carstate.py index c81899d137..e319d2c394 100644 --- a/opendbc/car/toyota/carstate.py +++ b/opendbc/car/toyota/carstate.py @@ -8,7 +8,7 @@ from opendbc.car.common.numpy_fast import mean from opendbc.car.interfaces import CarStateBase from opendbc.car.toyota.values import ToyotaFlags, CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, \ - TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR + TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR, SECOC_CAR ButtonType = structs.CarState.ButtonEvent.Type SteerControlType = structs.CarParams.SteerControlType @@ -60,7 +60,7 @@ def update(self, cp, cp_cam, *_) -> structs.CarState: # Describes the acceleration request from the PCM if on flat ground, may be higher or lower if pitched # CLUTCH->ACCEL_NET is only accurate for gas, PCM_CRUISE->ACCEL_NET is only accurate for brake # These signals only have meaning when ACC is active - if self.CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT: + if "CLUTCH" in cp.vl: self.pcm_accel_net = max(cp.vl["CLUTCH"]["ACCEL_NET"], 0.0) # Sometimes ACC_BRAKING can be 1 while showing we're applying gas already @@ -232,7 +232,7 @@ def get_can_parser(CP): ("GEAR_PACKET", 1), ] - if CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT: + if CP.carFingerprint in (TSS2_CAR - SECOC_CAR - {CAR.LEXUS_NX_TSS2, CAR.TOYOTA_ALPHARD_TSS2, CAR.LEXUS_IS_TSS2}): messages.append(("CLUTCH", 15)) if CP.carFingerprint in UNSUPPORTED_DSU_CAR: From f090bf6fa2247beb01a102c2e109c4b6decd54fb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 6 Nov 2024 16:59:29 -0600 Subject: [PATCH 3/3] Toyota: set permit braking when stopping (#1447) * we need to brake when stopping always * stopping --- opendbc/car/toyota/carcontroller.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opendbc/car/toyota/carcontroller.py b/opendbc/car/toyota/carcontroller.py index e1b4003b84..766109de42 100644 --- a/opendbc/car/toyota/carcontroller.py +++ b/opendbc/car/toyota/carcontroller.py @@ -56,6 +56,7 @@ def __init__(self, dbc_name, CP): def update(self, CC, CS, now_nanos): actuators = CC.actuators + stopping = actuators.longControlState == LongCtrlState.stopping hud_control = CC.hudControl pcm_cancel_cmd = CC.cruiseControl.cancel lat_active = CC.latActive and abs(CS.out.steeringTorque) < MAX_USER_TORQUE @@ -155,7 +156,7 @@ def update(self, CC, CS, now_nanos): # let PCM handle stopping for now pcm_accel_compensation = 0.0 - if actuators.longControlState != LongCtrlState.stopping: + if not stopping: pcm_accel_compensation = 2.0 * (CS.pcm_accel_net - net_acceleration_request) # prevent compensation windup @@ -167,7 +168,7 @@ def update(self, CC, CS, now_nanos): # Along with rate limiting positive jerk below, this greatly improves gas response time # Consider the net acceleration request that the PCM should be applying (pitch included) - if net_acceleration_request < 0.1: + if net_acceleration_request < 0.1 or stopping: self.permit_braking = True elif net_acceleration_request > 0.2: self.permit_braking = False