mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-10-28 09:03:46 +08:00
Resume AOL Latch Upon Exit
This commit is contained in:
@@ -161,12 +161,13 @@ def current_native(sm, CP, *, now_ns: int, axis_session_id: str | None = None):
|
||||
|
||||
|
||||
def known_reverse_pause(car_state, samples=()) -> bool:
|
||||
"""Include the known Neutral transition into and out of Reverse."""
|
||||
states = [car_state, *(state for state, _ in samples)]
|
||||
gears = car.CarState.GearShifter
|
||||
return bool(all(valid for _, valid in samples) and
|
||||
any(state.gearShifter == gears.reverse for state in states) and
|
||||
any(state.gearShifter in (gears.neutral, gears.reverse) for state in states) and
|
||||
all(state.canValid and not state.canTimeout and state.gearShifter in
|
||||
(gears.drive, gears.low, gears.sport, gears.brake, gears.reverse) for state in states))
|
||||
(gears.drive, gears.low, gears.sport, gears.brake, gears.neutral, gears.reverse) for state in states))
|
||||
|
||||
|
||||
def decide_axes(*, standard_lateral: bool, standard_longitudinal: bool, intent,
|
||||
|
||||
@@ -119,8 +119,8 @@ def test_queue_reorder_bound_and_pair_loss_still_withdraw(failure):
|
||||
assert axis.sourceCarStateMonoTime == 0 and not sd.conditional_car_state_valid
|
||||
|
||||
|
||||
@pytest.mark.parametrize('first_gear,valid,retained', [('reverse', True, True), ('unknown', True, False),
|
||||
('reverse', False, False), ('eco', True, False)])
|
||||
@pytest.mark.parametrize('first_gear,valid,retained', [('reverse', True, True), ('neutral', True, True), ('park', True, False), ('unknown', True, False),
|
||||
('reverse', False, False), ('neutral', False, False), ('eco', True, False)])
|
||||
def test_reverse_queue_pause_requires_known_valid_gears(first_gear, valid, retained):
|
||||
from openpilot.starpilot.aol.runtime import known_reverse_pause
|
||||
first, last = fixture.car_state(), fixture.car_state()
|
||||
|
||||
@@ -660,3 +660,37 @@ class IoniqAvailabilityTests(unittest.TestCase):
|
||||
self.assertFalse(receive(10_030_000_000, axis=sd.pm.messages['aolAxisState'],
|
||||
event=sd.pm.messages['onroadEvents'], state=observed))
|
||||
self.assertFalse(card.aol_card_intent.allowed_latch)
|
||||
|
||||
def test_neutral_reverse_neutral_drive_preserves_actual_card_latch(self):
|
||||
from openpilot.starpilot.aol.wire import decode_intent
|
||||
|
||||
with OpenpilotPrefix():
|
||||
sd, _, step, card, receive = self._ioniq_availability_callers()
|
||||
card.pm = type(sd.pm)()
|
||||
card.aol_sequence = 2
|
||||
gears = ['neutral'] * 3 + ['reverse'] * 40 + ['neutral'] * 3 + ['drive'] * 4
|
||||
for tick, gear in enumerate(gears, 2):
|
||||
cs = car_state(brake=True)
|
||||
cs.gearShifter = gear
|
||||
now = 10_000_000_000 + tick * 10_000_000
|
||||
original_message = messaging.new_message
|
||||
def current_message(*args, _original=original_message, _now=now, **kwargs):
|
||||
message = _original(*args, **kwargs)
|
||||
message.logMonoTime = _now
|
||||
return message
|
||||
with mock.patch('openpilot.selfdrive.car.card.messaging.new_message', side_effect=current_message):
|
||||
card.state_publish(cs, None)
|
||||
intent_message = card.pm.messages['aolIntentWire'].as_builder()
|
||||
intent = decode_intent(bytes(intent_message.aolIntentWire))
|
||||
self.assertTrue(intent.lateralArmed)
|
||||
requested = gear == 'drive'
|
||||
axis, state, command = step(tick, observed_state=cs, intent_message=intent_message,
|
||||
native_request_lat=requested, allowed=requested, native_request_long=False)
|
||||
if gear != 'drive':
|
||||
self.assertFalse(axis.desiredLateral or axis.lateralActive or command.latActive)
|
||||
self.assertFalse(axis.longitudinalActive or command.longActive)
|
||||
self.assertEqual(str(axis.faultReason), 'none')
|
||||
self.assertTrue(receive(now, state=cs, axis=sd.pm.messages['aolAxisState'],
|
||||
event=sd.pm.messages['onroadEvents']))
|
||||
self.assertTrue(axis.lateralActive and command.latActive)
|
||||
self.assertFalse(state.enabled or state.active)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
extern const uint8_t gitversion[29];
|
||||
const uint8_t gitversion[29] = "DEV-eb151c76-P92eb5651-DEBUG";
|
||||
const uint8_t gitversion[29] = "DEV-fab8b79c-P92eb5651-DEBUG";
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
|
||||
DEV-eb151c76-P92eb5651-DEBUG
|
||||
DEV-fab8b79c-P92eb5651-DEBUG
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "4303ba5948f7926d28d165289350db695927a393280d474174ee563a81c5a5a0", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "beb5e91a18ef4e35ce04a9e768ee0e45704e08218aabd4e88d26ad45100dce33", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user