From c2261c53725f142600c0987b839c0bb9051c9331 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 5 Dec 2022 17:41:32 -0800 Subject: [PATCH] navmodeld: only render necessary frames (#26698) old-commit-hash: 6e0893299ad435291782e40a92ddeb85b85f4b87 --- selfdrive/modeld/navmodeld.cc | 1 - selfdrive/navd/map_renderer.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/modeld/navmodeld.cc b/selfdrive/modeld/navmodeld.cc index 57ef7cf0e0..75f2c62ab3 100644 --- a/selfdrive/modeld/navmodeld.cc +++ b/selfdrive/modeld/navmodeld.cc @@ -21,7 +21,6 @@ void run_model(NavModelState &model, VisionIpcClient &vipc_client) { while (!do_exit) { VisionBuf *buf = vipc_client.recv(&extra); if (buf == nullptr) continue; - if (extra.frame_id < last_frame_id + 10) continue; // Run at 2Hz double t1 = millis_since_boot(); NavModelResult *model_res = navmodel_eval_frame(&model, buf); diff --git a/selfdrive/navd/map_renderer.cc b/selfdrive/navd/map_renderer.cc index 247b69c4c5..6a19f45fed 100644 --- a/selfdrive/navd/map_renderer.cc +++ b/selfdrive/navd/map_renderer.cc @@ -79,7 +79,7 @@ void MapRenderer::msgUpdate() { auto orientation = location.getCalibratedOrientationNED(); bool localizer_valid = (location.getStatus() == cereal::LiveLocationKalman::Status::VALID) && pos.getValid(); - if (localizer_valid) { + if (localizer_valid && (sm->rcv_frame("liveLocationKalman") % 10) == 0) { updatePosition(QMapbox::Coordinate(pos.getValue()[0], pos.getValue()[1]), RAD2DEG(orientation.getValue()[2])); } }