From 383c0ebb74afb9112ee19203273b57a51e5e39f1 Mon Sep 17 00:00:00 2001 From: Axel Date: Mon, 21 Dec 2020 10:06:05 +0100 Subject: [PATCH] Fixed missing laneChange record in OSM converted OpenDRIVE maps. --- CHANGELOG.md | 1 + Util/OSM2ODR/src/netwrite/NWWriter_OpenDrive.cpp | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b367d066..70f84367c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ * Fixed bug causing camera-based sensors to stop sending data * Added `WorldSettings.deterministic_ragdolls` to enable deterministic or physically based ragdolls * Fixed the lack of determinism on the output of raycast sensors + * Fixed missing `laneChange` record in converted OSM maps * Fixed bug in the actor's id returned by the semantic lidar * Fixed error when using `--config` parameter in `make package` * Fixed dependency of library **Xerces-c** on package diff --git a/Util/OSM2ODR/src/netwrite/NWWriter_OpenDrive.cpp b/Util/OSM2ODR/src/netwrite/NWWriter_OpenDrive.cpp index 1acd6a894..ce5f93a53 100644 --- a/Util/OSM2ODR/src/netwrite/NWWriter_OpenDrive.cpp +++ b/Util/OSM2ODR/src/netwrite/NWWriter_OpenDrive.cpp @@ -286,7 +286,8 @@ NWWriter_OpenDrive::writeNormalEdge(OutputDevice& device, const NBEdge* e, writeEmptyCenterLane(device, centerMark, 0.13); device << " \n"; for (int j = e->getNumLanes(); --j >= 0;) { - device << " getNumLanes() - j << "\" type=\"" << getLaneType(e->getPermissions(j)) << "\" level=\"true\">\n"; + std::string laneType = getLaneType(e->getPermissions(j)); + device << " getNumLanes() - j << "\" type=\"" << laneType << "\" level=\"true\">\n"; device << " \n"; // this could be used for geometry-link junctions without u-turn, // predecessor and sucessors would be lane indices, @@ -307,7 +308,15 @@ NWWriter_OpenDrive::writeNormalEdge(OutputDevice& device, const NBEdge* e, // solid road mark to the right of a forbidden lane markType = "solid"; } - device << " \n"; + std::string laneChange = "both"; + if (j == 0) { + laneChange = "none"; + } else if (getLaneType(e->getPermissions(j - 1)) == laneType) { + laneChange = "both"; + } else { + laneChange = "none"; + } + device << " \n"; device << " \n"; device << " \n"; } @@ -509,7 +518,8 @@ NWWriter_OpenDrive::writeEmptyCenterLane(OutputDevice& device, const std::string device << "
\n"; device << " \n"; device << " \n"; - device << " \n"; + // laneChange = none as roads contain lanes in one direction only + device << " \n"; device << " \n"; device << "
\n"; }