-
Notifications
You must be signed in to change notification settings - Fork 3
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
Bugfix in autoMapStreetLanes
function
#291
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #291 +/- ##
==========================================
- Coverage 89.50% 88.66% -0.84%
==========================================
Files 38 38
Lines 5146 5206 +60
Branches 461 477 +16
==========================================
+ Hits 4606 4616 +10
- Misses 540 590 +50
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -361,11 +349,44 @@ | |||
if (allowedTurns.contains(Direction::STRAIGHT) && | |||
allowedTurns.contains(Direction::RIGHT) && | |||
allowedTurns.contains(Direction::LEFT)) { | |||
break; | |||
if (pair.second->isTrafficLight()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
break; | ||
if (pair.second->isTrafficLight()) { | ||
auto& tl = dynamic_cast<TrafficLight&>(*pair.second); | ||
auto const& cycles{tl.cycles()}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
if (pair.second->isTrafficLight()) { | ||
auto& tl = dynamic_cast<TrafficLight&>(*pair.second); | ||
auto const& cycles{tl.cycles()}; | ||
if (cycles.contains(pInStreet->id())) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
cycle.contains(Direction::RIGHT)) { | ||
allowedTurns.erase(Direction::LEFT); | ||
allowedTurns.erase(Direction::STRAIGHT); | ||
allowedTurns.emplace(Direction::LEFTANDSTRAIGHT); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
@@ -1049,7 +1049,7 @@ | |||
auto const deltaAngle{pNextStreet->deltaAngle(pStreet->angle())}; | |||
if (std::abs(deltaAngle) < std::numbers::pi) { | |||
// Lanes are counted as 0 is the far right lane | |||
if (std::abs(deltaAngle) < std::numbers::pi / 4) { | |||
if (std::abs(deltaAngle) < std::numbers::pi / 8) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
if (deltaAngle < -std::numbers::pi / 6.) { | ||
Logger::debug( | ||
std::format("Street {} can turn RIGHT", pInStreet->id())); | ||
if (std::abs(deltaAngle) < std::numbers::pi / 8) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.1 rule Note
Logger::debug( | ||
std::format("Street {} can turn LEFT", pInStreet->id())); | ||
} else if (deltaAngle > 0.) { | ||
Logger::debug(std::format("Street {} -> {} can turn LEFT", |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
allowedTurns.contains(Direction::RIGHT) && | ||
allowedTurns.contains(Direction::LEFT)) { | ||
if (allowedTurns.size() > static_cast<size_t>(nLanes)) { | ||
if (pair.second->isTrafficLight()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
src/dsm/sources/RoadNetwork.cpp
Outdated
if (cycles.size() == static_cast<size_t>(nLanes) && | ||
cycles.contains(pInStreet->id())) { | ||
Logger::debug( | ||
std::format("Using traffic light {} cycles for street {} -> {}", |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
src/dsm/sources/RoadNetwork.cpp
Outdated
pInStreet->target())); | ||
auto const& cycle{cycles.at(pInStreet->id())}; | ||
allowedTurns.clear(); | ||
for (auto const& [direction, cycle] : cycle) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
src/dsm/sources/RoadNetwork.cpp
Outdated
auto const& cycle{cycles.at(pInStreet->id())}; | ||
allowedTurns.clear(); | ||
for (auto const& [direction, cycle] : cycle) { | ||
allowedTurns.emplace(direction); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
} | ||
} | ||
allowedTurns.clear(); | ||
allowedTurns.emplace(Direction::RIGHTANDSTRAIGHT); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
pInStreet->target())); | ||
allowedTurns.emplace(Direction::STRAIGHT); | ||
} else if (deltaAngle < 0.) { | ||
Logger::debug(std::format("Street {} -> {} can turn RIGHT", |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
if (pair.second->isTrafficLight()) { | ||
auto& tl = dynamic_cast<TrafficLight&>(*pair.second); | ||
auto const& cycles{tl.cycles()}; | ||
if (cycles.contains(pInStreet->id())) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
for (auto const& [direction, cycle] : cycle) { | ||
allowedTurns.emplace(direction); | ||
} | ||
} else if (cycles.at(pInStreet->id()) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
.contains(Direction::LEFTANDSTRAIGHT)) { | ||
allowedTurns.erase(Direction::LEFT); | ||
allowedTurns.erase(Direction::STRAIGHT); | ||
allowedTurns.emplace(Direction::LEFTANDSTRAIGHT); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 17.7 rule Note
allowedTurns.erase(Direction::LEFT); | ||
allowedTurns.erase(Direction::STRAIGHT); | ||
allowedTurns.emplace(Direction::LEFTANDSTRAIGHT); | ||
} else if (cycles.at(pInStreet->id()) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
@@ -502,6 +502,18 @@ | |||
} | |||
} | |||
assert(!possibleMoves.empty()); | |||
if (streetId.has_value()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
@@ -66,6 +66,19 @@ | |||
} | |||
newStreetIds.emplace(streetId, newStreetId); | |||
} | |||
std::for_each( | |||
m_edges.cbegin(), m_edges.cend(), [this, &newStreetIds](auto const& pair) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
m_edges.cbegin(), m_edges.cend(), [this, &newStreetIds](auto const& pair) { | ||
auto const& pStreet{pair.second}; | ||
auto const& forbiddenTurns{pStreet->forbiddenTurns()}; | ||
if (forbiddenTurns.empty()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 14.4 rule Note
allowedTurns.erase(Direction::RIGHT); | ||
allowedTurns.erase(Direction::STRAIGHT); | ||
allowedTurns.emplace(Direction::RIGHTANDSTRAIGHT); | ||
} |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.7 rule Note
} | ||
[[fallthrough]]; | ||
default: | ||
assert(allowedTurns.size() == static_cast<size_t>(nLanes)); | ||
// Logger::info( | ||
// std::format("Street {}->{} with {} lanes and {} allowed turns", |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
No description provided.