don't assign lanes on delayed turns
This commit is contained in:
@@ -118,7 +118,8 @@ LaneDataVector augmentMultiple(const std::size_t none_index,
|
||||
lane_data.push_back({tag_by_modifier[intersection[intersection_index]
|
||||
.turn.instruction.direction_modifier],
|
||||
lane_data[none_index].from,
|
||||
lane_data[none_index].to});
|
||||
lane_data[none_index].to,
|
||||
false});
|
||||
}
|
||||
}
|
||||
lane_data.erase(lane_data.begin() + none_index);
|
||||
|
||||
@@ -30,6 +30,7 @@ bool TurnLaneData::operator<(const TurnLaneData &other) const
|
||||
if (to > other.to)
|
||||
return false;
|
||||
|
||||
// the suppress-assignment flag is ignored, since it does not influence the order
|
||||
const constexpr TurnLaneType::Mask tag_by_modifier[] = {TurnLaneType::sharp_right,
|
||||
TurnLaneType::right,
|
||||
TurnLaneType::slight_right,
|
||||
@@ -67,7 +68,7 @@ bool TurnLaneData::operator<(const TurnLaneData &other) const
|
||||
LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description)
|
||||
{
|
||||
typedef std::unordered_map<TurnLaneType::Mask, std::pair<LaneID, LaneID>> LaneMap;
|
||||
//TODO need to handle cases that have none-in between two identical values
|
||||
// TODO need to handle cases that have none-in between two identical values
|
||||
const auto num_lanes = boost::numeric_cast<LaneID>(turn_lane_description.size());
|
||||
|
||||
const auto setLaneData = [&](
|
||||
@@ -106,7 +107,7 @@ LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description
|
||||
// transform the map into the lane data vector
|
||||
LaneDataVector lane_data;
|
||||
for (const auto tag : lane_map)
|
||||
lane_data.push_back({tag.first, tag.second.first, tag.second.second});
|
||||
lane_data.push_back({tag.first, tag.second.first, tag.second.second, false});
|
||||
|
||||
std::sort(lane_data.begin(), lane_data.end());
|
||||
|
||||
@@ -158,8 +159,8 @@ bool isSubsetOf(const LaneDataVector &subset_candidate, const LaneDataVector &su
|
||||
auto location = superset_candidate.begin();
|
||||
for (const auto entry : subset_candidate)
|
||||
{
|
||||
location =
|
||||
std::find_if(location, superset_candidate.end(), [entry](const TurnLaneData &lane_data) {
|
||||
location = std::find_if(
|
||||
location, superset_candidate.end(), [entry](const TurnLaneData &lane_data) {
|
||||
return lane_data.tag == entry.tag;
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "util/simple_logger.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -106,8 +107,6 @@ TurnLaneHandler::assignTurnLanes(const NodeID at, const EdgeID via_edge, Interse
|
||||
previous_lane_data,
|
||||
previous_description_id);
|
||||
|
||||
std::cout << "[turn lane] " << scenario_names[scenario] << std::endl;
|
||||
|
||||
if (scenario != TurnLaneHandler::NONE)
|
||||
(*count_called)++;
|
||||
|
||||
@@ -132,9 +131,7 @@ TurnLaneHandler::assignTurnLanes(const NodeID at, const EdgeID via_edge, Interse
|
||||
return handleSliproadTurn(std::move(intersection),
|
||||
lane_description_id,
|
||||
std::move(lane_data),
|
||||
previous_intersection,
|
||||
previous_description_id,
|
||||
previous_lane_data);
|
||||
previous_intersection);
|
||||
case TurnLaneScenario::MERGE:
|
||||
return intersection;
|
||||
default:
|
||||
@@ -295,7 +292,7 @@ TurnLaneHandler::deduceScenario(const NodeID at,
|
||||
// FIXME the lane to add depends on the side of driving/u-turn rules in the country
|
||||
if (!lane_data.empty() && canMatchTrivially(intersection, lane_data) &&
|
||||
is_missing_valid_u_turn && !hasTag(TurnLaneType::none, lane_data))
|
||||
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to});
|
||||
lane_data.push_back({TurnLaneType::uturn, lane_data.back().to, lane_data.back().to, false});
|
||||
|
||||
bool is_simple = isSimpleIntersection(lane_data, intersection);
|
||||
|
||||
@@ -663,6 +660,8 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
|
||||
if (lane == straightmost_tag_index)
|
||||
{
|
||||
augmentEntry(turn_lane_data[straightmost_tag_index]);
|
||||
// disable this turn for assignment if it is a -use lane only
|
||||
turn_lane_data[straightmost_tag_index].suppress_assignment = true;
|
||||
}
|
||||
|
||||
if (matched_at_first[lane])
|
||||
@@ -674,7 +673,7 @@ std::pair<LaneDataVector, LaneDataVector> TurnLaneHandler::partitionLaneData(
|
||||
std::count(matched_at_second.begin(), matched_at_second.end(), true)) ==
|
||||
getNumberOfTurns(next_intersection))
|
||||
{
|
||||
TurnLaneData data = {TurnLaneType::straight, 255, 0};
|
||||
TurnLaneData data = {TurnLaneType::straight, 255, 0, true};
|
||||
augmentEntry(data);
|
||||
first.push_back(data);
|
||||
std::sort(first.begin(), first.end());
|
||||
@@ -701,15 +700,12 @@ Intersection TurnLaneHandler::simpleMatchTuplesToTurns(Intersection intersection
|
||||
std::move(intersection), lane_data, node_based_graph, lane_description_id, id_map);
|
||||
}
|
||||
|
||||
Intersection
|
||||
TurnLaneHandler::handleSliproadTurn(Intersection intersection,
|
||||
const LaneDescriptionID lane_description_id,
|
||||
LaneDataVector lane_data,
|
||||
const Intersection &previous_intersection,
|
||||
const LaneDescriptionID &previous_lane_description_id,
|
||||
const LaneDataVector &previous_lane_data)
|
||||
Intersection TurnLaneHandler::handleSliproadTurn(Intersection intersection,
|
||||
const LaneDescriptionID lane_description_id,
|
||||
LaneDataVector lane_data,
|
||||
const Intersection &previous_intersection)
|
||||
{
|
||||
const auto sliproad_index =
|
||||
const std::size_t sliproad_index =
|
||||
std::distance(previous_intersection.begin(),
|
||||
std::find_if(previous_intersection.begin(),
|
||||
previous_intersection.end(),
|
||||
|
||||
@@ -256,7 +256,8 @@ Intersection triviallyMatchLanesToTurns(Intersection intersection,
|
||||
BOOST_ASSERT(findBestMatch(lane_data[lane].tag, intersection) ==
|
||||
intersection.begin() + road_index);
|
||||
|
||||
if (TurnType::Suppressed == intersection[road_index].turn.instruction.type)
|
||||
if (TurnType::Suppressed == intersection[road_index].turn.instruction.type &&
|
||||
!lane_data[lane].suppress_assignment)
|
||||
intersection[road_index].turn.instruction.type = TurnType::UseLane;
|
||||
|
||||
matchRoad(intersection[road_index], lane_data[lane]);
|
||||
|
||||
Reference in New Issue
Block a user