From 248c3d2561bc336f4f92a2eec1aa753dfc5d2da9 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 31 Oct 2024 13:20:57 -0700 Subject: [PATCH 1/2] do what nidec does --- opendbc/car/ford/interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/opendbc/car/ford/interface.py b/opendbc/car/ford/interface.py index 4fc5df40bb..ce7b32c25a 100644 --- a/opendbc/car/ford/interface.py +++ b/opendbc/car/ford/interface.py @@ -1,14 +1,23 @@ from panda import Panda +from opendbc.car.common.numpy_fast import interp from opendbc.car import get_safety_config, structs from opendbc.car.common.conversions import Conversions as CV from opendbc.car.ford.fordcan import CanBus -from opendbc.car.ford.values import DBC, Ecu, FordFlags, RADAR +from opendbc.car.ford.values import CarControllerParams, DBC, Ecu, FordFlags, RADAR from opendbc.car.interfaces import CarInterfaceBase TransmissionType = structs.CarParams.TransmissionType class CarInterface(CarInterfaceBase): + @staticmethod + def get_pid_accel_limits(CP, current_speed, cruise_speed): + # PCM doesn't allow acceleration near cruise_speed, + # so limit limits of pid to prevent windup + ACCEL_MAX_VALS = [CarControllerParams.ACCEL_MAX, 0.2] + ACCEL_MAX_BP = [cruise_speed - 2., cruise_speed - .2] + return CarControllerParams.ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS) + @staticmethod def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams: ret.carName = "ford" From 2d2c99320c5702e92ae62b34abe971226bf305a0 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 31 Oct 2024 13:41:48 -0700 Subject: [PATCH 2/2] ~0.5 is what it hovers around --- opendbc/car/ford/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/ford/interface.py b/opendbc/car/ford/interface.py index ce7b32c25a..ebd8f5443d 100644 --- a/opendbc/car/ford/interface.py +++ b/opendbc/car/ford/interface.py @@ -15,7 +15,7 @@ def get_pid_accel_limits(CP, current_speed, cruise_speed): # PCM doesn't allow acceleration near cruise_speed, # so limit limits of pid to prevent windup ACCEL_MAX_VALS = [CarControllerParams.ACCEL_MAX, 0.2] - ACCEL_MAX_BP = [cruise_speed - 2., cruise_speed - .2] + ACCEL_MAX_BP = [cruise_speed - 2., cruise_speed - .4] return CarControllerParams.ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS) @staticmethod