From b596356a0e27d039c865a4299327c1b03a7cdb60 Mon Sep 17 00:00:00 2001 From: FrogAi Date: Sun, 10 Nov 2024 20:48:48 +0000 Subject: [PATCH] November 10th, 2024 Update --- README.md | 2 +- selfdrive/car/toyota/carstate.py | 16 ++++++++++++++++ selfdrive/navd/navd.py | 11 +++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 37dbf1dcfd4b6a..bdd695bd3c2a3b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ FrogPilot is a fully open-sourced fork of openpilot, featuring clear and concise ------ FrogPilot was last updated on: -**November 8th, 2024** +**November 10th, 2024** Features ------ diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index ef2ed11c7c9beb..3beace946ae201 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -216,6 +216,22 @@ def calculate_speed_limit(cp_cam, frogpilot_toggles): return 0 +# Traffic signals for Speed Limit Controller - Credit goes to the DragonPilot team! +@staticmethod +def calculate_speed_limit(cp_cam, frogpilot_toggles): + signals = ["TSGN1", "SPDVAL1", "SPLSGN1", "TSGN2", "SPLSGN2", "TSGN3", "SPLSGN3", "TSGN4", "SPLSGN4"] + traffic_signals = {signal: cp_cam.vl["RSA1"].get(signal, cp_cam.vl["RSA2"].get(signal)) for signal in signals} + + tsgn1 = traffic_signals.get("TSGN1") + spdval1 = traffic_signals.get("SPDVAL1") + + if tsgn1 == 1 and not frogpilot_toggles.force_mph_dashboard: + return spdval1 * CV.KPH_TO_MS + elif tsgn1 == 36 or frogpilot_toggles.force_mph_dashboard: + return spdval1 * CV.MPH_TO_MS + return 0 + + class CarState(CarStateBase): def __init__(self, CP): super().__init__(CP) diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index 95cd0ed23caaad..a899f974529b8f 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -130,6 +130,17 @@ def __init__(self, sm, pm): self.stop_coord = [] self.stop_signal = [] + # FrogPilot variables + self.frogpilot_toggles = get_frogpilot_toggles(True) + + self.approaching_intersection = False + self.approaching_turn = False + + self.nav_speed_limit = 0 + + self.stop_coord = [] + self.stop_signal = [] + def update(self): self.sm.update(0)