From 65f84442e02bb02c68c996eb6d9d049a2910beac Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Fri, 15 Nov 2019 14:14:11 +0530 Subject: [PATCH] Fixed incorrect speed unit conversion --- LibCarla/source/carla/trafficmanager/MotionPlannerStage.cpp | 2 +- LibCarla/source/carla/trafficmanager/Parameters.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LibCarla/source/carla/trafficmanager/MotionPlannerStage.cpp b/LibCarla/source/carla/trafficmanager/MotionPlannerStage.cpp index baf42d401..1d67780af 100644 --- a/LibCarla/source/carla/trafficmanager/MotionPlannerStage.cpp +++ b/LibCarla/source/carla/trafficmanager/MotionPlannerStage.cpp @@ -76,7 +76,7 @@ namespace PlannerConstants { // Increase speed if on highway. float speed_limit = vehicle->GetSpeedLimit() / 3.6f; - float dynamic_target_velocity = parameters.GetVehicleTargetVelocity(actor); + float dynamic_target_velocity = parameters.GetVehicleTargetVelocity(actor) / 3.6f; if (speed_limit > HIGHWAY_SPEED) { longitudinal_parameters = highway_longitudinal_parameters; diff --git a/LibCarla/source/carla/trafficmanager/Parameters.cpp b/LibCarla/source/carla/trafficmanager/Parameters.cpp index 98350ae64..d93b83994 100644 --- a/LibCarla/source/carla/trafficmanager/Parameters.cpp +++ b/LibCarla/source/carla/trafficmanager/Parameters.cpp @@ -78,7 +78,7 @@ namespace traffic_manager { percentage_decrease = percentage_decrease_from_speed_limit.GetValue(actor_id); } - return speed_limit * (1 - percentage_decrease/100); + return speed_limit * (1.0f - percentage_decrease/100.0f); } bool Parameters::GetCollisionDetection(const ActorPtr &reference_actor, const ActorPtr &other_actor) {