FrogPilot setup

This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent 9d97e0ecc1
commit 7308c1b35c
60 changed files with 1660 additions and 49 deletions

View File

@@ -28,6 +28,7 @@ class RouteEngine:
self.pm = pm
self.params = Params()
self.params_memory = Params("/dev/shm/params")
# Get last gps position from params
self.last_position = coordinate_from_param("LastGPSPosition", self.params)
@@ -59,7 +60,14 @@ class RouteEngine:
self.mapbox_token = ""
self.mapbox_host = "https://maps.comma.ai"
# FrogPilot variables
self.update_frogpilot_params()
def update(self):
# Update FrogPilot parameters
if self.params_memory.get_bool("FrogPilotTogglesUpdated"):
self.update_frogpilot_params()
self.sm.update(0)
if self.sm.updated["managerState"]:
@@ -301,6 +309,11 @@ class RouteEngine:
self.params.remove("NavDestination")
self.clear_route()
frogpilot_plan_send = messaging.new_message('frogpilotNavigation')
frogpilotNavigation = frogpilot_plan_send.frogpilotNavigation
self.pm.send('frogpilotNavigation', frogpilot_plan_send)
def send_route(self):
coords = []
@@ -349,9 +362,10 @@ class RouteEngine:
return self.reroute_counter > REROUTE_COUNTER_MIN
# TODO: Check for going wrong way in segment
def update_frogpilot_params(self):
def main():
pm = messaging.PubMaster(['navInstruction', 'navRoute'])
pm = messaging.PubMaster(['navInstruction', 'navRoute', 'frogpilotNavigation'])
sm = messaging.SubMaster(['liveLocationKalman', 'managerState'])
rk = Ratekeeper(1.0)