mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
cap'n crunch
This commit is contained in:
@@ -333,6 +333,13 @@ def get_bolt_acc_pedal_friction_command_state(apply_brake: int, cruise_main_on:
|
||||
return command_brake, release_frames, should_send
|
||||
|
||||
|
||||
def should_use_fixed_stopping_brake(CP, near_stop: bool, stopping: bool, resume: bool) -> bool:
|
||||
if not (near_stop and stopping and not resume):
|
||||
return False
|
||||
|
||||
return not supports_bolt_acc_pedal_friction_experiment(CP)
|
||||
|
||||
|
||||
class CarController(CarControllerBase):
|
||||
def __init__(self, dbc_names, CP):
|
||||
super().__init__(dbc_names, CP)
|
||||
@@ -796,7 +803,7 @@ class CarController(CarControllerBase):
|
||||
self.regen_release_counter = 0
|
||||
self.regen_min_on_frames = 0
|
||||
self.regen_min_off_frames = 0
|
||||
elif near_stop and stopping and not CC.cruiseControl.resume:
|
||||
elif should_use_fixed_stopping_brake(self.CP, near_stop, stopping, CC.cruiseControl.resume):
|
||||
stop_accel = getattr(starpilot_toggles, "stopAccel", self.CP.stopAccel)
|
||||
self.apply_gas = self.params.INACTIVE_REGEN
|
||||
self.apply_brake = int(min(-100 * stop_accel, self.params.MAX_BRAKE))
|
||||
|
||||
@@ -51,6 +51,7 @@ from opendbc.car.gm.carcontroller import (
|
||||
get_testing_ground_1_brake_switch_bias,
|
||||
get_stock_cc_active_for_cancel,
|
||||
shape_truck_positive_accel,
|
||||
should_use_fixed_stopping_brake,
|
||||
should_activate_auto_hold,
|
||||
should_activate_volt_one_pedal,
|
||||
should_send_adas_status,
|
||||
@@ -198,6 +199,31 @@ def test_bolt_acc_pedal_friction_command_state_sends_zero_unwind_after_main_off(
|
||||
assert should_send
|
||||
|
||||
|
||||
def test_fixed_stopping_brake_is_disabled_for_bolt_acc_pedal_experiment():
|
||||
CP = SimpleNamespace(
|
||||
carFingerprint=CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL,
|
||||
openpilotLongitudinalControl=True,
|
||||
enableGasInterceptorDEPRECATED=True,
|
||||
flags=GMFlags.PEDAL_LONG.value,
|
||||
)
|
||||
|
||||
assert not should_use_fixed_stopping_brake(CP, True, True, False)
|
||||
|
||||
|
||||
def test_fixed_stopping_brake_stays_enabled_for_normal_acc_path():
|
||||
CP = SimpleNamespace(
|
||||
carFingerprint=CAR.CHEVROLET_BOLT_ACC_2022_2023,
|
||||
openpilotLongitudinalControl=True,
|
||||
enableGasInterceptorDEPRECATED=False,
|
||||
flags=0,
|
||||
)
|
||||
|
||||
assert should_use_fixed_stopping_brake(CP, True, True, False)
|
||||
assert not should_use_fixed_stopping_brake(CP, False, True, False)
|
||||
assert not should_use_fixed_stopping_brake(CP, True, False, False)
|
||||
assert not should_use_fixed_stopping_brake(CP, True, True, True)
|
||||
|
||||
|
||||
def test_stock_cancel_is_suppressed_when_acc_is_faulted():
|
||||
CP = SimpleNamespace(carFingerprint=CAR.CHEVROLET_VOLT_CAMERA)
|
||||
cs = _cs(True, AccState.FAULTED)
|
||||
|
||||
Reference in New Issue
Block a user