restore driving logic to pre-variable-fps baseline
Wholesale revert of driving-relevant files to the snapshot in /projects/openpilot/archive/clearpilot (HEAD 980f0aa). Goal: get known-good driving behavior back, then re-introduce optimizations slowly to track down a "feels like the wheel pulls right" regression. Files restored from baseline: - selfdrive/controls/controlsd.py - selfdrive/controls/lib/events.py - selfdrive/controls/lib/longitudinal_planner.py - selfdrive/modeld/modeld.py - selfdrive/modeld/dmonitoringmodeld.py - selfdrive/locationd/calibrationd.py - selfdrive/locationd/paramsd.py - selfdrive/locationd/torqued.py - selfdrive/car/interfaces.py - selfdrive/car/hyundai/carstate.py (CAN-FD telemetry preserved as a commented block for future re-enable) - selfdrive/monitoring/dmonitoringd.py - selfdrive/frogpilot/controls/frogpilot_planner.py - common/realtime.py Intentionally NOT restored (kept as current): - selfdrive/thermald/* (fan/power tuning kept) - selfdrive/car/hyundai/carcontroller.py + hyundaicanfd.py (perf-only hoist of no_lat_lane_change Params read; behavior-equivalent) - cereal/services.py, cereal/custom.capnp (additive only) - selfdrive/manager/*, common/params.cc (heavy ClearPilot infrastructure: bench mode, log dir, dashcamd, gpsd, params) - All selfdrive/ui/, selfdrive/clearpilot/, system/clearpilot/ UI features will be re-wired in a follow-up commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,6 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
|
||||
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CAN_GEARS, CAMERA_SCC_CAR, \
|
||||
CANFD_CAR, Buttons, CarControllerParams
|
||||
from openpilot.selfdrive.car.interfaces import CarStateBase
|
||||
from openpilot.selfdrive.clearpilot.telemetry import tlog
|
||||
|
||||
PREV_BUTTON_SAMPLES = 8
|
||||
CLUSTER_SAMPLE_RATE = 20 # frames
|
||||
@@ -48,10 +47,6 @@ class CarState(CarStateBase):
|
||||
self.is_metric = False
|
||||
self.buttons_counter = 0
|
||||
|
||||
# CLEARPILOT: cache to avoid per-cycle atomic writes to /dev/shm (eats CPU via fsync/flock)
|
||||
self._prev_car_speed_limit = None
|
||||
self._prev_car_is_metric = None
|
||||
|
||||
self.cruise_info = {}
|
||||
|
||||
# On some cars, CLU15->CF_Clu_VehicleSpeed can oscillate faster than the dash updates. Sample at 5 Hz
|
||||
@@ -214,15 +209,10 @@ class CarState(CarStateBase):
|
||||
self.lkas_previously_enabled = self.lkas_enabled
|
||||
self.lkas_enabled = cp.vl["BCM_PO_11"]["LFA_Pressed"]
|
||||
|
||||
# CLEARPILOT: gate on change — see same fix in update_canfd
|
||||
car_speed_limit = self.calculate_speed_limit(cp, cp_cam) * speed_conv
|
||||
if car_speed_limit != self._prev_car_speed_limit:
|
||||
self.params_memory.put_float("CarSpeedLimit", car_speed_limit)
|
||||
self._prev_car_speed_limit = car_speed_limit
|
||||
if self.is_metric != self._prev_car_is_metric:
|
||||
self.params_memory.put("CarIsMetric", "1" if self.is_metric else "0")
|
||||
self._prev_car_is_metric = self.is_metric
|
||||
|
||||
# self.params_memory.put_int("CarSpeedLimitLiteral", self.calculate_speed_limit(cp, cp_cam))
|
||||
self.params_memory.put_float("CarSpeedLimit", self.calculate_speed_limit(cp, cp_cam) * speed_conv)
|
||||
self.params_memory.put_float("CarCruiseDisplayActual", cp_cruise.vl["SCC11"]["VSetDis"])
|
||||
|
||||
|
||||
return ret
|
||||
|
||||
@@ -425,23 +415,63 @@ class CarState(CarStateBase):
|
||||
# nonAdaptive = false,
|
||||
# speedCluster = 0 )
|
||||
|
||||
# CLEARPILOT: gate on change — these writes run 100Hz, each is an atomic fsync/flock transaction
|
||||
car_speed_limit = self.calculate_speed_limit(cp, cp_cam) * speed_factor
|
||||
if car_speed_limit != self._prev_car_speed_limit:
|
||||
self.params_memory.put_float("CarSpeedLimit", car_speed_limit)
|
||||
self._prev_car_speed_limit = car_speed_limit
|
||||
if self.is_metric != self._prev_car_is_metric:
|
||||
self.params_memory.put("CarIsMetric", "1" if self.is_metric else "0")
|
||||
self._prev_car_is_metric = self.is_metric
|
||||
# print("Set limit")
|
||||
# print(self.calculate_speed_limit(cp, cp_cam))
|
||||
# self.params_memory.put_float("CarSpeedLimitLiteral", self.calculate_speed_limit(cp, cp_cam))
|
||||
self.params_memory.put_float("CarSpeedLimit", self.calculate_speed_limit(cp, cp_cam) * speed_factor)
|
||||
|
||||
# CLEARPILOT: telemetry logging — disabled, re-enable when needed
|
||||
# CLEARPILOT: CAN-FD telemetry — preserved but disabled. Re-enable by uncommenting (also restore the import).
|
||||
# from openpilot.selfdrive.clearpilot.telemetry import tlog
|
||||
#
|
||||
# speed_limit_bus = cp if self.CP.flags & HyundaiFlags.CANFD_HDA2 else cp_cam
|
||||
# scc = cp_cam.vl["SCC_CONTROL"] if self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC else cp.vl["SCC_CONTROL"]
|
||||
# cluster = speed_limit_bus.vl["CLUSTER_SPEED_LIMIT"]
|
||||
# tlog("car", { ... })
|
||||
# tlog("cruise", { ... })
|
||||
# tlog("speed_limit", { ... })
|
||||
# tlog("buttons", { ... })
|
||||
#
|
||||
# tlog("car", {
|
||||
# "vEgo": round(ret.vEgo, 3),
|
||||
# "vEgoRaw": round(ret.vEgoRaw, 3),
|
||||
# "aEgo": round(ret.aEgo, 3),
|
||||
# "steeringAngleDeg": round(ret.steeringAngleDeg, 1),
|
||||
# "gear": str(ret.gearShifter),
|
||||
# "brakePressed": ret.brakePressed,
|
||||
# "gasPressed": ret.gasPressed,
|
||||
# "standstill": ret.standstill,
|
||||
# "leftBlinker": ret.leftBlinker,
|
||||
# "rightBlinker": ret.rightBlinker,
|
||||
# })
|
||||
#
|
||||
# tlog("cruise", {
|
||||
# "enabled": ret.cruiseState.enabled,
|
||||
# "available": ret.cruiseState.available,
|
||||
# "speed": round(ret.cruiseState.speed, 3),
|
||||
# "standstill": ret.cruiseState.standstill,
|
||||
# "accFaulted": ret.accFaulted,
|
||||
# "ACCMode": scc.get("ACCMode", 0),
|
||||
# "VSetDis": scc.get("VSetDis", 0),
|
||||
# "aReqRaw": round(scc.get("aReqRaw", 0), 3),
|
||||
# "aReqValue": round(scc.get("aReqValue", 0), 3),
|
||||
# "DISTANCE_SETTING": scc.get("DISTANCE_SETTING", 0),
|
||||
# "ACC_ObjDist": round(scc.get("ACC_ObjDist", 0), 1),
|
||||
# })
|
||||
#
|
||||
# tlog("speed_limit", {
|
||||
# "SPEED_LIMIT_1": cluster.get("SPEED_LIMIT_1", 0),
|
||||
# "SPEED_LIMIT_2": cluster.get("SPEED_LIMIT_2", 0),
|
||||
# "SPEED_LIMIT_3": cluster.get("SPEED_LIMIT_3", 0),
|
||||
# "SCHOOL_ZONE": cluster.get("SCHOOL_ZONE", 0),
|
||||
# "CHIME_1": cluster.get("CHIME_1", 0),
|
||||
# "CHIME_2": cluster.get("CHIME_2", 0),
|
||||
# "SPEED_CHANGE_BLINKING": cluster.get("SPEED_CHANGE_BLINKING", 0),
|
||||
# "calculated": self.calculate_speed_limit(cp, cp_cam),
|
||||
# "is_metric": self.is_metric,
|
||||
# })
|
||||
#
|
||||
# tlog("buttons", {
|
||||
# "cruise_button": self.cruise_buttons[-1],
|
||||
# "main_button": self.main_buttons[-1],
|
||||
# "lkas_enabled": self.lkas_enabled,
|
||||
# "main_enabled": self.main_enabled,
|
||||
# })
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
Reference in New Issue
Block a user