Skip to content

do not overwrite vehicle maxspeed with higher value, fixes #6979#7036

Closed
woodpeck wants to merge 6 commits intoProject-OSRM:masterfrom
woodpeck:fix-maxspeed
Closed

do not overwrite vehicle maxspeed with higher value, fixes #6979#7036
woodpeck wants to merge 6 commits intoProject-OSRM:masterfrom
woodpeck:fix-maxspeed

Conversation

@woodpeck
Copy link
Copy Markdown
Contributor

@woodpeck woodpeck commented Sep 26, 2024

Issue

Fix the overwriting of a lower vehicle-based maxspeed by a higher signposted (edge-based) maxspeed

Tasklist

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@github-actions
Copy link
Copy Markdown
Contributor

This PR seems to be stale. Is it still relevant?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to fix a maxspeed handling issue in the Lua car profile logic so that a higher signposted (edge-based) maxspeed does not override a lower vehicle-based maxspeed.

Changes:

  • Update WayHandlers.maxspeed to apply maxspeed via math.min(...) against the current computed speeds.
  • Add a CHANGELOG entry documenting the fix under Profiles.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
profiles/lib/way_handlers.lua Changes maxspeed application to clamp against the current forward/backward speeds.
CHANGELOG.md Adds a Profiles FIXED entry describing the behavior change.
Comments suppressed due to low confidence (3)

profiles/lib/way_handlers.lua:442

  • Using math.min() here prevents maxspeed tags from ever increasing the computed speed above the way-type/default speed set by WayHandlers.speed. This contradicts existing profile behavior/tests (e.g., features/car/maxspeed.feature scenario "Do not ignore maxspeed when higher than way speed" expects residential maxspeed=90 to yield 72 km/h after speed_reduction). Consider restoring the overwrite behavior and instead only clamping against an explicit vehicle-specific maximum (if that’s what needs protection), so maxspeed can still raise speeds when appropriate.
    end
    if result.backward_speed > 0 then
      result.backward_rate = (result.backward_speed * backward_penalty) / 3.6

profiles/lib/way_handlers.lua:446

  • Same issue as forward direction: math.min() here prevents maxspeed:backward (or maxspeed) from increasing backward_speed above the baseline speed, which will break scenarios where directional maxspeed is higher than the default/general value and is expected to override it.
    if result.duration > 0 then
      result.weight = result.duration / forward_penalty
    end

CHANGELOG.md:88

  • The new changelog entry sentence starts with a lowercase "edge" while surrounding FIXED entries use sentence-style capitalization. Consider capitalizing it (and optionally clarifying wording, e.g., "Edge maxspeed…"), to keep formatting consistent within the section.
      - REMOVED: Remove unused AppVeyor files [#6860](https://github.com/Project-OSRM/osrm-backend/pull/6860)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DennisOSRM
Copy link
Copy Markdown
Collaborator

Implemented in separate PR linked above.

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.

4 participants