From 7b455ce92eb417b4405c3ada5ae462dc45afab97 Mon Sep 17 00:00:00 2001 From: Axel1092 Date: Mon, 27 Jul 2020 12:23:56 +0200 Subject: [PATCH] Compensate traffic light displacement. --- LibCarla/source/carla/road/MapBuilder.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/LibCarla/source/carla/road/MapBuilder.cpp b/LibCarla/source/carla/road/MapBuilder.cpp index f22f95d9e..b032b1133 100644 --- a/LibCarla/source/carla/road/MapBuilder.cpp +++ b/LibCarla/source/carla/road/MapBuilder.cpp @@ -24,6 +24,7 @@ #include "carla/road/element/RoadInfoCrosswalk.h" #include "carla/road/InformationSet.h" #include "carla/road/Signal.h" +#include "carla/road/SignalType.h" #include #include @@ -766,7 +767,13 @@ namespace road { for(auto& signal_pair : _temp_signal_container) { auto& signal = signal_pair.second; - signal->_transform = ComputeSignalTransform(signal, _map_data); + auto transform = ComputeSignalTransform(signal, _map_data); + // Hack: compensate RoadRunner displacement (25cm) due to lightbox size + if (SignalType::IsTrafficLight(signal->GetType())) { + transform.location = transform.location + + geom::Location(transform.GetForwardVector()*0.25); + } + signal->_transform = transform; } _map_data._signals = std::move(_temp_signal_container);