mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-28 01:52:06 +08:00
EV6: reject fake cruise engagements (#25143)
* EV6: reject fake cruise engagements * bump panda * raise to 8 * update refs * bump panda Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: 44c6ca7eb4c9ea83aca18d4f648764cabdad8861
This commit is contained in:
+1
-1
Submodule opendbc updated: 81148db67f...3fb3f5e821
+1
-1
Submodule panda updated: baecd2ecc6...2abeab913f
@@ -82,12 +82,12 @@ class CarController:
|
||||
if (self.frame - self.last_button_frame) * DT_CTRL > 0.25:
|
||||
if CC.cruiseControl.cancel:
|
||||
for _ in range(20):
|
||||
can_sends.append(hda2can.create_buttons(self.packer, CS.buttons_counter+1, True, False))
|
||||
can_sends.append(hda2can.create_buttons(self.packer, CS.buttons_counter+1, Buttons.CANCEL))
|
||||
self.last_button_frame = self.frame
|
||||
|
||||
# cruise standstill resume
|
||||
elif CC.cruiseControl.resume:
|
||||
can_sends.append(hda2can.create_buttons(self.packer, CS.buttons_counter+1, False, True))
|
||||
can_sends.append(hda2can.create_buttons(self.packer, CS.buttons_counter+1, Buttons.RES_ACCEL))
|
||||
self.last_button_frame = self.frame
|
||||
else:
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from opendbc.can.can_define import CANDefine
|
||||
from selfdrive.car.hyundai.values import DBC, FEATURES, HDA2_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams
|
||||
from selfdrive.car.interfaces import CarStateBase
|
||||
|
||||
PREV_BUTTON_SAMPLES = 4
|
||||
PREV_BUTTON_SAMPLES = 8
|
||||
|
||||
|
||||
class CarState(CarStateBase):
|
||||
@@ -171,7 +171,10 @@ class CarState(CarStateBase):
|
||||
speed_factor = CV.MPH_TO_MS if cp.vl["CLUSTER_INFO"]["DISTANCE_UNIT"] == 1 else CV.KPH_TO_MS
|
||||
ret.cruiseState.speed = cp.vl["CRUISE_INFO"]["SET_SPEED"] * speed_factor
|
||||
|
||||
self.buttons_counter = cp.vl["CRUISE_BUTTONS"]["_COUNTER"]
|
||||
self.cruise_buttons.extend(cp.vl_all["CRUISE_BUTTONS"]["CRUISE_BUTTONS"])
|
||||
self.main_buttons.extend(cp.vl_all["CRUISE_BUTTONS"]["ADAPTIVE_CRUISE_MAIN_BTN"])
|
||||
self.buttons_counter = cp.vl["CRUISE_BUTTONS"]["COUNTER"]
|
||||
|
||||
self.cam_0x2a4 = copy.copy(cp_cam.vl["CAM_0x2a4"])
|
||||
|
||||
return ret
|
||||
@@ -362,7 +365,9 @@ class CarState(CarStateBase):
|
||||
("CRUISE_ACTIVE", "SCC1"),
|
||||
("SET_SPEED", "CRUISE_INFO"),
|
||||
("CRUISE_STANDSTILL", "CRUISE_INFO"),
|
||||
("_COUNTER", "CRUISE_BUTTONS"),
|
||||
("COUNTER", "CRUISE_BUTTONS"),
|
||||
("CRUISE_BUTTONS", "CRUISE_BUTTONS"),
|
||||
("ADAPTIVE_CRUISE_MAIN_BTN", "CRUISE_BUTTONS"),
|
||||
|
||||
("DISTANCE_UNIT", "CLUSTER_INFO"),
|
||||
|
||||
|
||||
@@ -18,11 +18,9 @@ def create_cam_0x2a4(packer, frame, camera_values):
|
||||
})
|
||||
return packer.make_can_msg("CAM_0x2a4", 4, camera_values, frame % 255)
|
||||
|
||||
def create_buttons(packer, cnt, cancel, resume):
|
||||
def create_buttons(packer, cnt, btn):
|
||||
values = {
|
||||
"_COUNTER": cnt % 0xf,
|
||||
"SET_ME_1": 1,
|
||||
"DISTANCE_BTN": 1 if resume else 0,
|
||||
"PAUSE_RESUME_BTN": 1 if cancel else 0,
|
||||
"CRUISE_BUTTONS": btn,
|
||||
}
|
||||
return packer.make_can_msg("CRUISE_BUTTONS", 5, values)
|
||||
return packer.make_can_msg("CRUISE_BUTTONS", 5, values, cnt % 0xf)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
from cereal import car
|
||||
from panda import Panda
|
||||
from common.conversions import Conversions as CV
|
||||
from selfdrive.car.hyundai.values import CAR, DBC, HDA2_CAR, EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, Buttons, CarControllerParams
|
||||
from selfdrive.car.hyundai.values import CAR, DBC, EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, Buttons, CarControllerParams
|
||||
from selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR
|
||||
from selfdrive.car import STD_CARGO_KG, create_button_enable_events, create_button_event, scale_rot_inertia, scale_tire_stiffness, gen_empty_fingerprint, get_safety_config
|
||||
from selfdrive.car.interfaces import CarInterfaceBase
|
||||
@@ -321,8 +321,7 @@ class CarInterface(CarInterfaceBase):
|
||||
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
|
||||
# Main button also can trigger an engagement on these cars
|
||||
allow_enable = any(btn in ENABLE_BUTTONS for btn in self.CS.cruise_buttons) or any(self.CS.main_buttons)
|
||||
allow_enable = allow_enable or self.CP.carFingerprint in HDA2_CAR
|
||||
events = self.create_common_events(ret, pcm_enable=self.CS.CP.pcmCruise, allow_enable=allow_enable or True)
|
||||
events = self.create_common_events(ret, pcm_enable=self.CS.CP.pcmCruise, allow_enable=allow_enable)
|
||||
|
||||
if self.CS.brake_error:
|
||||
events.add(EventName.brakeUnavailable)
|
||||
|
||||
@@ -167,7 +167,7 @@ class Buttons:
|
||||
RES_ACCEL = 1
|
||||
SET_DECEL = 2
|
||||
GAP_DIST = 3
|
||||
CANCEL = 4
|
||||
CANCEL = 4 # on newer models, this is a pause/resume button
|
||||
|
||||
FINGERPRINTS = {
|
||||
CAR.ELANTRA: [{
|
||||
|
||||
@@ -1 +1 @@
|
||||
11e721366f1c177a84e6cb8b48171113ac3b54f9
|
||||
5efbbdf69e16db3d989bfaf62d10e958e80b9ca2
|
||||
Reference in New Issue
Block a user