mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 10:03:55 +08:00
* add longitudinal profiles * stash * unfortunately even longitudinalPlan causes circle * add to process config * reach target speed smoothly * stash * works * clean up * debug alert * rename * fix * better text * toggle via exp button * try coming to a stop better, smoother target reaching * closer to target * revert controlsd migration * add description to alert * generate report from local logs * hide bad maneuvers * pdflike * Revert "pdflike" This reverts commit 6d4af1bf9be2e9e0798eaecf026a53d860da7613. * try this * use alert manager * fix that check * wat * Revert "wat" This reverts commit 93d0d27ab838d3f580d06ff212f380e0b912d599. * some clean up * rm * cleanup * move * fix test * more fix * clean up * fix that
106 lines
5.1 KiB
Python
106 lines
5.1 KiB
Python
import os
|
|
|
|
from cereal import car
|
|
from openpilot.common.params import Params
|
|
from openpilot.system.hardware import PC, TICI
|
|
from openpilot.system.manager.process import PythonProcess, NativeProcess, DaemonProcess
|
|
|
|
WEBCAM = os.getenv("USE_WEBCAM") 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 started and use_ublox
|
|
|
|
def joystick(started: bool, params, CP: car.CarParams) -> bool:
|
|
return started and params.get_bool("JoystickDebugMode")
|
|
|
|
def not_joystick(started: bool, params, CP: car.CarParams) -> bool:
|
|
return started and not params.get_bool("JoystickDebugMode")
|
|
|
|
def long_maneuver(started: bool, params, CP: car.CarParams) -> bool:
|
|
return started and params.get_bool("LongitudinalManeuverMode")
|
|
|
|
def not_long_maneuver(started: bool, params, CP: car.CarParams) -> bool:
|
|
return started and not params.get_bool("LongitudinalManeuverMode")
|
|
|
|
def qcomgps(started, params, CP: car.CarParams) -> bool:
|
|
return started and 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
|
|
|
|
procs = [
|
|
DaemonProcess("manage_athenad", "system.athena.manage_athenad", "AthenadPid"),
|
|
|
|
NativeProcess("camerad", "system/camerad", ["./camerad"], driverview),
|
|
NativeProcess("logcatd", "system/logcatd", ["./logcatd"], only_onroad),
|
|
NativeProcess("proclogd", "system/proclogd", ["./proclogd"], only_onroad),
|
|
PythonProcess("logmessaged", "system.logmessaged", always_run),
|
|
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)),
|
|
NativeProcess("encoderd", "system/loggerd", ["./encoderd"], only_onroad),
|
|
NativeProcess("stream_encoderd", "system/loggerd", ["./encoderd", "--stream"], notcar),
|
|
NativeProcess("loggerd", "system/loggerd", ["./loggerd"], logging),
|
|
NativeProcess("modeld", "selfdrive/modeld", ["./modeld"], 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)),
|
|
PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad),
|
|
PythonProcess("locationd", "selfdrive.locationd.locationd", only_onroad),
|
|
NativeProcess("pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False),
|
|
PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad),
|
|
PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad),
|
|
PythonProcess("controlsd", "selfdrive.controls.controlsd", not_joystick),
|
|
PythonProcess("joystickd", "tools.joystick.joystickd", joystick),
|
|
PythonProcess("selfdrived", "selfdrive.selfdrived.selfdrived", only_onroad),
|
|
PythonProcess("card", "selfdrive.car.card", only_onroad),
|
|
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("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
|
|
PythonProcess("pandad", "selfdrive.pandad.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", not_long_maneuver),
|
|
PythonProcess("maneuversd", "tools.longitudinal_maneuvers.maneuversd", long_maneuver),
|
|
PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
|
|
PythonProcess("hardwared", "system.hardware.hardwared", always_run),
|
|
PythonProcess("tombstoned", "system.tombstoned", always_run, enabled=not PC),
|
|
PythonProcess("updated", "system.updated.updated", only_offroad, enabled=not PC),
|
|
PythonProcess("uploader", "system.loggerd.uploader", always_run),
|
|
PythonProcess("statsd", "system.statsd", always_run),
|
|
|
|
# debug procs
|
|
NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar),
|
|
PythonProcess("webrtcd", "system.webrtc.webrtcd", notcar),
|
|
PythonProcess("webjoystick", "tools.bodyteleop.web", notcar),
|
|
]
|
|
|
|
managed_processes = {p.name: p for p in procs}
|