From 136ef70b3b2c30ec5ad5f32064884314ee27dc3a Mon Sep 17 00:00:00 2001 From: ajouatom Date: Mon, 24 Feb 2025 10:50:20 +0900 Subject: [PATCH] fix navInstruction... --- selfdrive/ui/carrot.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/selfdrive/ui/carrot.cc b/selfdrive/ui/carrot.cc index 2fb5ae9..cfbdb40 100644 --- a/selfdrive/ui/carrot.cc +++ b/selfdrive/ui/carrot.cc @@ -1117,11 +1117,15 @@ public: return; } const auto carrot_man = sm["carrotMan"].getCarrotMan(); - const auto nav_inst = sm["navInstruction"].getNavInstruction(); - //const auto car_state = sm["carState"].getCarState(); + float maneuverDistance = 0; + if (sm.alive("navInstruction")) { + const auto nav_inst = sm["navInstruction"].getNavInstruction(); + maneuverDistance = nav_inst.getManeuverDistance(); + } + active_carrot = carrot_man.getActiveCarrot(); //printf("active_carrot: %d\n", active_carrot); - if (active_carrot <= 1 || (carrot_man.getNGoPosDist() <= 0 && nav_inst.getManeuverDistance() > 0)) active_navi_inst = true; + if (active_carrot <= 1 || (carrot_man.getNGoPosDist() <= 0 && maneuverDistance > 0)) active_navi_inst = true; else active_navi_inst = false; if (active_carrot > 1) { @@ -1147,6 +1151,7 @@ public: szTBTMainText = QString::fromStdString(carrot_man.getSzTBTMainText()); } else if(sm.alive("navInstruction") && sm.valid("navInstruction")) { + const auto nav_inst = sm["navInstruction"].getNavInstruction(); xTurnInfo = 0; xDistToTurn = nav_inst.getManeuverDistance(); nRoadLimitSpeed = nav_inst.getSpeedLimit();