From 78ff32301d4ef60f9b338d636dc74cb48b7e1457 Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Fri, 13 Oct 2023 21:02:47 +0000 Subject: [PATCH 1/2] fix invalid condition --- common/lanelet2_extension/lib/CarmaTrafficSignal.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp b/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp index 570af43cf78..d4b7e024622 100755 --- a/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp +++ b/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp @@ -119,11 +119,6 @@ boost::optional> Ca LOG_WARN_STREAM("CarmaTrafficSignal doesn't have any recorded states of traffic lights"); return boost::none; } - - if (recorded_time_stamps.size() == 1) // if only 1 timestamp recorded, this signal doesn't change - { - return std::pair(recorded_time_stamps.front().first, recorded_time_stamps.front().second); - } if (lanelet::time::toSec(fixed_cycle_duration) < 1.0) // there are recorded states, but no fixed_cycle_duration means it is dynamic { @@ -156,6 +151,7 @@ boost::optional> Ca } } + // TODO: This part of the code relates to fixed timing cycles. We are keeping the code until, there is a use case to test it. // shift starting time to the future or to the past to fit input into a valid cycle boost::posix_time::time_duration accumulated_offset_duration; double offset_duration_dir = recorded_time_stamps.front().first > time_stamp ? -1.0 : 1.0; // -1 if past, +1 if time_stamp is in future From 152f409d3da9f6e55e026ebaf2f1cc5c8b4c170c Mon Sep 17 00:00:00 2001 From: Misheel Bayartsengel Date: Tue, 17 Oct 2023 19:14:25 +0000 Subject: [PATCH 2/2] clean --- common/lanelet2_extension/lib/CarmaTrafficSignal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp b/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp index d4b7e024622..a32d21bf8cf 100755 --- a/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp +++ b/common/lanelet2_extension/lib/CarmaTrafficSignal.cpp @@ -151,7 +151,7 @@ boost::optional> Ca } } - // TODO: This part of the code relates to fixed timing cycles. We are keeping the code until, there is a use case to test it. + // This part of the code is used for predicting state if fixed_cycle_duration is set using setStates function // shift starting time to the future or to the past to fit input into a valid cycle boost::posix_time::time_duration accumulated_offset_duration; double offset_duration_dir = recorded_time_stamps.front().first > time_stamp ? -1.0 : 1.0; // -1 if past, +1 if time_stamp is in future