mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-16 23:52:06 +08:00
14318d2f09
# Conflicts: # .github/labeler.yaml # .github/workflows/auto_pr_review.yaml # .github/workflows/docs.yaml # .github/workflows/release.yaml # .github/workflows/repo-maintenance.yaml # .github/workflows/tests.yaml # .github/workflows/ui_preview.yaml # README.md # SConstruct # conftest.py # docs/CARS.md # msgq_repo # opendbc_repo # openpilot/cereal/messaging/tests/validate_sp_cereal_upstream.py # openpilot/common/api.py # openpilot/common/hardware/hw.py # openpilot/common/version.py # openpilot/selfdrive/assets/fonts/Audiowide-Regular.ttf # openpilot/selfdrive/assets/sounds/prompt_single_high.wav # openpilot/selfdrive/assets/sounds/prompt_single_low.wav # openpilot/selfdrive/car/card.py # openpilot/selfdrive/car/helpers.py # openpilot/selfdrive/car/tests/test_car_interfaces.py # openpilot/selfdrive/car/tests/test_cruise_speed.py # openpilot/selfdrive/controls/lib/desire_helper.py # openpilot/selfdrive/controls/lib/longcontrol.py # openpilot/selfdrive/controls/plannerd.py # openpilot/selfdrive/controls/radard.py # openpilot/selfdrive/controls/tests/test_longcontrol.py # openpilot/selfdrive/modeld/compile_warp.py # openpilot/selfdrive/modeld/modeld.py # openpilot/selfdrive/monitoring/policy.py # openpilot/selfdrive/monitoring/test_monitoring.py # openpilot/selfdrive/selfdrived/events.py # openpilot/selfdrive/selfdrived/selfdrived.py # openpilot/selfdrive/ui/layouts/onboarding.py # openpilot/selfdrive/ui/mici/layouts/onboarding.py # openpilot/selfdrive/ui/soundd.py # openpilot/selfdrive/ui/tests/diff/replay.py # openpilot/selfdrive/ui/translations/app.pot # openpilot/system/athena/athenad.py # openpilot/system/athena/manage_athenad.py # openpilot/system/hardware/hardwared.py # openpilot/system/loggerd/config.py # openpilot/system/manager/github_runner.sh # openpilot/system/manager/manager.py # openpilot/system/updated/updated.py # panda # pyproject.toml # scripts/lint/lint.sh # system/manager/process_config.py # system/statsd.py # tinygrad_repo # tools/release/build_release.sh # tools/release/build_stripped.sh # uv.lock
46 lines
1.7 KiB
Python
Executable File
46 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import time
|
|
|
|
from openpilot.cereal import log, messaging
|
|
from opendbc.car.structs import car
|
|
from openpilot.common.params import Params
|
|
from openpilot.system.manager.process_config import managed_processes, is_tinygrad_model, is_stock_model
|
|
from openpilot.common.hardware import HARDWARE
|
|
|
|
if __name__ == "__main__":
|
|
CP = car.CarParams(notCar=True, wheelbase=1, steerRatio=10)
|
|
params = Params()
|
|
params.put("CarParams", CP.to_bytes(), block=True)
|
|
|
|
if use_tinygrad_modeld := is_tinygrad_model(False, params, CP):
|
|
print("Using TinyGrad modeld")
|
|
if use_stock_modeld := is_stock_model(False, params, CP):
|
|
print("Using stock modeld")
|
|
|
|
HARDWARE.set_power_save(False)
|
|
|
|
procs = ['camerad', 'ui', 'calibrationd', 'plannerd', 'dmonitoringmodeld', 'dmonitoringd']
|
|
procs += ["modeld_tinygrad" if use_tinygrad_modeld else "modeld"]
|
|
for p in procs:
|
|
managed_processes[p].start()
|
|
|
|
pm = messaging.PubMaster(['controlsState', 'deviceState', 'pandaStates', 'carParams'])
|
|
|
|
msgs = {s: messaging.new_message(s) for s in ['controlsState', 'deviceState', 'carParams']}
|
|
msgs['deviceState'].deviceState.started = True
|
|
msgs['deviceState'].deviceState.deviceType = HARDWARE.get_device_type()
|
|
msgs['carParams'].carParams.openpilotLongitudinalControl = True
|
|
|
|
msgs['pandaStates'] = messaging.new_message('pandaStates', 1)
|
|
msgs['pandaStates'].pandaStates[0].ignitionLine = True
|
|
msgs['pandaStates'].pandaStates[0].pandaType = log.PandaState.PandaType.uno
|
|
|
|
try:
|
|
while True:
|
|
time.sleep(1 / 100) # continually send, rate doesn't matter
|
|
for s in msgs:
|
|
pm.send(s, msgs[s])
|
|
except KeyboardInterrupt:
|
|
for p in procs:
|
|
managed_processes[p].stop()
|