From cf2b033c795474b7c5bbbdc87fea1062c3f67aa0 Mon Sep 17 00:00:00 2001 From: discountchubbs Date: Thu, 23 Oct 2025 19:15:54 -0700 Subject: [PATCH 1/2] clean --- sunnypilot/navd/helpers.py | 5 ++++- sunnypilot/navd/navigation_helpers/nav_instructions.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sunnypilot/navd/helpers.py b/sunnypilot/navd/helpers.py index 8788653380..041ef6805d 100644 --- a/sunnypilot/navd/helpers.py +++ b/sunnypilot/navd/helpers.py @@ -64,7 +64,10 @@ class Coordinate: haversine_dlon = math.sin(dlon / 2.0) haversine_dlon *= haversine_dlon - y = haversine_dlat + math.cos(math.radians(self.latitude)) * math.cos(math.radians(other.latitude)) * haversine_dlon + y = haversine_dlat \ + + math.cos(math.radians(self.latitude)) \ + * math.cos(math.radians(other.latitude)) \ + * haversine_dlon x = 2 * math.asin(math.sqrt(y)) return x * EARTH_MEAN_RADIUS diff --git a/sunnypilot/navd/navigation_helpers/nav_instructions.py b/sunnypilot/navd/navigation_helpers/nav_instructions.py index 6550cfb843..a734d663ec 100644 --- a/sunnypilot/navd/navigation_helpers/nav_instructions.py +++ b/sunnypilot/navd/navigation_helpers/nav_instructions.py @@ -44,7 +44,7 @@ class NavigationInstructions: distance = distance_to_end_of_step else: distance = step['cumulative_distance'] - closest_cumulative - all_maneuvers.append({'distance': distance, 'type': step['maneuver'], 'modifier': step['modifier']}) + all_maneuvers.append({'distance': distance, 'type': step['maneuver'], 'modifier': step['modifier'], 'instruction': step['instruction']}) return { 'distance_from_route': min_distance, @@ -85,6 +85,7 @@ class NavigationInstructions: 'cumulative_distance': cumulative_distances[closest_idx], 'maxspeed': maxspeed[min(closest_idx, len(maxspeed) - 1)], 'modifier': string_to_direction(step['modifier']), + 'instruction': step['instruction'], }) self._cached_route = { 'steps': steps, From 3b1ada64be4ebae85e72bcb298bc332f41afc495 Mon Sep 17 00:00:00 2001 From: discountchubbs Date: Thu, 23 Oct 2025 19:20:15 -0700 Subject: [PATCH 2/2] sync --- cereal/custom.capnp | 1 + sunnypilot/navd/navigationd.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cereal/custom.capnp b/cereal/custom.capnp index bc51c77b7a..5d18b77097 100644 --- a/cereal/custom.capnp +++ b/cereal/custom.capnp @@ -466,6 +466,7 @@ struct Navigationd @0xcb9fd56c7057593a { distance @0 :Float64; type @1 :Text; modifier @2 :Text; + instruction @3 :Text; } } diff --git a/sunnypilot/navd/navigationd.py b/sunnypilot/navd/navigationd.py index 2ce9775ad6..7c43c4912c 100755 --- a/sunnypilot/navd/navigationd.py +++ b/sunnypilot/navd/navigationd.py @@ -95,7 +95,8 @@ class Navigationd: msg.navigationd.valid = self.valid all_maneuvers = ( - [custom.Navigationd.Maneuver.new_message(distance=m['distance'], type=m['type'], modifier=m['modifier']) for m in progress['all_maneuvers']] + [custom.Navigationd.Maneuver.new_message(distance=m['distance'], type=m['type'], modifier=m['modifier'], + instruction=m['instruction']) for m in progress['all_maneuvers']] if progress else [] )