0dc8002c6d
Three independent changes bundled together. Revert hyundai canfd steering torque limits to comma stock defaults (270 / 2 / 3 / 112) in both panda safety and openpilot CarControllerParams. The 270->324 bump caused overcorrection on turns and weaving on straights. Web research turned up no public reports of any 4th gen Tucson NX4 owner bumping STEER_MAX — the documented Tucson tuning effort is entirely on lateralTuning (latAccelFactor ~2.9-3.1, friction ~0.095), not the cap. hoomoose's EV6/Ioniq 5 PR #25723 is the canonical "raise STEER_MAX without dropping latAccelFactor causes overcorrection" data point — and even that change was reverted upstream. Right next move for this car is to tune latAccelFactor / friction, not the torque ceiling. plannerd: keep publishing longitudinalPlan at the normal cadence in park, but skip update() compute. Skipping publishes entirely caused longitudinalPlan to time out the alive flag at controlsd, which fired a real commIssue ("not_alive") on park->drive. Stale published values are fine because controlsd's own park short-circuit ignores the longitudinalPlan content while parked. Also gate publish_ui_plan on not-parked: it reads longitudinal_planner.a_desired_trajectory_full which is only set inside update(), so calling it without a prior update crashes plannerd with AttributeError (which fires "Process Not Running" on screen). uiPlan is UI-only, not on controlsd's commIssue check list, so going silent in park is fine. frogpilot_process: same idea — keep publishing frogpilotPlan in park to keep alive, skip the heavy update() compute. dashcamd: close the trip immediately on gear shift to PARK (was: 10-min idle timer before close). User wants the dashcam idle in park and a fresh trip on every drive engagement; brief drive-thru / fuel-stop across-trip continuity isn't valued. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
59 lines
2.5 KiB
Python
Executable File
59 lines
2.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from cereal import car
|
|
from openpilot.common.params import Params
|
|
from openpilot.common.realtime import Priority, config_realtime_process
|
|
from openpilot.common.swaglog import cloudlog
|
|
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
|
|
import cereal.messaging as messaging
|
|
|
|
def publish_ui_plan(sm, pm, longitudinal_planner):
|
|
ui_send = messaging.new_message('uiPlan')
|
|
ui_send.valid = sm.all_checks(service_list=['carState', 'controlsState', 'modelV2'])
|
|
uiPlan = ui_send.uiPlan
|
|
uiPlan.frameId = sm['modelV2'].frameId
|
|
uiPlan.position.x = list(sm['modelV2'].position.x)
|
|
uiPlan.position.y = list(sm['modelV2'].position.y)
|
|
uiPlan.position.z = list(sm['modelV2'].position.z)
|
|
uiPlan.accel = longitudinal_planner.a_desired_trajectory_full.tolist()
|
|
pm.send('uiPlan', ui_send)
|
|
|
|
def plannerd_thread():
|
|
config_realtime_process(5, Priority.CTRL_LOW)
|
|
|
|
cloudlog.info("plannerd is waiting for CarParams")
|
|
params = Params()
|
|
with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg:
|
|
CP = msg
|
|
cloudlog.info("plannerd got CarParams: %s", CP.carName)
|
|
|
|
longitudinal_planner = LongitudinalPlanner(CP)
|
|
pm = messaging.PubMaster(['longitudinalPlan', 'uiPlan'])
|
|
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'radarState', 'modelV2', 'frogpilotCarControl', 'frogpilotPlan'],
|
|
poll='modelV2', ignore_avg_freq=['radarState'])
|
|
|
|
while True:
|
|
sm.update()
|
|
if sm.updated['modelV2']:
|
|
# CLEARPILOT: skip the planning compute while parked, but KEEP publishing
|
|
# at the normal cadence so consumers' alive flags stay healthy. Skipping
|
|
# publishes entirely caused longitudinalPlan to go alive=False at
|
|
# controlsd, which fires a real commIssue the moment we shift out of park.
|
|
# Stale published values are fine — controlsd's own park short-circuit
|
|
# ignores the longitudinalPlan content while parked anyway.
|
|
parked = sm['carState'].gearShifter == car.CarState.GearShifter.park
|
|
if not parked:
|
|
longitudinal_planner.update(sm)
|
|
longitudinal_planner.publish(sm, pm)
|
|
# publish_ui_plan reads longitudinal_planner.a_desired_trajectory_full
|
|
# which is only set inside update(). Skip it while parked — uiPlan is
|
|
# UI-only, not on controlsd's commIssue check list, so going silent is fine.
|
|
if not parked:
|
|
publish_ui_plan(sm, pm, longitudinal_planner)
|
|
|
|
def main():
|
|
plannerd_thread()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|