Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into toyota-acc-33hz
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Nov 7, 2024
2 parents 7ac64b2 + f090bf6 commit 4f36f1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions opendbc/car/ford/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions opendbc/car/toyota/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/toyota/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4f36f1e

Please sign in to comment.