Support OSM traffic signal directions (#6153)
Currently OSRM parses traffic signal nodes without consideration for the direction in which the signal applies. This can lead to duplicated routing penalties, especially when a forward and backward signal are in close proximity on a way. This commit adds support for directed signals to the extraction and graph creation. Signal penalties are only applied in the direction specified by the OSM tag. We add the assignment of traffic directions to the lua scripts, maintaining backwards compatibility with the existing boolean traffic states. As part of the changes to the internal structures used for tracking traffic signals during extraction, we stop serialising/deserialising signals to the `.osrm` file. The traffic signals are only used by `osrm-extract` so whilst this is a data format change, it will not break any existing user processes.
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -66,7 +65,7 @@ BOOST_AUTO_TEST_CASE(long_road_test)
|
||||
GraphCompressor compressor;
|
||||
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(1);
|
||||
CompressedEdgeContainer container;
|
||||
@@ -112,7 +111,7 @@ BOOST_AUTO_TEST_CASE(loop_test)
|
||||
GraphCompressor compressor;
|
||||
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(1);
|
||||
@@ -175,7 +174,7 @@ BOOST_AUTO_TEST_CASE(t_intersection)
|
||||
GraphCompressor compressor;
|
||||
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(1);
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
@@ -218,7 +217,7 @@ BOOST_AUTO_TEST_CASE(street_name_changes)
|
||||
GraphCompressor compressor;
|
||||
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(2);
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
@@ -256,7 +255,7 @@ BOOST_AUTO_TEST_CASE(direction_changes)
|
||||
GraphCompressor compressor;
|
||||
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(1);
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
@@ -19,7 +19,7 @@ using Graph = util::NodeBasedDynamicGraph;
|
||||
BOOST_AUTO_TEST_CASE(simple_intersection_connectivity)
|
||||
{
|
||||
std::unordered_set<NodeID> barrier_nodes{6};
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations{
|
||||
{EMPTY_NAMEID, 0, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false},
|
||||
{EMPTY_NAMEID, 1, INAVLID_CLASS_DATA, TRAVEL_MODE_DRIVING, false}};
|
||||
@@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(simple_intersection_connectivity)
|
||||
BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity)
|
||||
{
|
||||
std::unordered_set<NodeID> barrier_nodes;
|
||||
std::unordered_set<NodeID> traffic_lights;
|
||||
TrafficSignals traffic_lights;
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations;
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
@@ -259,7 +259,7 @@ BOOST_AUTO_TEST_CASE(roundabout_intersection_connectivity)
|
||||
BOOST_AUTO_TEST_CASE(skip_degree_two_nodes)
|
||||
{
|
||||
std::unordered_set<NodeID> barrier_nodes{1};
|
||||
std::unordered_set<NodeID> traffic_lights{2};
|
||||
TrafficSignals traffic_lights = {{2}, {}};
|
||||
std::vector<NodeBasedEdgeAnnotation> annotations(1);
|
||||
std::vector<TurnRestriction> restrictions;
|
||||
CompressedEdgeContainer container;
|
||||
|
||||
Reference in New Issue
Block a user