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

Bugfix in autoMapStreetLanes function #291

Merged
merged 8 commits into from
Apr 1, 2025
Merged

Bugfix in autoMapStreetLanes function #291

merged 8 commits into from
Apr 1, 2025

Conversation

Grufoony
Copy link
Collaborator

@Grufoony Grufoony commented Apr 1, 2025

No description provided.

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 28.57143% with 60 lines in your changes missing coverage. Please review.

Project coverage is 88.66%. Comparing base (e986a43) to head (ec24a72).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/dsm/sources/RoadNetwork.cpp 26.47% 50 Missing ⚠️
src/dsm/headers/RoadDynamics.hpp 45.45% 6 Missing ⚠️
src/dsm/sources/Road.cpp 20.00% 4 Missing ⚠️
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     
Flag Coverage Δ
unittests 88.66% <28.57%> (-0.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -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

MISRA 14.4 rule
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

MISRA 17.7 rule
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

MISRA 14.4 rule
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

MISRA 17.7 rule
@@ -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

MISRA 12.1 rule
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

MISRA 12.1 rule
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

MISRA 17.7 rule
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

MISRA 14.4 rule
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

MISRA 17.7 rule
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

MISRA 12.3 rule
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

MISRA 17.7 rule
}
}
allowedTurns.clear();
allowedTurns.emplace(Direction::RIGHTANDSTRAIGHT);

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 17.7 rule Note

MISRA 17.7 rule
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

MISRA 17.7 rule
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

MISRA 14.4 rule
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

MISRA 14.4 rule
.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

MISRA 17.7 rule
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

MISRA 14.4 rule
@@ -502,6 +502,18 @@
}
}
assert(!possibleMoves.empty());
if (streetId.has_value()) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
@@ -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

MISRA 12.3 rule
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

MISRA 14.4 rule
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

MISRA 15.7 rule
}
[[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

MISRA 15.5 rule
@Grufoony Grufoony merged commit 1d3c95a into main Apr 1, 2025
29 of 31 checks passed
@Grufoony Grufoony deleted the fixautomapping branch April 1, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant