mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 02:03:42 +08:00
Smooth the final rolling stop on Kona CCNC
This commit is contained in:
@@ -695,6 +695,10 @@ class CarController(CarControllerBase):
|
||||
if self.torque_ev_lead_inputs is not None else
|
||||
fallback_lead(CS.torque_ev_camera_lead, hud_control.leadVisible, self.torque_ev_floor_boot_ns))
|
||||
acc_options = torque_ev_scc_options(CS.out.cruiseState.available, CC.actuators.longControlState, lead)
|
||||
if (kona_handoff and CC.longActive and not CC.cruiseControl.override and stopping and
|
||||
not (CS.out.standstill or CS.out.brakePressed or CS.out.gasPressed or hud_control.leadVisible or lead.visible) and
|
||||
0.0 < CS.out.vEgo < CV.MPH_TO_MS and -0.5 <= accel < 0.0 and accel >= self.accel_last - 0.02):
|
||||
acc_options["jerk_lower"] = 1.2
|
||||
elif is_gv70(self.CP):
|
||||
request = scc_request(CC.enabled, CC.cruiseControl.override, stopping, accel, self.accel_last)
|
||||
accel = request.accel
|
||||
|
||||
@@ -263,3 +263,34 @@ def test_kona_handoff_cruise_main_display_follows_star_long_engagement(handoff,
|
||||
assert display['DISTANCE_SPACING'] == 0
|
||||
assert parser.vl['CCNC_0x162']['FAULT_LSS'] == 2
|
||||
assert parser.vl['CCNC_0x162']['FAULT_FCA'] == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize('speed,accel,previous,standstill,lead,word,cap', [
|
||||
(0.3, -0.27, -0.26, False, False, 0x1C0C, 1.2),
|
||||
(0.5, -0.27, -0.26, False, False, 0x1C0C, 5.0),
|
||||
(0.3, -0.80, -0.79, False, False, 0x1C0C, 5.0),
|
||||
(0.3, -0.45, -0.20, False, False, 0x1C0C, 5.0),
|
||||
(0.1, -0.27, -0.26, True, False, 0x1C0C, 5.0),
|
||||
(0.3, -0.27, -0.26, False, True, 0x1C0C, 5.0),
|
||||
(0.3, -0.27, -0.26, False, False, 0x0C0C, 5.0),
|
||||
])
|
||||
def test_kona_final_braking_jerk(speed, accel, previous, standstill, lead, word, cap):
|
||||
from opendbc.can import CANParser
|
||||
|
||||
cp = kona_params(CARS[0])
|
||||
cp.safetyConfigs[0].safetyParam = word
|
||||
cp.alternativeExperience = 32
|
||||
ci = CarInterface(cp)
|
||||
ci.CS.out = structs.CarState(vEgo=speed, standstill=standstill, cruiseState={'available': True}).as_reader()
|
||||
ci.CC.accel_last = previous
|
||||
command = structs.CarControl(enabled=True, longActive=True,
|
||||
actuators={'accel': accel, 'longControlState': 'stopping'},
|
||||
hudControl={'leadVisible': lead})
|
||||
_, frames = ci.apply(command.as_reader(), 1_000_000_000)
|
||||
parser = CANParser('hyundai_canfd_generated', [('SCC_CONTROL', 0)], 0)
|
||||
assert 0x1A0 in parser.update((1_000_000_000, frames))
|
||||
values = parser.vl['SCC_CONTROL']
|
||||
assert values['aReqValue'] == pytest.approx(accel)
|
||||
assert values['aReqRaw'] == pytest.approx(accel)
|
||||
assert values['ACCMode'] == values['StopReq'] == 1
|
||||
assert values['JerkLowerLimit'] == pytest.approx(cap)
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "e7d731705f8a1b4efa84efe9aa934301f1ae9e1d543ee13c009f8fdac799ddec", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "4f231e5a0476cf7eeae651eca98b8d0b1c871e36feab3d5fea00831707b5ca8c", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user