mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-28 15:53:43 +08:00
Keep Trax braking below the cruise engagement speed
This commit is contained in:
@@ -41,7 +41,8 @@ from openpilot.starpilot.aol.vehicle import native_bootstrap_supported
|
||||
from opendbc.car.gm.steering_authority import monitored_profile
|
||||
from openpilot.starpilot.car.gm.steering_companion import SteeringCompanion
|
||||
from openpilot.starpilot.car.hyundai.aol import qualified_ioniq6
|
||||
from opendbc.car.gm.values import GMFlags, is_volt_ascm_longitudinal, malibu_hybrid_profile
|
||||
from opendbc.car.gm.values import CAR as GM_CAR
|
||||
from opendbc.car.gm.values import GMFlags, is_ordinary_camera_profile, is_volt_ascm_longitudinal, malibu_hybrid_profile
|
||||
from openpilot.starpilot.aol.intent import read_settings
|
||||
from openpilot.starpilot.aol.intent_companion import IntentCompanion
|
||||
from openpilot.starpilot.aol.transport_pause import AvailabilityPause, TransportPause, availability_only, cp_identity, healthy_transport
|
||||
@@ -1876,6 +1877,11 @@ class SelfdriveD:
|
||||
pause_brake_mps = self.aol_settings.pause_brake_mps if self.aol_settings is not None else 0.0
|
||||
if reverse_pause:
|
||||
lateral_events = [event for event in lateral_events if event not in (EventName.wrongGear, EventName.reverseGear)]
|
||||
# The Trax entry speed must not drop braking during an engaged stop.
|
||||
trax_below_entry_speed = (
|
||||
self.CP.carFingerprint == GM_CAR.CHEVROLET_TRAX and EventName.belowEngageSpeed in lateral_events and
|
||||
self.enabled and self.active and CS.cruiseState.enabled and not self.CP.flags & GMFlags.NO_CAMERA and
|
||||
is_ordinary_camera_profile(self.CP, longitudinal=True))
|
||||
return decide_axes(
|
||||
standard_lateral=self.active, standard_longitudinal=bool(self.enabled and self.CP.openpilotLongitudinalControl and
|
||||
not raw_longitudinal_withdrawal(self.CP, CS, self.sm, native, session=self.aol_session_id, now_ns=now_ns) and
|
||||
@@ -1911,7 +1917,7 @@ class SelfdriveD:
|
||||
source_ns=getattr(self, 'aol_car_state_log_ns', 0), now_ns=now_ns,
|
||||
axis_session_id=getattr(self, 'aol_session_id', '')),
|
||||
cruise_main_required=getattr(self, 'aol_cruise_main_required', True),
|
||||
allow_below_engage_speed=bool((is_volt_ascm_longitudinal(self.CP) or
|
||||
allow_below_engage_speed=trax_below_entry_speed or bool((is_volt_ascm_longitudinal(self.CP) or
|
||||
stock_ascm_independent_lateral(self.CP) or
|
||||
independent_lateral_below_engage(self.CP, intent,
|
||||
enabled=self.enabled, active=self.active)) and
|
||||
|
||||
@@ -79,3 +79,29 @@ def test_combined_authority_survives_repeated_standstill_undershoot():
|
||||
cs.brakePressed = True
|
||||
_, _, control = step(25, observed_state=cs)
|
||||
assert not control.longActive
|
||||
|
||||
|
||||
@pytest.mark.parametrize('engaged', [False, True])
|
||||
def test_trax_keeps_braking_below_entry_speed_only_when_engaged(engaged):
|
||||
with OpenpilotPrefix(), ExitStack() as cleanup:
|
||||
case = fixture.IoniqAvailabilityTests(methodName='runTest')
|
||||
cleanup.callback(case.doCleanups)
|
||||
cp = params(CAR.CHEVROLET_TRAX, alpha=True)
|
||||
assert cp.safetyConfigs[0].safetyParam == 0xC170
|
||||
sd, _, step = case._authority_callers(engaged, cp=cp, genuine_events=True)
|
||||
sd.aol_settings = read_settings(sd.params)
|
||||
speeds = (1.44, 1.39, 1.36, 1.43, 1.34, .7, .2, 0.) if engaged else (1.34, .7)
|
||||
for tick, speed in enumerate(speeds):
|
||||
cs = stopped(speed)
|
||||
cs.vEgoRaw, cs.standstill, cs.cruiseState.standstill = speed, speed == 0., speed == 0.
|
||||
cs.buttonEnable = not engaged
|
||||
axis, host, control = step(tick, observed_state=cs)
|
||||
assert (EventName.belowEngageSpeed in sd.events.names) == (speed < cp.minEnableSpeed)
|
||||
assert host.enabled == axis.longitudinalActive == control.longActive == engaged
|
||||
if engaged:
|
||||
_, _, control = step(len(speeds), observed_state=stopped(0.), long_allowed=False)
|
||||
assert not control.longActive
|
||||
cs = stopped(0.)
|
||||
cs.brakePressed = True
|
||||
_, _, control = step(len(speeds) + 1, observed_state=cs)
|
||||
assert not control.longActive
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "38aa8636005853c83913908cc49be67788604d367c0e187d88c485525e8128ed", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "2bd9b3b51017d2f00e7b337cd9459087d7242b9985bfb3391d1f0c8e713ae859", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user