mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-08 17:13:45 +08:00
MADS: remove controlsAllowedLat to maintain compatibility with stock cereal (#597)
* MADS: remove `controlsAllowedLat` to maintain compatibility with stock cereal * unused * bump panda
This commit is contained in:
+1
-1
@@ -665,7 +665,6 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
|
||||
# safety stuff
|
||||
controlsAllowed @3 :Bool;
|
||||
controlsAllowedLat @5 :Bool;
|
||||
safetyRxInvalid @19 :UInt32;
|
||||
safetyTxBlocked @24 :UInt32;
|
||||
safetyModel @14 :Car.CarParams.SafetyModel;
|
||||
@@ -773,6 +772,7 @@ struct PandaState @0xa7649e2575e4591e {
|
||||
}
|
||||
|
||||
gasInterceptorDetectedDEPRECATED @4 :Bool;
|
||||
startedSignalDetectedDEPRECATED @5 :Bool;
|
||||
hasGpsDEPRECATED @6 :Bool;
|
||||
gmlanSendErrsDEPRECATED @9 :UInt32;
|
||||
fanSpeedRpmDEPRECATED @11 :UInt16;
|
||||
|
||||
+1
-1
Submodule panda updated: d3252abcc4...928b0eb225
@@ -158,7 +158,6 @@ void fill_panda_state(cereal::PandaState::Builder &ps, cereal::PandaState::Panda
|
||||
ps.setIgnitionLine(health.ignition_line_pkt);
|
||||
ps.setIgnitionCan(health.ignition_can_pkt);
|
||||
ps.setControlsAllowed(health.controls_allowed_pkt);
|
||||
ps.setControlsAllowedLat(health.controls_allowed_lat_pkt);
|
||||
ps.setTxBufferOverflow(health.tx_buffer_overflow_pkt);
|
||||
ps.setRxBufferOverflow(health.rx_buffer_overflow_pkt);
|
||||
ps.setPandaType(hw_type);
|
||||
|
||||
@@ -489,7 +489,7 @@ class SelfdriveD(CruiseHelper):
|
||||
if not self.CP.passive and self.initialized:
|
||||
self.enabled, self.active = self.state_machine.update(self.events)
|
||||
if not self.CP.notCar:
|
||||
self.mads.update(CS, self.sm)
|
||||
self.mads.update(CS)
|
||||
self.update_alerts(CS)
|
||||
|
||||
self.publish_selfdriveState(CS)
|
||||
|
||||
+4
-20
@@ -24,7 +24,7 @@ THE SOFTWARE.
|
||||
Last updated: July 29, 2024
|
||||
"""
|
||||
|
||||
from cereal import messaging, car, log, custom
|
||||
from cereal import car, log, custom
|
||||
|
||||
from opendbc.car.hyundai.values import HyundaiFlags
|
||||
from opendbc.sunnypilot.car.hyundai.values import HyundaiFlagsSP
|
||||
@@ -48,7 +48,6 @@ class ModularAssistiveDrivingSystem:
|
||||
self.enabled = False
|
||||
self.active = False
|
||||
self.available = False
|
||||
self.mismatch_counter = 0
|
||||
self.allow_always = False
|
||||
self.selfdrive = selfdrive
|
||||
self.selfdrive.enabled_prev = False
|
||||
@@ -70,20 +69,7 @@ class ModularAssistiveDrivingSystem:
|
||||
self.main_enabled_toggle = self.mads_params.read_param("MadsMainCruiseAllowed")
|
||||
self.unified_engagement_mode = self.mads_params.read_param("MadsUnifiedEngagementMode")
|
||||
|
||||
def update_controls_mismatch(self, sm: messaging.SubMaster):
|
||||
heartbeat_engaged = self.active if self.pause_lateral_on_brake_toggle else self.enabled
|
||||
|
||||
if not heartbeat_engaged:
|
||||
self.mismatch_counter = 0
|
||||
|
||||
if heartbeat_engaged and any(not ps.controlsAllowedLat for ps in sm['pandaStates']
|
||||
if ps.safetyModel not in IGNORED_SAFETY_MODES):
|
||||
self.mismatch_counter += 1
|
||||
|
||||
if self.mismatch_counter >= 200:
|
||||
self.events.add(EventName.controlsMismatchLateral)
|
||||
|
||||
def update_events(self, CS: car.CarState, sm: messaging.SubMaster):
|
||||
def update_events(self, CS: car.CarState):
|
||||
def update_unified_engagement_mode():
|
||||
uem_blocked = self.enabled or (self.selfdrive.enabled and self.selfdrive.enabled_prev)
|
||||
if (self.unified_engagement_mode and uem_blocked) or not self.unified_engagement_mode:
|
||||
@@ -161,13 +147,11 @@ class ModularAssistiveDrivingSystem:
|
||||
if not any(be.type in SET_SPEED_BUTTONS for be in CS.buttonEvents):
|
||||
self.events.remove(EventName.wrongCarMode)
|
||||
|
||||
self.update_controls_mismatch(sm)
|
||||
|
||||
def update(self, CS: car.CarState, sm: messaging.SubMaster):
|
||||
def update(self, CS: car.CarState):
|
||||
if not self.enabled_toggle:
|
||||
return
|
||||
|
||||
self.update_events(CS, sm)
|
||||
self.update_events(CS)
|
||||
|
||||
if not self.selfdrive.CP.passive and self.selfdrive.initialized:
|
||||
self.enabled, self.active = self.state_machine.update(self.events)
|
||||
|
||||
Reference in New Issue
Block a user