Locationd: reimplement liveLocationKalman and use position_geodetic in liveMapDataSP (#1275)

* init

* desc

* llk welcome back

* more

* new param to write

* update mapd

* no migration

* no refactor for now

* exec

* rename

* bearing

* fix test

* lint
This commit is contained in:
Jason Wen
2025-09-22 23:39:55 -04:00
committed by GitHub
parent ea6178e53e
commit ecee67dd64
49 changed files with 3755 additions and 23 deletions
@@ -6,8 +6,7 @@ See the LICENSE.md file in the root directory for more details.
"""
from abc import abstractmethod, ABC
from cereal import messaging
from openpilot.common.gps import get_gps_location_service
import cereal.messaging as messaging
from openpilot.common.params import Params
from openpilot.sunnypilot.navd.helpers import coordinate_from_param
@@ -16,14 +15,12 @@ class BaseMapData(ABC):
def __init__(self):
self.params = Params()
self.gps_location_service = get_gps_location_service(self.params)
gps_packets = [self.gps_location_service]
self.sm = messaging.SubMaster(['livePose'] + gps_packets, ignore_alive=gps_packets, ignore_avg_freq=gps_packets,
ignore_valid=gps_packets, poll='livePose')
self.sm = messaging.SubMaster(['liveLocationKalman'])
self.pm = messaging.PubMaster(['liveMapDataSP'])
self.localizer_valid = False
self.last_bearing = None
self.last_position = coordinate_from_param("LastGPSPosition", self.params)
self.last_position = coordinate_from_param("LastGPSPositionLLK", self.params)
@abstractmethod
def update_location(self) -> None:
@@ -46,7 +43,7 @@ class BaseMapData(ABC):
next_speed_limit, next_speed_limit_distance = self.get_next_speed_limit_and_distance()
mapd_sp_send = messaging.new_message('liveMapDataSP')
mapd_sp_send.valid = self.sm.all_checks(['livePose'])
mapd_sp_send.valid = self.sm['liveLocationKalman'].gpsOK
live_map_data = mapd_sp_send.liveMapDataSP
live_map_data.speedLimitValid = bool(speed_limit > 0)