This commit is contained in:
机械小鸽 2025-03-01 22:22:11 +08:00 committed by GitHub
parent c981eb3057
commit a1f6f78ccd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 9 deletions

View File

@ -213,7 +213,7 @@ class CarInterfaceBase(ABC):
dbc_names = {bus: cp.dbc_name for bus, cp in self.can_parsers.items()}
self.CC: CarControllerBase = CarController(dbc_names, CP)
Params().put('LongitudinalPersonalityMax', "3")
Params().put('LongitudinalPersonalityMax', "4") # 强制调整4
eps_firmware = str(next((fw.fwVersion for fw in CP.carFw if fw.ecu == "eps"), ""))
comma_nnff_supported = self.check_comma_nn_ff_support(CP.carFingerprint)
@ -221,7 +221,7 @@ class CarInterfaceBase(ABC):
self.use_nnff = not comma_nnff_supported and nnff_supported and Params().get_bool("NNFF")
self.use_nnff_lite = not self.use_nnff and Params().get_bool("NNFFLite")
def get_ff_nn(self, x):
return self.lat_torque_nn_model.evaluate(x)
@ -233,7 +233,7 @@ class CarInterfaceBase(ABC):
def initialize_lat_torque_nn(self, car, eps_firmware) -> bool:
self.lat_torque_nn_model = get_nn_model(car, eps_firmware)
return self.lat_torque_nn_model is not None
def apply(self, c: structs.CarControl, now_nanos: int | None = None) -> tuple[structs.CarControl.Actuators, list[CanData]]:
if now_nanos is None:
@ -267,7 +267,7 @@ class CarInterfaceBase(ABC):
ret.flags |= int(platform.config.flags)
ret = cls._get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs)
# Enable torque controller for all cars that do not use angle based steering
if ret.steerControlType != structs.CarParams.SteerControlType.angle and Params().get_bool("NNFF"):
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
@ -276,7 +276,7 @@ class CarInterfaceBase(ABC):
if model is not None:
Params().put_nonblocking("NNFFModelName", candidate.replace("_", " "))
print(f"NNFF loaded... {model}")
if Params().get_bool("DisableMinSteerSpeed"):
ret.minSteerSpeed = 0.
@ -453,7 +453,7 @@ class CarStateBase(ABC):
v_ego_x = self.v_ego_kf.update(v_ego_raw)
return float(v_ego_x[0]), float(v_ego_x[1])
def update_clu_speed_kf(self, v_ego_raw):
if abs(v_ego_raw - self.v_ego_clu_kf.x[0][0]) > 2.0: # Prevent large accelerations when car starts at non zero speed
self.v_ego_clu_kf.set_x([[v_ego_raw], [0.0]])

View File

@ -438,8 +438,8 @@ class VCruiseCarrot:
speed_kph = int(self.carrot_arg)
if 0 < speed_kph < 200:
v_cruise_kph = speed_kph
self._add_log(f"Cruise speed set to {v_cruise_kph} (carrot command)")
self._add_log(f"Cruise speed set to {v_cruise_kph} (carrot command)")
return v_cruise_kph, button_type, long_pressed
def _update_cruise_buttons(self, CS, CC, v_cruise_kph):
@ -512,7 +512,11 @@ class VCruiseCarrot:
v_cruise_kph = button_kph
self._v_cruise_kph_at_brake = 0
elif button_type == ButtonType.gapAdjustCruise:
self.params.put_int_nonblocking("MyDrivingMode", self.params.get_int("MyDrivingMode") % 4 + 1) # 1,2,3,4 (1:eco, 2:safe, 3:normal, 4:high speed)
current_speed_mode = self.params.get_int("SpeedFromPCM")
new_speed_mode = (current_speed_mode + 1) % 3
self.params.put_int_nonblocking("SpeedFromPCM", new_speed_mode)
self._add_log(f"SpeedFromPCM changed to {new_speed_mode}")
#self.params.put_int_nonblocking("MyDrivingMode", self.params.get_int("MyDrivingMode") % 4 + 1) # 1,2,3,4 (1:eco, 2:safe, 3:normal, 4:high speed)
elif button_type == ButtonType.lfaButton:
useLaneLineSpeed = max(1, self.useLaneLineSpeed)
self.params.put_int_nonblocking("UseLaneLineSpeedApply", useLaneLineSpeed if self.params.get_int("UseLaneLineSpeedApply") == 0 else 0)