From 3687f7a0120a6a08087b63dbfdb635c09468e007 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 25 Feb 2025 15:31:13 +0900 Subject: [PATCH] fix. roadlimitspeed fix.. navInstruction speedLimit --- selfdrive/carrot/carrot_man.py | 9 ++++++++- selfdrive/navd/navd.py | 2 ++ selfdrive/ui/carrot.cc | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/selfdrive/carrot/carrot_man.py b/selfdrive/carrot/carrot_man.py index 935cbaf..b4577ce 100644 --- a/selfdrive/carrot/carrot_man.py +++ b/selfdrive/carrot/carrot_man.py @@ -847,6 +847,7 @@ class CarrotServ: self.params_memory = Params("/dev/shm/params") self.nRoadLimitSpeed = 30 + self.nRoadLimitSpeed_counter = 0 self.active_carrot = 0 ## 1: CarrotMan Active, 2: sdi active , 3: speed decel active, 4: section active, 5: bump active, 6: speed limit active self.active_count = 0 @@ -1746,7 +1747,13 @@ class CarrotServ: nRoadLimitSpeed = 30 else: nRoadLimitSpeed = 30 - self.nRoadLimitSpeed = nRoadLimitSpeed + #self.nRoadLimitSpeed = nRoadLimitSpeed + if self.nRoadLimitSpeed != nRoadLimitSpeed: + self.nRoadLimitSpeed_counter += 1 + if self.nRoadLimitSpeed_counter > 5: + self.nRoadLimitSpeed = nRoadLimitSpeed + else: + self.nRoadLimitSpeed_counter = 0 ### SDI self.nSdiType = int(json.get("nSdiType", -1)) diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index dea9cd7..8d5f8c1 100644 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -298,6 +298,8 @@ class RouteEngine: if ('maxspeed' in closest.annotations) and self.localizer_valid: msg.navInstruction.speedLimit = closest.annotations['maxspeed'] + print(closest.annotations) + # Speed limit sign type if 'speedLimitSign' in step: diff --git a/selfdrive/ui/carrot.cc b/selfdrive/ui/carrot.cc index 3779dd8..f3a4ccd 100644 --- a/selfdrive/ui/carrot.cc +++ b/selfdrive/ui/carrot.cc @@ -1155,7 +1155,7 @@ public: const auto nav_inst = sm["navInstruction"].getNavInstruction(); xTurnInfo = 0; xDistToTurn = nav_inst.getManeuverDistance(); - nRoadLimitSpeed = nav_inst.getSpeedLimit(); + nRoadLimitSpeed = nav_inst.getSpeedLimit() * 3.6; QString maneuverType = QString::fromStdString(nav_inst.getManeuverType()); QString manuverModifier = QString::fromStdString(nav_inst.getManeuverModifier()); if (maneuverType == "turn") {