mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-21 01:23:54 +08:00
* start again
* need that too
* this actually works
* not needed
* do properly
* still works
* still works
* still good
* all G without ll
* still works
* all still good
* cleanup building
* cleanup sconscript
* new lane planner
* how on earth is this silent too....
* update
* add rotation radius
* update
* pathplanner first pass
* misc fixes
* fix
* need deep_interp
* local again
* fix
* fix test
* very old
* new replay
* interp properly
* correct length
* another horrible silent bug
* like master
* fix that
* do doubles
* different delay compensation
* make robust to empty msg
* make pass with hack for now
* add some extra
* update ref for increased leg
* test cpu usage on this pr
* tiny bit faster
* purge numpy
* update ref
* not needed
* ready for merge
* try again after recompile
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 158210cde8
52 lines
1.4 KiB
Python
Executable File
52 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from cereal import car
|
|
from common.params import Params
|
|
from common.realtime import Priority, config_realtime_process
|
|
from selfdrive.swaglog import cloudlog
|
|
from selfdrive.controls.lib.planner import Planner
|
|
from selfdrive.controls.lib.vehicle_model import VehicleModel
|
|
from selfdrive.controls.lib.pathplanner import PathPlanner
|
|
import cereal.messaging as messaging
|
|
|
|
|
|
def plannerd_thread(sm=None, pm=None):
|
|
|
|
config_realtime_process(2, Priority.CTRL_LOW)
|
|
|
|
cloudlog.info("plannerd is waiting for CarParams")
|
|
CP = car.CarParams.from_bytes(Params().get("CarParams", block=True))
|
|
cloudlog.info("plannerd got CarParams: %s", CP.carName)
|
|
|
|
PL = Planner(CP)
|
|
PP = PathPlanner(CP)
|
|
|
|
VM = VehicleModel(CP)
|
|
|
|
if sm is None:
|
|
sm = messaging.SubMaster(['carState', 'controlsState', 'radarState', 'modelV2', 'liveParameters'],
|
|
poll=['radarState', 'modelV2'])
|
|
|
|
if pm is None:
|
|
pm = messaging.PubMaster(['plan', 'liveLongitudinalMpc', 'pathPlan', 'liveMpc'])
|
|
|
|
sm['liveParameters'].valid = True
|
|
sm['liveParameters'].sensorValid = True
|
|
sm['liveParameters'].steerRatio = CP.steerRatio
|
|
sm['liveParameters'].stiffnessFactor = 1.0
|
|
|
|
while True:
|
|
sm.update()
|
|
|
|
if sm.updated['modelV2']:
|
|
PP.update(sm, pm, CP, VM)
|
|
if sm.updated['radarState']:
|
|
PL.update(sm, pm, CP, VM, PP)
|
|
|
|
|
|
def main(sm=None, pm=None):
|
|
plannerd_thread(sm, pm)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|