forked from IQ.Lvbs/IQ.Pilot
IQ.Pilot Release Commit @ cd83f5a
This commit is contained in:
@@ -58,7 +58,7 @@ class CarController(CarControllerBase):
|
||||
# Longitudinal control
|
||||
if self.CP.openpilotLongitudinalControl:
|
||||
if self.frame % 4 == 0:
|
||||
state = 13 if CC.cruiseControl.cancel or CS.das_accCancel else 4 # 4=ACC_ON, 13=ACC_CANCEL_GENERIC_SILENT
|
||||
state = 13 if CC.cruiseControl.cancel else 4 # 4=ACC_ON, 13=ACC_CANCEL_GENERIC_SILENT
|
||||
accel = float(np.clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX))
|
||||
if not CC.longActive:
|
||||
accel = 0.
|
||||
@@ -70,7 +70,7 @@ class CarController(CarControllerBase):
|
||||
comfort_mode=bool(getattr(CC, "longComfortMode", False)),
|
||||
stopping=getattr(actuators, "longControlState", None) ==
|
||||
structs.CarControl.Actuators.LongControlState.stopping,
|
||||
cancel=CC.cruiseControl.cancel or CS.das_accCancel))
|
||||
cancel=CC.cruiseControl.cancel))
|
||||
|
||||
else:
|
||||
# Increment counter so cancel is prioritized even without openpilot longitudinal
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import copy
|
||||
from iqdbc.can import CANDefine, CANParser
|
||||
from iqdbc.car import Bus, create_button_events, structs
|
||||
from iqdbc.car import Bus, structs
|
||||
from iqdbc.car.common.conversions import Conversions as CV
|
||||
from iqdbc.car.interfaces import CarStateBase
|
||||
from iqdbc.car.tesla import TESLA_BLINKERS
|
||||
@@ -10,8 +10,6 @@ from iqdbc.lvbs.car.tesla.iq_carstate import IQCarState
|
||||
from iqdbc.lvbs.car.tesla.values import TeslaFlagsIQ, TeslaSafetyFlagsIQ
|
||||
from iqpilot.common.params import Params
|
||||
|
||||
ButtonType = structs.CarState.ButtonEvent.Type
|
||||
|
||||
|
||||
def stock_autosteer_invalid(CP, CP_IQ, autopilot_state: int) -> bool:
|
||||
return (not (CP.flags & TeslaFlags.MISSING_DAS_SETTINGS) and
|
||||
@@ -33,9 +31,6 @@ class CarState(CarStateBase, IQCarState):
|
||||
self.cruise_enabled_prev = False
|
||||
|
||||
self.hands_on_level = 0
|
||||
self.acc_state_last = 0
|
||||
self.das_accCancel = False
|
||||
self.das_cancel_last = True
|
||||
self.das_control = None
|
||||
self.das_body_controls_dat = b""
|
||||
self._odometer_store = iq_lvbs_alc.create_vehicle_odometer_store(CP, Params())
|
||||
@@ -99,25 +94,12 @@ class CarState(CarStateBase, IQCarState):
|
||||
# Cruise state
|
||||
cruise_state = self.can_define.dv["DI_state"]["DI_cruiseState"].get(int(cp_party.vl["DI_state"]["DI_cruiseState"]), None)
|
||||
speed_units = self.can_define.dv["DI_state"]["DI_speedUnits"].get(int(cp_party.vl["DI_state"]["DI_speedUnits"]), None)
|
||||
acc_state = cp_ap_party.vl["DAS_control"]["DAS_accState"]
|
||||
|
||||
summon_state = self.can_define.dv["DI_state"]["DI_autoparkState"].get(int(cp_party.vl["DI_state"]["DI_autoparkState"]), None)
|
||||
cruise_enabled = cruise_state in ("ENABLED", "STANDSTILL", "OVERRIDE", "PRE_FAULT", "PRE_CANCEL")
|
||||
self.cruise_override = cruise_state in ("OVERRIDE")
|
||||
self.update_summon_state(summon_state, cruise_enabled)
|
||||
|
||||
# Respect all stock DAS cancel states, not just ACC_CANCEL_GENERIC_SILENT(13).
|
||||
# ELDA/ELK triggers ACC_CANCEL_GENERIC(0) which must also be forwarded.
|
||||
# The stock AP is isolated from the party bus while the relay is closed, so its accState
|
||||
# free-runs between ACC_ON and ACC_CANCEL_GENERIC. Only a rising edge while ACC is engaged
|
||||
# is a real cancel; level-forwarding it pins DI_cruiseState to UNAVAILABLE and blocks engaging.
|
||||
das_cancel = acc_state in (0, 1, 2, 12, 13, 14, 15)
|
||||
if not cruise_enabled:
|
||||
self.das_accCancel = False
|
||||
elif das_cancel and not self.das_cancel_last:
|
||||
self.das_accCancel = True
|
||||
self.das_cancel_last = das_cancel
|
||||
|
||||
# Match panda safety cruise engaged logic
|
||||
ret.cruiseState.enabled = cruise_enabled and not self.summon
|
||||
if speed_units == "KPH":
|
||||
@@ -130,9 +112,6 @@ class CarState(CarStateBase, IQCarState):
|
||||
ret.standstill = cp_party.vl["ESP_B"]["ESP_vehicleStandstillSts"] == 1
|
||||
ret.accFaulted = cruise_state == "FAULT"
|
||||
|
||||
ret.buttonEvents = [*create_button_events(acc_state, self.acc_state_last, {0: ButtonType.cancel, 13: ButtonType.cancel})]
|
||||
self.acc_state_last = acc_state
|
||||
|
||||
# Gear
|
||||
ret.gearShifter = GEAR_MAP[self.can_define.dv["DI_systemStatus"]["DI_gear"].get(int(cp_party.vl["DI_systemStatus"]["DI_gear"]), "DI_GEAR_INVALID")]
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ class IQCarState:
|
||||
prev_infotainment_3_finger_press = self.infotainment_3_finger_press
|
||||
self.infotainment_3_finger_press = int(cp_adas.vl["UI_status2"]["UI_activeTouchPoints"])
|
||||
|
||||
ret.buttonEvents = [*create_button_events(self.infotainment_3_finger_press, prev_infotainment_3_finger_press,
|
||||
ret.buttonEvents = [*ret.buttonEvents,
|
||||
*create_button_events(self.infotainment_3_finger_press, prev_infotainment_3_finger_press,
|
||||
{3: ButtonType.lkas})]
|
||||
|
||||
bms_soc_ui = float(cp_adas.vl["ID292BMS_SOC"].get("SOCUI292", 0.0))
|
||||
|
||||
Reference in New Issue
Block a user