stop distance

This commit is contained in:
firestar5683
2026-03-09 18:22:12 -05:00
parent 9d16f6c96b
commit 8c5767c328
3 changed files with 34 additions and 7 deletions
+1
View File
@@ -577,6 +577,7 @@ class FrogPilotVariables:
toggle.has_cc_long = toggle.car_make == "gm" and bool(CP.flags & GMFlags.CC_LONG.value)
has_nnff = nnff_supported(toggle.car_model)
toggle.has_pedal = CP.enableGasInterceptor
params_default.put("IncreasedStoppedDistance", "4" if toggle.has_pedal else "0")
has_radar = not CP.radarUnavailable
toggle.has_sdsu = toggle.car_make == "toyota" and bool(CP.flags & ToyotaFlags.SMART_DSU.value)
toggle.has_sascm = toggle.car_make == "gm" and bool(CP.flags & GMFlags.SASCM.value)
+8 -6
View File
@@ -45,6 +45,7 @@ BOLT_PEDAL_LONG_CARS = {
CAR.CHEVROLET_BOLT_CC_2019_2021,
CAR.CHEVROLET_BOLT_ACC_2022_2023_PEDAL,
CAR.CHEVROLET_BOLT_CC_2022_2023,
CAR.CHEVROLET_MALIBU_HYBRID_CC,
}
NON_LINEAR_TORQUE_PARAMS = {
@@ -502,7 +503,7 @@ class CarInterface(CarInterfaceBase):
ret.flags |= GMFlags.PEDAL_LONG.value
gm_safety_cfg.safetyParam |= Panda.FLAG_GM_PEDAL_LONG
# Note: Low speed, stop and go not tested. Should be fairly smooth on highway
if candidate in (CAR.CHEVROLET_MALIBU_CC, CAR.CHEVROLET_MALIBU_HYBRID_CC):
if candidate == CAR.CHEVROLET_MALIBU_CC:
ret.longitudinalTuning.kpBP = [0.0, 5.0, 35.0]
ret.longitudinalTuning.kpV = [0.06, 0.05, 0.04]
ret.longitudinalTuning.kiBP = [0.0, 5., 35.]
@@ -533,11 +534,12 @@ class CarInterface(CarInterfaceBase):
if ret.enableGasInterceptor and candidate == CAR.CHEVROLET_MALIBU_HYBRID_CC:
ret.flags |= GMFlags.PEDAL_LONG.value
gm_safety_cfg.safetyParam |= Panda.FLAG_GM_PEDAL_LONG
ret.longitudinalTuning.kpBP = [0.0, 5.0, 35.0]
ret.longitudinalTuning.kpV = [0.06, 0.05, 0.04]
ret.longitudinalTuning.kiBP = [0.0, 5., 35.]
ret.longitudinalTuning.kiV = [0.0, 0.30, 0.45]
ret.longitudinalTuning.kfDEPRECATED = 0.15
# Keep Malibu Hybrid pedal on the same longitudinal tune as Bolt pedal cars.
ret.longitudinalTuning.kpBP = [0.0, 5.0, 15.0, 35.0]
ret.longitudinalTuning.kpV = [0.095, 0.085, 0.065, 0.050]
ret.longitudinalTuning.kiBP = [0.0, 3.0, 6.0, 35.0]
ret.longitudinalTuning.kiV = [0.07, 0.10, 0.15, 0.24]
ret.longitudinalTuning.kfDEPRECATED = 0.20
ret.stoppingDecelRate = 0.8
ret.minEnableSpeed = -1
ret.pcmCruise = False
+25 -1
View File
@@ -5,7 +5,7 @@ import signal
import sys
import traceback
from cereal import log
from cereal import car, log
import cereal.messaging as messaging
import openpilot.system.sentry as sentry
from openpilot.common.params import Params, ParamKeyType
@@ -53,10 +53,24 @@ def manager_init() -> None:
if params.get_bool("RecordFrontLock"):
params.put_bool("RecordFront", True)
# Detect pedal capability for pedal-specific defaults/migrations.
has_pedal = False
cp_persistent_bytes = params.get("CarParamsPersistent")
if cp_persistent_bytes is not None:
try:
with car.CarParams.from_bytes(cp_persistent_bytes) as cp_reader:
has_pedal = cp_reader.enableGasInterceptor
except Exception:
cloudlog.exception("failed parsing CarParamsPersistent for pedal defaults")
# set unset params
reset_toggles = params.get_bool("DoToggleReset")
reset_toggles_stock = params.get_bool("DoToggleResetStock")
for k, v, stock in [(k, v, v) for k, v in default_params] + [(k, v, stock) for k, v, _, stock in frogpilot_default_params]:
if has_pedal and k == "IncreasedStoppedDistance":
v = "4"
stock = "4"
if (reset_toggles or reset_toggles_stock) and k in EXCLUDED_KEYS:
continue
@@ -239,6 +253,16 @@ def manager_init() -> None:
with open(lateral_tuning_migration_flag_file, "w") as f:
f.write("migrated")
# One-time migration: default IncreasedStoppedDistance to 4 ft for pedal cars
pedal_stop_distance_migration_flag_file = "/data/frogpilot_pedal_stop_distance_migrated.flag"
if not os.path.exists(pedal_stop_distance_migration_flag_file):
if has_pedal:
if params.get_int("IncreasedStoppedDistance") != 4:
params.put_int("IncreasedStoppedDistance", 4)
params_cache.put_int("IncreasedStoppedDistance", 4)
with open(pedal_stop_distance_migration_flag_file, "w") as f:
f.write("migrated")
# set dongle id
reg_res = register(show_spinner=True)
if reg_res: