mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-27 00:52:05 +08:00
ddf63701e8
* init * some fixes * move * more * old navd helpers * bring back cereal * fix linting * more * add to cereal first * sp events * lint * implement in long plan * fixme-sp * refactor state machine * wrong state * start refactor controller * some type hints * init these * enable debug print * ui? ui! * print them out * fix spinner import * fix path * let's use gps chips directly for now * service missing * publish events * no nav for now * need to sub * no car state speed yet * missed event * Car: `CarStateSP` * fix tests * bring back car state speed limit * fix * use old controller for now * fix * fix source * type hints * none for now * formatting * more * create directory if does not exist * mypy my bt * policy param catch exceptions * handle all params with exceptions * more * single method * define types in init * rename * simpler op enabled check * more mypy stuff * rename * no need for brake pressed * don't reset if gas pressed * type hint all * type hint all * back to upstream * in another pr * no longer need data type * qlog * slc in another pr * use horizontal accuracy * use horizontal accuracy * set core affinity for all realtime processes * unused * sort * unused * type hint and slight cleanup * from old implementation * use directly * combine pm * slight more cleanup * type hints * even more type hint * Revert "slc in another pr" This reverts commit3a6987e6* Revert "in another pr" This reverts commita29bccff12. * rebump * no need to check alive * use it directly * fix test * refactor * use gps data directly * quote...? * lint * fix tests * use CC.longActive * user confirm in another PR * rename * fix import * params fix * no more * fix * drop new state machine for now * more fixes * internalize output * unused * rearrange * auto draft * rename * this * no * no need * use existing * wrong cruise speed * fix * not used for now * Revert "not used for now" This reverts commitf0083d6241. * some * use frames instead * split speed limit resolver out of slc * no need to pass sm * fix params * test init * use frame instead of time * track session * some tests * too limiting * bump * always reset state * end session if long_active but slc inactive at any given time * off * no warning in this PR * no speed factor engage type yet * wide open * no * introduce disabled, no longer transitions at inactive * fix tests * no more tempinactive * clean * rename * offset default > off * new tests, fixes controller * more tests * not really needed yet * lint * fix * some more tests * wrap * more * more * use vCruiseCluster for set speed * init better * finish it up * no * typo * one method state machine * refactor preactive timeout check * refactor new session check * directly return statuses * comments * v_target * refactor speed limit resolver * turn off debug * more resolver refactor * no longer needed * lint * more lint * fix * move around * fix events * update event * already happens while in enabled * add carstateSP * less * Speed Limit Control -> Speed Limit Assist * in another PR * more rename * overriding state * fix * make sure to return the correct type * just slr in this one * more * update * redundant * fix * fix * lint * fix * fix * match toggle * fix priority checks * fix combined source for picking 0 limit * no need to wrap * add speed limit offset to resolver * add speed limit offset * make sure it displays distance when higher * Revert "make sure it displays distance when higher" This reverts commit15c6834d4e. * some rename * translations * unused for now * more * lint --------- Co-authored-by: nayan <nayan8teen@gmail.com> Co-authored-by: DevTekVE <devtekve@gmail.com>
45 lines
1.7 KiB
Python
Executable File
45 lines
1.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from cereal import car
|
|
from openpilot.common.gps import get_gps_location_service
|
|
from openpilot.common.params import Params
|
|
from openpilot.common.realtime import Priority, config_realtime_process
|
|
from openpilot.common.swaglog import cloudlog
|
|
from openpilot.selfdrive.controls.lib.ldw import LaneDepartureWarning
|
|
from openpilot.selfdrive.controls.lib.longitudinal_planner import LongitudinalPlanner
|
|
import cereal.messaging as messaging
|
|
|
|
|
|
def main():
|
|
config_realtime_process(5, Priority.CTRL_LOW)
|
|
|
|
cloudlog.info("plannerd is waiting for CarParams")
|
|
params = Params()
|
|
CP = messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams)
|
|
cloudlog.info("plannerd got CarParams: %s", CP.brand)
|
|
|
|
gps_location_service = get_gps_location_service(params)
|
|
|
|
ldw = LaneDepartureWarning()
|
|
longitudinal_planner = LongitudinalPlanner(CP)
|
|
pm = messaging.PubMaster(['longitudinalPlan', 'driverAssistance', 'longitudinalPlanSP'])
|
|
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'liveParameters', 'radarState', 'modelV2', 'selfdriveState',
|
|
'liveMapDataSP', 'carStateSP', gps_location_service],
|
|
poll='modelV2')
|
|
|
|
while True:
|
|
sm.update()
|
|
if sm.updated['modelV2']:
|
|
longitudinal_planner.update(sm)
|
|
longitudinal_planner.publish(sm, pm)
|
|
|
|
ldw.update(sm.frame, sm['modelV2'], sm['carState'], sm['carControl'])
|
|
msg = messaging.new_message('driverAssistance')
|
|
msg.valid = sm.all_checks(['carState', 'carControl', 'modelV2', 'liveParameters'])
|
|
msg.driverAssistance.leftLaneDeparture = ldw.left
|
|
msg.driverAssistance.rightLaneDeparture = ldw.right
|
|
pm.send('driverAssistance', msg)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|