Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix invalid condition #256

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions common/lanelet2_extension/lib/CarmaTrafficSignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ boost::optional<std::pair<boost::posix_time::ptime, CarmaTrafficSignalState>> 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<boost::posix_time::ptime, CarmaTrafficSignalState>(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
{
Expand Down Expand Up @@ -156,6 +151,7 @@ boost::optional<std::pair<boost::posix_time::ptime, CarmaTrafficSignalState>> Ca
}
}

// 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
Expand Down
Loading