ab9158bfb7
Discard the modelrevert tree adoption (8b4b7e0) and the in-process park short-circuits / cached-output / dashcam-idle work that came with it (0dc8002,37e095e). Restore the clearpilot tree as it stood atd639e28— the parked-controlsd manager-process split, the GPS-disable in locationd, the controlsd UI hooks, the boardd ignition-edge safety_setter_thread fix. After a full /data/params/d wipe and re-calibration drive, the modelrevert-tree variant overcorrected on turns; reverting to the parked-controlsd architecture (which Brian had previously vetted and documented in887b9c9+27cad05) and starting fresh. Single new commit, no merge — file state matchesd639e28byte-for-byte. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
129 lines
6.5 KiB
Python
Executable File
129 lines
6.5 KiB
Python
Executable File
import os
|
|
|
|
from cereal import car
|
|
from openpilot.common.params import Params
|
|
from openpilot.system.hardware import PC, TICI
|
|
from openpilot.selfdrive.manager.process import PythonProcess, NativeProcess, DaemonProcess
|
|
|
|
|
|
WEBCAM = os.getenv("USE_WEBCAM") is not None
|
|
BENCH_MODE = os.getenv("BENCH_MODE") is not None
|
|
|
|
def driverview(started: bool, params: Params, CP: car.CarParams) -> bool:
|
|
return started or params.get_bool("IsDriverViewEnabled")
|
|
|
|
def notcar(started: bool, params: Params, CP: car.CarParams) -> bool:
|
|
return started and CP.notCar
|
|
|
|
def iscar(started: bool, params: Params, CP: car.CarParams) -> bool:
|
|
return started and not CP.notCar
|
|
|
|
def logging(started, params, CP: car.CarParams) -> bool:
|
|
run = (not CP.notCar) or not params.get_bool("DisableLogging")
|
|
return started and run
|
|
|
|
def ublox_available() -> bool:
|
|
return os.path.exists('/dev/ttyHS0') and not os.path.exists('/persist/comma/use-quectel-gps')
|
|
|
|
def ublox(started, params, CP: car.CarParams) -> bool:
|
|
use_ublox = ublox_available()
|
|
if use_ublox != params.get_bool("UbloxAvailable"):
|
|
params.put_bool("UbloxAvailable", use_ublox)
|
|
return use_ublox
|
|
|
|
def qcomgps(started, params, CP: car.CarParams) -> bool:
|
|
return not ublox_available()
|
|
|
|
def always_run(started, params, CP: car.CarParams) -> bool:
|
|
return True
|
|
|
|
def only_onroad(started: bool, params, CP: car.CarParams) -> bool:
|
|
return started
|
|
|
|
def only_offroad(started, params, CP: car.CarParams) -> bool:
|
|
return not started
|
|
|
|
# CLEARPILOT: predicate for the parked controlsd variant. Runs while ignition
|
|
# is on but the car is in Park (so started=False because thermald has gated it
|
|
# off). Mutually exclusive with the full controlsd, which uses only_onroad.
|
|
def parked_only(started, params, CP: car.CarParams) -> bool:
|
|
return params.get_bool("IgnitionOn") and not started
|
|
|
|
# FrogPilot functions
|
|
def allow_logging(started, params, CP: car.CarParams) -> bool:
|
|
allow_logging = not (params.get_bool("DeviceManagement") and params.get_bool("NoLogging"))
|
|
return allow_logging and logging(started, params, CP)
|
|
|
|
def allow_uploads(started, params, CP: car.CarParams) -> bool:
|
|
allow_uploads = not (params.get_bool("DeviceManagement") and params.get_bool("NoUploads"))
|
|
return allow_uploads
|
|
|
|
# ClearPilot functions
|
|
def dashcam_should_run(started, params, CP: car.CarParams) -> bool:
|
|
return True # CLEARPILOT: dashcamd manages its own trip lifecycle
|
|
|
|
procs = [
|
|
DaemonProcess("manage_athenad", "selfdrive.athena.manage_athenad", "AthenadPid"),
|
|
|
|
NativeProcess("camerad", "system/camerad", ["./camerad"], always_run),
|
|
NativeProcess("logcatd", "system/logcatd", ["./logcatd"], allow_logging),
|
|
NativeProcess("proclogd", "system/proclogd", ["./proclogd"], allow_logging),
|
|
PythonProcess("logmessaged", "system.logmessaged", allow_logging),
|
|
PythonProcess("micd", "system.micd", iscar),
|
|
PythonProcess("timed", "system.timed", always_run, enabled=not PC),
|
|
|
|
PythonProcess("dmonitoringmodeld", "selfdrive.modeld.dmonitoringmodeld", driverview, enabled=(not PC or WEBCAM)),
|
|
# CLEARPILOT: disabled video encoding (camera .hevc files) — CAN/sensor logs still recorded via loggerd
|
|
# NativeProcess("encoderd", "system/loggerd", ["./encoderd"], allow_logging),
|
|
# NativeProcess("stream_encoderd", "system/loggerd", ["./encoderd", "--stream"], notcar),
|
|
NativeProcess("loggerd", "system/loggerd", ["./loggerd"], allow_logging),
|
|
NativeProcess("modeld", "selfdrive/modeld", ["./modeld"], only_onroad),
|
|
#NativeProcess("mapsd", "selfdrive/navd", ["./mapsd"], only_onroad),
|
|
#PythonProcess("navmodeld", "selfdrive.modeld.navmodeld", only_onroad),
|
|
NativeProcess("sensord", "system/sensord", ["./sensord"], only_onroad, enabled=not PC),
|
|
NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(5 if not PC else None), always_watchdog=only_offroad),
|
|
PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad),
|
|
NativeProcess("locationd", "selfdrive/locationd", ["./locationd"], only_onroad),
|
|
NativeProcess("boardd", "selfdrive/boardd", ["./boardd"], always_run, enabled=False),
|
|
PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad),
|
|
PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad),
|
|
PythonProcess("controlsd", "selfdrive.controls.controlsd", only_onroad),
|
|
# CLEARPILOT: lightweight CAN listener that runs while ignition is on and the
|
|
# car is parked. Publishes carState (so thermald can see gear); does no model,
|
|
# planner, or actuator work. Manager swaps it out for the full controlsd as
|
|
# soon as gear leaves Park.
|
|
PythonProcess("controlsd_parked", "selfdrive.controls.controlsd_parked", parked_only),
|
|
PythonProcess("deleter", "system.loggerd.deleter", always_run),
|
|
PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(not PC or WEBCAM)),
|
|
# PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI),
|
|
PythonProcess("gpsd", "system.clearpilot.gpsd", qcomgps, enabled=TICI),
|
|
# PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
|
|
#PythonProcess("navd", "selfdrive.navd.navd", only_onroad),
|
|
PythonProcess("pandad", "selfdrive.boardd.pandad", always_run),
|
|
PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad),
|
|
NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI),
|
|
PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI),
|
|
PythonProcess("plannerd", "selfdrive.controls.plannerd", only_onroad),
|
|
PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
|
|
PythonProcess("thermald", "selfdrive.thermald.thermald", always_run),
|
|
PythonProcess("tombstoned", "selfdrive.tombstoned", always_run, enabled=not PC),
|
|
# PythonProcess("updated", "selfdrive.updated.updated", always_run, enabled=not PC),
|
|
# PythonProcess("uploader", "system.loggerd.uploader", allow_uploads),
|
|
PythonProcess("statsd", "selfdrive.statsd", allow_logging),
|
|
|
|
# debug procs
|
|
NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar),
|
|
PythonProcess("webrtcd", "system.webrtc.webrtcd", notcar),
|
|
PythonProcess("webjoystick", "tools.bodyteleop.web", notcar),
|
|
|
|
# FrogPilot processes
|
|
PythonProcess("fleet_manager", "selfdrive.frogpilot.fleetmanager.fleet_manager", always_run),
|
|
PythonProcess("frogpilot_process", "selfdrive.frogpilot.frogpilot_process", always_run),
|
|
|
|
# ClearPilot processes
|
|
NativeProcess("dashcamd", "selfdrive/clearpilot", ["./dashcamd"], dashcam_should_run),
|
|
PythonProcess("telemetryd", "selfdrive.clearpilot.telemetryd", always_run),
|
|
PythonProcess("bench_onroad", "selfdrive.clearpilot.bench_onroad", always_run, enabled=BENCH_MODE),
|
|
]
|
|
|
|
managed_processes = {p.name: p for p in procs} |