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

Support OSM traffic signal directions #6153

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

mjjbell
Copy link
Member

@mjjbell mjjbell commented Nov 3, 2021

Issue

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.

Tasklist

Requirements / Relations

Fixes #1317

@mjjbell mjjbell force-pushed the mbell/one_way_traffic_signs branch 3 times, most recently from 60d40af to 5d1a40e Compare August 23, 2022 15:35
@mjjbell mjjbell mentioned this pull request Aug 23, 2022
7 tasks
@mjjbell mjjbell force-pushed the mbell/one_way_traffic_signs branch 3 times, most recently from eaed828 to 3e01644 Compare August 28, 2022 16:14
@mjjbell mjjbell changed the title WIP: Support OSM traffic signal directions Support OSM traffic signal directions Aug 28, 2022
@mjjbell mjjbell mentioned this pull request Aug 28, 2022

namespace TrafficLightClass
{
typedef std::uint8_t Direction;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. using Direction = uint8_t;

and why not make it enum btw?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just copied an existing type that interfaces with lua.
I didn't actually explore if enums work. I'll take a look.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it appears to work 👍

@@ -0,0 +1,25 @@
local traffic_lights = traffic_lights
Copy link
Member

@SiarheiFedartsou SiarheiFedartsou Aug 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. I may be wrong, but it seems this is redundant(but probably I would somehow highlight that this enum is declared from outside in C++ code)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've no idea where that's come from, will remove.

node_duration_penalty = extraction_turn.duration * 10;
node_weight_penalty = extraction_turn.weight * weight_multiplier;

if (has_forward_signal)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Let’s consider extracting small function to avoid code duplication here. Also for me 10 feels as magic number here - may be extract to constant?

std::unordered_set<std::pair<NodeID, NodeID>, boost::hash<std::pair<NodeID, NodeID>>>
unidirectional_segments;

inline bool hasSignal(NodeID from, NodeID to) const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. Not sure we follow such code style everywhere but it seems it should be HasSignal

Copy link
Member

@SiarheiFedartsou SiarheiFedartsou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 please take a look on my comments

@mjjbell mjjbell force-pushed the mbell/one_way_traffic_signs branch 2 times, most recently from 0c0406c to 2e8bb4a Compare August 29, 2022 21:42
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.
@mjjbell mjjbell force-pushed the mbell/one_way_traffic_signs branch from 2e8bb4a to 7a00cbd Compare August 29, 2022 21:43
@mjjbell mjjbell merged commit b17cbb4 into Project-OSRM:master Aug 30, 2022
datendelphin added a commit to fossgis-routing-server/osrm-backend that referenced this pull request Dec 18, 2022
v5.27.0

- Changes from 5.26.0
    - API:
      - ADDED: Add Flatbuffers support to NodeJS bindings. [Project-OSRM#6338](Project-OSRM#6338)
      - CHANGED: Add `data_version` field to responses of all services. [Project-OSRM#5387](Project-OSRM#5387)
      - FIXED: Use Boost.Beast to parse HTTP request. [Project-OSRM#6294](Project-OSRM#6294)
      - FIXED: Fix inefficient osrm-routed connection handling [Project-OSRM#6113](https://gihub.com/Project-OSRM/osrm-backend/pull/6113)
      - FIXED: Fix HTTP compression precedence [Project-OSRM#6113](Project-OSRM#6113)
    - NodeJS:
      - FIXED: Support `skip_waypoints` in Node bindings [Project-OSRM#6060](Project-OSRM#6060)
    - Misc:
      - ADDED: conanbuildinfo.json for easy reading of dependencies [Project-OSRM#6388](Project-OSRM#6388)
      - CHANGED: Improve performance of JSON rendering. Fix undefined behaviour in JSON numbers formatting. [Project-OSRM#6380](Project-OSRM#6380)
      - ADDED: Add timestamps for logs. [Project-OSRM#6375](Project-OSRM#6375)
      - CHANGED: Improve performance of map matching via getPathDistance optimization. [Project-OSRM#6378](Project-OSRM#6378)
      - CHANGED: Optimize RestrictionParser performance. [Project-OSRM#6344](Project-OSRM#6344)
      - ADDED: Support floats for speed value in traffic updates CSV. [Project-OSRM#6327](Project-OSRM#6327)
      - CHANGED: Use Lua 5.4 in Docker image. [Project-OSRM#6346](Project-OSRM#6346)
      - CHANGED: Remove redundant nullptr check. [Project-OSRM#6326](Project-OSRM#6326)
      - CHANGED: missing files list is included in exception message. [Project-OSRM#5360](Project-OSRM#5360)
      - CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [Project-OSRM#6318](Project-OSRM#6318)
      - FIXED: Fix distance calculation consistency. [Project-OSRM#6315](Project-OSRM#6315)
      - FIXED: Fix performance issue after migration to sol2 3.3.0. [Project-OSRM#6304](Project-OSRM#6304)
      - CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [Project-OSRM#6298](Project-OSRM#6298)
      - FIXED: Fix bug with reading Set values from Lua scripts. [Project-OSRM#6285](Project-OSRM#6285)
      - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [Project-OSRM#6296](Project-OSRM#6296)
      - FIXED: Internal refactoring of identifier types used in data facade [Project-OSRM#6044](Project-OSRM#6044)
      - CHANGED: Update docs to reflect recent build and dependency changes [Project-OSRM#6383](Project-OSRM#6383)
    - Build:
      - REMOVED: Get rid of Mason. [Project-OSRM#6387](Project-OSRM#6387)
      - CHANGED: Use clang-format from CI base image. [Project-OSRM#6391](Project-OSRM#6391)
      - ADDED: Build Node bindings on Windows. [Project-OSRM#6334](Project-OSRM#6334)
      - ADDED: Configure cross-compilation for Apple Silicon. [Project-OSRM#6360](Project-OSRM#6360)
      - CHANGED: Use apt-get to install Clang on CI. [Project-OSRM#6345](Project-OSRM#6345)
      - CHANGED: Fix TBB in case of Conan + NodeJS build. [Project-OSRM#6333](Project-OSRM#6333)
      - CHANGED: Migrate to modern TBB version. [Project-OSRM#6300](Project-OSRM#6300)
      - CHANGED: Enable performance-move-const-arg clang-tidy check. [Project-OSRM#6319](Project-OSRM#6319)
      - CHANGED: Use the latest node on CI. [Project-OSRM#6317](Project-OSRM#6317)
      - CHANGED: Migrate Windows CI to GitHub Actions. [Project-OSRM#6312](Project-OSRM#6312)
      - ADDED: Add smoke test for Docker image. [Project-OSRM#6313](Project-OSRM#6313)
      - CHANGED: Update libosmium to version 2.18.0. [Project-OSRM#6303](Project-OSRM#6303)
      - CHANGED: Remove EXACT from find_package if using Conan. [Project-OSRM#6299](Project-OSRM#6299)
      - CHANGED: Configure Undefined Behaviour Sanitizer. [Project-OSRM#6290](Project-OSRM#6290)
      - CHANGED: Use Conan instead of Mason to install code dependencies. [Project-OSRM#6284](Project-OSRM#6284)
      - CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [Project-OSRM#6279](Project-OSRM#6279)
      - CHANGED: Update macOS CI image to macos-11. [Project-OSRM#6286](Project-OSRM#6286)
      - CHANGED: Enable even more clang-tidy checks. [Project-OSRM#6273](Project-OSRM#6273)
      - CHANGED: Configure CMake to not build flatbuffers tests and samples. [Project-OSRM#6274](Project-OSRM#6274)
      - CHANGED: Enable more clang-tidy checks. [Project-OSRM#6270](Project-OSRM#6270)
      - CHANGED: Configure clang-tidy job on CI. [Project-OSRM#6261](Project-OSRM#6261)
      - CHANGED: Use Github Actions for building container images [Project-OSRM#6138](Project-OSRM#6138)
      - CHANGED: Upgrade Boost dependency to 1.70 [Project-OSRM#6113](Project-OSRM#6113)
      - CHANGED: Upgrade Ubuntu CI builds to 20.04  [Project-OSRM#6119](Project-OSRM#6119)
      - CHANGED: Make building osrm-routed optional [Project-OSRM#6144](Project-OSRM#6144)
      - FIXED: Run all unit tests in CI [Project-OSRM#5248](Project-OSRM#5248)
      - FIXED: Fix installation of Mason CMake and 32 bit CI build [Project-OSRM#6170](Project-OSRM#6170)
      - FIXED: Fixed Node docs generation check in CI. [Project-OSRM#6058](Project-OSRM#6058)
      - CHANGED: Docker build, enabled arm64 build layer [Project-OSRM#6172](Project-OSRM#6172)
      - CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [Project-OSRM#6175](Project-OSRM#6175)
      - FIXED: Bump CI complete meta job to ubuntu-20.04 [Project-OSRM#6323](Project-OSRM#6323)
      - CHANGED: Node packages are now scoped by @Project-OSRM [Project-OSRM#6386](Project-OSRM#6386)
    - Routing:
      - CHANGED: Lazily generate optional route path data [Project-OSRM#6045](Project-OSRM#6045)
      - FIXED: Completed support for no_entry and no_exit turn restrictions. [Project-OSRM#5988](Project-OSRM#5988)
      - ADDED: Add support for non-round-trips with a single fixed endpoint. [Project-OSRM#6050](Project-OSRM#6050)
      - FIXED: Improvements to maneuver override processing [Project-OSRM#6125](Project-OSRM#6125)
      - ADDED: Support snapping to multiple ways at an input location. [Project-OSRM#5953](Project-OSRM#5953)
      - FIXED: Fix snapping target locations to ways used in turn restrictions. [Project-OSRM#6339](Project-OSRM#6339)
      - ADDED: Support OSM traffic signal directions. [Project-OSRM#6153](Project-OSRM#6153)
      - FIXED: Ensure u-turn exists in intersection view. [Project-OSRM#6376](Project-OSRM#6376)
      - FIXED: Gracefully handle no-turn intersections in guidance processing. [Project-OSRM#6382](Project-OSRM#6382)
    - Profile:
      - CHANGED: Bicycle surface speeds [Project-OSRM#6212](Project-OSRM#6212)
    - Tools:
      - CHANGED: Do not generate intermediate .osrm file in osrm-extract. [Project-OSRM#6354](Project-OSRM#6354)
datendelphin added a commit to fossgis-routing-server/osrm-backend that referenced this pull request Dec 18, 2022
v5.27.0

- Changes from 5.26.0
    - API:
      - ADDED: Add Flatbuffers support to NodeJS bindings. [Project-OSRM#6338](Project-OSRM#6338)
      - CHANGED: Add `data_version` field to responses of all services. [Project-OSRM#5387](Project-OSRM#5387)
      - FIXED: Use Boost.Beast to parse HTTP request. [Project-OSRM#6294](Project-OSRM#6294)
      - FIXED: Fix inefficient osrm-routed connection handling [Project-OSRM#6113](https://gihub.com/Project-OSRM/osrm-backend/pull/6113)
      - FIXED: Fix HTTP compression precedence [Project-OSRM#6113](Project-OSRM#6113)
    - NodeJS:
      - FIXED: Support `skip_waypoints` in Node bindings [Project-OSRM#6060](Project-OSRM#6060)
    - Misc:
      - ADDED: conanbuildinfo.json for easy reading of dependencies [Project-OSRM#6388](Project-OSRM#6388)
      - CHANGED: Improve performance of JSON rendering. Fix undefined behaviour in JSON numbers formatting. [Project-OSRM#6380](Project-OSRM#6380)
      - ADDED: Add timestamps for logs. [Project-OSRM#6375](Project-OSRM#6375)
      - CHANGED: Improve performance of map matching via getPathDistance optimization. [Project-OSRM#6378](Project-OSRM#6378)
      - CHANGED: Optimize RestrictionParser performance. [Project-OSRM#6344](Project-OSRM#6344)
      - ADDED: Support floats for speed value in traffic updates CSV. [Project-OSRM#6327](Project-OSRM#6327)
      - CHANGED: Use Lua 5.4 in Docker image. [Project-OSRM#6346](Project-OSRM#6346)
      - CHANGED: Remove redundant nullptr check. [Project-OSRM#6326](Project-OSRM#6326)
      - CHANGED: missing files list is included in exception message. [Project-OSRM#5360](Project-OSRM#5360)
      - CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [Project-OSRM#6318](Project-OSRM#6318)
      - FIXED: Fix distance calculation consistency. [Project-OSRM#6315](Project-OSRM#6315)
      - FIXED: Fix performance issue after migration to sol2 3.3.0. [Project-OSRM#6304](Project-OSRM#6304)
      - CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [Project-OSRM#6298](Project-OSRM#6298)
      - FIXED: Fix bug with reading Set values from Lua scripts. [Project-OSRM#6285](Project-OSRM#6285)
      - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [Project-OSRM#6296](Project-OSRM#6296)
      - FIXED: Internal refactoring of identifier types used in data facade [Project-OSRM#6044](Project-OSRM#6044)
      - CHANGED: Update docs to reflect recent build and dependency changes [Project-OSRM#6383](Project-OSRM#6383)
    - Build:
      - REMOVED: Get rid of Mason. [Project-OSRM#6387](Project-OSRM#6387)
      - CHANGED: Use clang-format from CI base image. [Project-OSRM#6391](Project-OSRM#6391)
      - ADDED: Build Node bindings on Windows. [Project-OSRM#6334](Project-OSRM#6334)
      - ADDED: Configure cross-compilation for Apple Silicon. [Project-OSRM#6360](Project-OSRM#6360)
      - CHANGED: Use apt-get to install Clang on CI. [Project-OSRM#6345](Project-OSRM#6345)
      - CHANGED: Fix TBB in case of Conan + NodeJS build. [Project-OSRM#6333](Project-OSRM#6333)
      - CHANGED: Migrate to modern TBB version. [Project-OSRM#6300](Project-OSRM#6300)
      - CHANGED: Enable performance-move-const-arg clang-tidy check. [Project-OSRM#6319](Project-OSRM#6319)
      - CHANGED: Use the latest node on CI. [Project-OSRM#6317](Project-OSRM#6317)
      - CHANGED: Migrate Windows CI to GitHub Actions. [Project-OSRM#6312](Project-OSRM#6312)
      - ADDED: Add smoke test for Docker image. [Project-OSRM#6313](Project-OSRM#6313)
      - CHANGED: Update libosmium to version 2.18.0. [Project-OSRM#6303](Project-OSRM#6303)
      - CHANGED: Remove EXACT from find_package if using Conan. [Project-OSRM#6299](Project-OSRM#6299)
      - CHANGED: Configure Undefined Behaviour Sanitizer. [Project-OSRM#6290](Project-OSRM#6290)
      - CHANGED: Use Conan instead of Mason to install code dependencies. [Project-OSRM#6284](Project-OSRM#6284)
      - CHANGED: Migrate to C++17. Update sol2 to 3.3.0. [Project-OSRM#6279](Project-OSRM#6279)
      - CHANGED: Update macOS CI image to macos-11. [Project-OSRM#6286](Project-OSRM#6286)
      - CHANGED: Enable even more clang-tidy checks. [Project-OSRM#6273](Project-OSRM#6273)
      - CHANGED: Configure CMake to not build flatbuffers tests and samples. [Project-OSRM#6274](Project-OSRM#6274)
      - CHANGED: Enable more clang-tidy checks. [Project-OSRM#6270](Project-OSRM#6270)
      - CHANGED: Configure clang-tidy job on CI. [Project-OSRM#6261](Project-OSRM#6261)
      - CHANGED: Use Github Actions for building container images [Project-OSRM#6138](Project-OSRM#6138)
      - CHANGED: Upgrade Boost dependency to 1.70 [Project-OSRM#6113](Project-OSRM#6113)
      - CHANGED: Upgrade Ubuntu CI builds to 20.04  [Project-OSRM#6119](Project-OSRM#6119)
      - CHANGED: Make building osrm-routed optional [Project-OSRM#6144](Project-OSRM#6144)
      - FIXED: Run all unit tests in CI [Project-OSRM#5248](Project-OSRM#5248)
      - FIXED: Fix installation of Mason CMake and 32 bit CI build [Project-OSRM#6170](Project-OSRM#6170)
      - FIXED: Fixed Node docs generation check in CI. [Project-OSRM#6058](Project-OSRM#6058)
      - CHANGED: Docker build, enabled arm64 build layer [Project-OSRM#6172](Project-OSRM#6172)
      - CHANGED: Docker build, enabled apt-get update/install caching in separate layer for build phase [Project-OSRM#6175](Project-OSRM#6175)
      - FIXED: Bump CI complete meta job to ubuntu-20.04 [Project-OSRM#6323](Project-OSRM#6323)
      - CHANGED: Node packages are now scoped by @Project-OSRM [Project-OSRM#6386](Project-OSRM#6386)
    - Routing:
      - CHANGED: Lazily generate optional route path data [Project-OSRM#6045](Project-OSRM#6045)
      - FIXED: Completed support for no_entry and no_exit turn restrictions. [Project-OSRM#5988](Project-OSRM#5988)
      - ADDED: Add support for non-round-trips with a single fixed endpoint. [Project-OSRM#6050](Project-OSRM#6050)
      - FIXED: Improvements to maneuver override processing [Project-OSRM#6125](Project-OSRM#6125)
      - ADDED: Support snapping to multiple ways at an input location. [Project-OSRM#5953](Project-OSRM#5953)
      - FIXED: Fix snapping target locations to ways used in turn restrictions. [Project-OSRM#6339](Project-OSRM#6339)
      - ADDED: Support OSM traffic signal directions. [Project-OSRM#6153](Project-OSRM#6153)
      - FIXED: Ensure u-turn exists in intersection view. [Project-OSRM#6376](Project-OSRM#6376)
      - FIXED: Gracefully handle no-turn intersections in guidance processing. [Project-OSRM#6382](Project-OSRM#6382)
    - Profile:
      - CHANGED: Bicycle surface speeds [Project-OSRM#6212](Project-OSRM#6212)
    - Tools:
      - CHANGED: Do not generate intermediate .osrm file in osrm-extract. [Project-OSRM#6354](Project-OSRM#6354)
mattwigway pushed a commit to mattwigway/osrm-backend that referenced this pull request Jul 20, 2023
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.
@GitBenjamin
Copy link
Contributor

GitBenjamin commented Oct 16, 2023

Hi, @mjjbell, @SiarheiFedartsou.
I did a lot of testing and found that most traffic signal problems can be solved, but there are some problems with one type of scenario. Like this one, osm_data.

  • Data

image
This is an intersection with a traffic signal in the center that acts in all four directions.

  • Process (about traffic signal)

According to this solution, I copy the traffic signal to the middle node of the four roads and add "traffic_signals:direction" info to traffic_signal node.

  • Route Test

When I get to route UnknownRoad to NewRoad, the duration is 13.5s, and when I get to route NewRoad to UnknownRoad, the duration is 33.5s, traffic signal penalty is 20s. The two schemes covered the same number of miles and traffic lights, but took different time.

So, I tweaked "traffic_signals:direction" a lot, but nothing worked out. I hope I can get your help.

@GitBenjamin
Copy link
Contributor

Hi, @mjjbell, @SiarheiFedartsou. I did a lot of testing and found that most traffic signal problems can be solved, but there are some problems with one type of scenario. Like this one, osm_data.

  • Data

image This is an intersection with a traffic signal in the center that acts in all four directions.

  • Process (about traffic signal)

According to this solution, I copy the traffic signal to the middle node of the four roads and add "traffic_signals:direction" info to traffic_signal node.

  • Route Test

When I get to route UnknownRoad to NewRoad, the duration is 13.5s, and when I get to route NewRoad to UnknownRoad, the duration is 33.5s, traffic signal penalty is 20s. The two schemes covered the same number of miles and traffic lights, but took different time.

So, I tweaked "traffic_signals:direction" a lot, but nothing worked out. I hope I can get your help.

Hi, @mjjbell, @SiarheiFedartsou . I reviewed the code for the branch Support OSM traffic signal directions, i found a bug:

Traffic_signal_bug

As shown in the picture above, when i first compress node_C, there will be no traffic signal penalty for D->A route. Because when i compress node_B, traffic_signals.HasSignal(node_A, node_B) and traffic_signals.HasSignal(node_D, node_B) are both false. Unless we compress node_B first, or graph.SetTarget(forward_e1, node_c) not executed when node_C is being compressed.

@mjjbell
Copy link
Member Author

mjjbell commented Nov 1, 2023

Yes, you're right. The traffic signals need a compressor wrapper to handle compression events, similar to the way turn path relations handle it.

turn_path_compressor.Compress(node_u, node_v, node_w);

@GitBenjamin
Copy link
Contributor

GitBenjamin commented Nov 1, 2023

Yes, you're right. The traffic signals need a compressor wrapper to handle compression events, similar to the way turn path relations handle it.

turn_path_compressor.Compress(node_u, node_v, node_w);

I try fix a bug caused by support OSM traffic signal directions. I hope to get you help and review.
#6724

@mjjbell
Copy link
Member Author

mjjbell commented Mar 16, 2024

@GitBenjamin using your example, I created a minimal test case that currently fails.

@routing @car @traffic_light
Feature: Car - Handle traffic lights

    Background:
        Given the profile "car"

    Scenario: Car - Traffic signal direction with edge compression
        Given the node map
            """
            a-1-b - c - d-2-e

            """

        And the ways
            | nodes | highway |
            | abcde | primary |

        And the nodes
            | node | highway         | traffic_signals:direction |
            | c    | traffic_signals | forward                   |

        When I route I should get
            | from | to | time   | weight | #                   |
            | 1    | 2  |  35.3s | 35.3   | with traffic light  |
            | 2    | 1  |  33.3s | 33.3   | no traffic light    |

Let's get your PR updated so that this test passes.

@Redy1908
Copy link

Redy1908 commented Apr 2, 2024

Is this change present in the docker image? I am encountering identical errors as reported in issues #6665 and #6663:

traffic_signal.lua:12: attempt to index global 'traffic_lights' (a nil value)

These errors occur only when I manually import profiles/lib/traffic_signal.lua into opt/lib. Otherwise i get traffic_signal.lua file not found. I have also verified that the file is effectively not present within the container.

Below is the Dockerfile I am using:

FROM osrm/osrm-backend

COPY ./data /data
COPY profiles/car.lua /opt

ENV OSRM_FILE=sud-latest

RUN osrm-extract -p /opt/car.lua /data/${OSRM_FILE}.osm.pbf && \
        osrm-partition /data/${OSRM_FILE}.osrm && \
        osrm-customize /data/${OSRM_FILE}.osrm;

EXPOSE 5000

CMD osrm-routed --algorithm mld /data/${OSRM_FILE}.osrm

@mjjbell
Copy link
Member Author

mjjbell commented Apr 2, 2024

@Redy1908 can you confirm what version of osrm-extract and the car.lua profile you are using?
As discussed in #6663, this can happen when you use a newer profile on an older execuatable.

There is no forward compatibility in this respect. In general, OSRM datasets are not compatible across minor releases.

@Redy1908
Copy link

Redy1908 commented Apr 3, 2024

I am currently using this profile with the most recent Docker image, osrm/osrm-backend which as you said seems to not have this change included. Therefore, if I wish to continue using the Docker image, I should either revert to an older profile or remove the related bits of code to this commit from the profile right?

@mjjbell
Copy link
Member Author

mjjbell commented Apr 3, 2024

I am currently using this profile with the most recent Docker image, osrm/osrm-backend which as you said seems to not have this change included. Therefore, if I wish to continue using the Docker image, I should either revert to an older profile or remove the related bits of code to this commit from the profile right?

The latest images are hosted on Github: https://github.com/Project-OSRM/osrm-backend/pkgs/container/osrm-backend
Docker Hub's last image was 5.25.0, so your case is an example of newer profile with older version.

If you are using a default profile, they come bundled with the container in /opt/

See the docker instructions for full details.

@Redy1908
Copy link

Redy1908 commented Apr 3, 2024

The latest images are hosted on Github: https://github.com/Project-OSRM/osrm-backend/pkgs/container/osrm-backend
Docker Hub's last image was 5.25.0, so your case is an example of newer profile with older version.

I was missing that, thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

traffic_signals:direction for traffic signal penalties
4 participants