Files
sunnypilot/selfdrive/controls/plannerd.py
T
Jason Wen 6ec1b029b9 DLP: preserves lanelines (#16)
* Revert "Remove lane planning code (#25651)"

* DLP: preserves lanelines

* MADS: cruiseEngageBlocked event

* change path now!

* Revert "change path now!"

This reverts commit 7db2af33378aa02288b6222ed722d705ca6e92ec.

* Revert "Revert "change path now!""

This reverts commit 19f50a19e98721f7b8b9018b2e788629df45137f.

* c string

* atoi instead

* does this work?

* move it move it

* move there

* Try this one

* dotted line

* looks horrible

* how about this?

* Nah let's keep it simple

* track these with cereals

* send button!

* add more

* don't need this

* and this too

* make sure it shows first

* more

* to right for now

* stock size

* different color

* move some logic around

* don't miss

* don't miss this

* check somewhere else

* oops

* not liking it

* bring back current button

* don't need to be constant

* take it out for now

* wrap for translation
2023-02-05 13:46:58 -05:00

50 lines
1.5 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 system.swaglog import cloudlog
from selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
from selfdrive.controls.lib.lateral_planner import LateralPlanner
import cereal.messaging as messaging
def plannerd_thread(sm=None, pm=None):
config_realtime_process(5, Priority.CTRL_LOW)
cloudlog.info("plannerd is waiting for CarParams")
params = Params()
CP = car.CarParams.from_bytes(params.get("CarParams", block=True))
cloudlog.info("plannerd got CarParams: %s", CP.carName)
use_lanelines = False
wide_camera = params.get_bool('WideCameraOnly')
cloudlog.event("e2e mode", on=use_lanelines)
longitudinal_planner = LongitudinalPlanner(CP)
lateral_planner = LateralPlanner(CP, use_lanelines=use_lanelines, wide_camera=wide_camera)
if sm is None:
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'radarState', 'modelV2', 'longitudinalPlan'],
poll=['radarState', 'modelV2'], ignore_avg_freq=['radarState'])
if pm is None:
pm = messaging.PubMaster(['longitudinalPlan', 'lateralPlan'])
while True:
sm.update()
if sm.updated['modelV2']:
lateral_planner.update(sm)
lateral_planner.publish(sm, pm)
longitudinal_planner.update(sm)
longitudinal_planner.publish(sm, pm)
def main(sm=None, pm=None):
plannerd_thread(sm, pm)
if __name__ == "__main__":
main()