From 32e6a4e9ca341648ed0af9e6b190e447de5c8862 Mon Sep 17 00:00:00 2001 From: Viktor Govako Date: Wed, 13 Apr 2022 09:15:11 +0300 Subject: [PATCH] [routing] Set reasonable threshold for saved MWM's default speeds. Signed-off-by: Viktor Govako --- routing_common/vehicle_model.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp index a31654a752..1386861b71 100644 --- a/routing_common/vehicle_model.cpp +++ b/routing_common/vehicle_model.cpp @@ -202,8 +202,9 @@ SpeedKMpH VehicleModel::GetTypeSpeed(feature::TypesHolder const & types, SpeedPa ASSERT(s, ("Key:", *hwType, "is not found.")); speed = s->GetSpeed(isCityRoad); - // Override 'default' speed from params, but take into account ETA/Weight factor. - if (params.m_defSpeedKmPH != kInvalidSpeed) + // Override the global default speed with the MWM's saved default speed if they are not significantly differ (2x), + // to avoid anomaly peaks (especially for tracks). + if (params.m_defSpeedKmPH != kInvalidSpeed && fabs(speed.m_weight - params.m_defSpeedKmPH) / speed.m_weight < 1.0) { double const factor = speed.m_eta / speed.m_weight; speed.m_weight = params.m_defSpeedKmPH;