mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 19:33:45 +08:00
d6474aa0a9
# Conflicts: # .github/workflows/selfdrive_tests.yaml # common/params.h # common/params_keys.h # common/params_pyx.pyx # docs/CARS.md # opendbc_repo # panda # selfdrive/car/tests/test_models.py # selfdrive/pandad/pandad.cc # selfdrive/pandad/pandad.h # selfdrive/selfdrived/selfdrived.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/athena/athenad.py # system/athena/manage_athenad.py # system/manager/manager.py # system/sentry.py # uv.lock Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master` Sync: `commaai/panda:master` into `sunnypilot/panda:master`
47 lines
1.5 KiB
Python
Executable File
47 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import time
|
|
from multiprocessing import Process
|
|
|
|
from openpilot.common.params import Params
|
|
from openpilot.system.manager.process import launcher
|
|
from openpilot.common.swaglog import cloudlog
|
|
from openpilot.system.hardware import HARDWARE
|
|
from openpilot.system.version import get_build_metadata
|
|
|
|
ATHENA_MGR_PID_PARAM = "AthenadPid"
|
|
|
|
|
|
def main():
|
|
manage_athenad("DongleId", ATHENA_MGR_PID_PARAM, 'athenad', 'system.athena.athenad')
|
|
|
|
|
|
def manage_athenad(dongle_id_param, pid_param, process_name, target):
|
|
params = Params()
|
|
dongle_id = params.get(dongle_id_param)
|
|
build_metadata = get_build_metadata()
|
|
|
|
cloudlog.bind_global(dongle_id=dongle_id,
|
|
version=build_metadata.openpilot.version,
|
|
origin=build_metadata.openpilot.git_normalized_origin,
|
|
branch=build_metadata.channel,
|
|
commit=build_metadata.openpilot.git_commit,
|
|
dirty=build_metadata.openpilot.is_dirty,
|
|
device=HARDWARE.get_device_type())
|
|
|
|
try:
|
|
while 1:
|
|
cloudlog.info(f"starting {process_name} daemon")
|
|
proc = Process(name=process_name, target=launcher, args=(target, process_name))
|
|
proc.start()
|
|
proc.join()
|
|
cloudlog.event(f"{process_name} exited", exitcode=proc.exitcode)
|
|
time.sleep(5)
|
|
except Exception:
|
|
cloudlog.exception(f"manage_{process_name}.exception")
|
|
finally:
|
|
params.remove(pid_param)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|