mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
cry more
This commit is contained in:
@@ -97,6 +97,22 @@ class CAR(Platforms):
|
||||
)
|
||||
|
||||
|
||||
PACIFICA_HYBRID_AOL_CARS = frozenset({
|
||||
CAR.CHRYSLER_PACIFICA_2019_HYBRID,
|
||||
})
|
||||
|
||||
|
||||
def pacifica_hybrid_aol_stock_acc_mode(car_fingerprint, pcm_cruise: bool,
|
||||
controls_enabled: bool, always_on_lateral_enabled: bool) -> bool:
|
||||
# Keep this narrow until we have logs proving other Chrysler platforms need the same exemption.
|
||||
return (
|
||||
car_fingerprint in PACIFICA_HYBRID_AOL_CARS and
|
||||
pcm_cruise and
|
||||
always_on_lateral_enabled and
|
||||
not controls_enabled
|
||||
)
|
||||
|
||||
|
||||
class CarControllerParams:
|
||||
def __init__(self, CP):
|
||||
self.STEER_STEP = 2 # 50 Hz
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from opendbc.car.chrysler.values import CAR as CHRYSLER_CAR, pacifica_hybrid_aol_stock_acc_mode
|
||||
from opendbc.car.values import PLATFORMS
|
||||
|
||||
|
||||
@@ -15,3 +16,13 @@ class TestPlatformConfigs:
|
||||
assert name == platform.config.platform_str
|
||||
|
||||
assert platform.config.specs is not None
|
||||
|
||||
def test_pacifica_hybrid_aol_stock_acc_mode_requires_pr_conditions(self):
|
||||
assert pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2019_HYBRID, True, False, True)
|
||||
assert not pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2019_HYBRID, True, True, True)
|
||||
assert not pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2019_HYBRID, True, False, False)
|
||||
assert not pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2019_HYBRID, False, False, True)
|
||||
|
||||
def test_pacifica_hybrid_aol_stock_acc_mode_stays_narrow(self):
|
||||
assert not pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2018_HYBRID, True, False, True)
|
||||
assert not pacifica_hybrid_aol_stock_acc_mode(CHRYSLER_CAR.CHRYSLER_PACIFICA_2020, True, False, True)
|
||||
|
||||
@@ -10,6 +10,7 @@ from openpilot.common.realtime import config_realtime_process, DT_CTRL, Priority
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
|
||||
from opendbc.car.car_helpers import interfaces
|
||||
from opendbc.car.chrysler.values import pacifica_hybrid_aol_stock_acc_mode
|
||||
from opendbc.car.gm.values import CAR as GM_CAR
|
||||
from opendbc.car.vehicle_model import VehicleModel
|
||||
from openpilot.selfdrive.controls.lib.drive_helpers import clip_curvature, get_lateral_active
|
||||
@@ -225,7 +226,14 @@ class Controls:
|
||||
CC.angularVelocity = self.calibrated_pose.angular_velocity.xyz.tolist()
|
||||
|
||||
CC.cruiseControl.override = CC.enabled and not CC.longActive and self.CP.openpilotLongitudinalControl
|
||||
CC.cruiseControl.cancel = CS.cruiseState.enabled and (not CC.enabled or not self.CP.pcmCruise)
|
||||
pacifica_hybrid_aol = pacifica_hybrid_aol_stock_acc_mode(
|
||||
self.CP.carFingerprint,
|
||||
self.CP.pcmCruise,
|
||||
CC.enabled,
|
||||
self.sm['starpilotCarState'].alwaysOnLateralEnabled,
|
||||
)
|
||||
cancel_requested = CS.cruiseState.enabled and (not CC.enabled or not self.CP.pcmCruise)
|
||||
CC.cruiseControl.cancel = cancel_requested and not pacifica_hybrid_aol
|
||||
CC.cruiseControl.resume = CC.enabled and CS.cruiseState.standstill and not self.sm['longitudinalPlan'].shouldStop
|
||||
|
||||
hudControl = CC.hudControl
|
||||
|
||||
@@ -9,6 +9,7 @@ from cereal import car, custom, log
|
||||
from msgq.visionipc import VisionIpcClient, VisionStreamType
|
||||
|
||||
|
||||
from opendbc.car.chrysler.values import pacifica_hybrid_aol_stock_acc_mode
|
||||
from opendbc.car.gm.values import GMFlags
|
||||
from opendbc.safety import ALTERNATIVE_EXPERIENCE
|
||||
|
||||
@@ -425,7 +426,13 @@ class SelfdriveD:
|
||||
|
||||
if not REPLAY:
|
||||
# Check for mismatch between openpilot and car's PCM
|
||||
cruise_mismatch = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
|
||||
pacifica_hybrid_aol = pacifica_hybrid_aol_stock_acc_mode(
|
||||
self.CP.carFingerprint,
|
||||
self.CP.pcmCruise,
|
||||
self.enabled,
|
||||
self.sm['starpilotCarState'].alwaysOnLateralEnabled,
|
||||
)
|
||||
cruise_mismatch = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise) and not pacifica_hybrid_aol
|
||||
self.cruise_mismatch_counter = self.cruise_mismatch_counter + 1 if cruise_mismatch else 0
|
||||
if self.cruise_mismatch_counter > int(6. / DT_CTRL):
|
||||
self.events.add(EventName.cruiseMismatch)
|
||||
|
||||
Reference in New Issue
Block a user