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

Favor turn channels more #3222

Merged
merged 5 commits into from
Jul 21, 2021
Merged

Favor turn channels more #3222

merged 5 commits into from
Jul 21, 2021

Conversation

merkispavel
Copy link
Contributor

Issue

At the moment we boost turn channel speeds by some factor

speed = static_cast<uint32_t>((speed * kTurnChannelFactor) + 0.5f);

But we don't do anything with its speeds/costs when there are historic speeds.

PR changes:

  • reduce kTurnChannel edge cost for both has-historic-speeds and doesn't-have-historic-speeds cases
  • increase turn channel factor 1.25 -> 1.66. (Note: 1.66 is basically 1 / 0.6)

Screenshots

Before After
image image
image image
image image

Tasklist

  • Add tests
  • Add #fixes with the issue number that this PR addresses
  • Update the docs with any new request parameters or changes to behavior described
  • Update the changelog
  • If you made changes to the lua files, update the taginfo too.

Requirements / Relations

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

@@ -263,9 +262,7 @@ class SpeedAssigner {
if (directededge.link()) {
uint32_t speed = directededge.speed();
Use use = directededge.use();
if (use == Use::kTurnChannel && infer_turn_channels) {
speed = static_cast<uint32_t>((speed * kTurnChannelFactor) + 0.5f);
Copy link
Contributor Author

@merkispavel merkispavel Jul 20, 2021

Choose a reason for hiding this comment

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

Should be noticed that durations will be increased after removing this line so I'm hesitating if it's the right move..
Alternative safe solution might be

  • leave speed_assigner code as it is
  • handle only if (edge.has_historic_speeds) case in the AutoCost::EdgeCost

cons:

  • Different turn channel factor in 2 places. It would be better to have everything in one place

Copy link
Member

Choose a reason for hiding this comment

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

thats a very good question you raise... here's my opinion:

in general, our speed assignments are always too optimistic. also turn channels are by definition short. i think its maybe its not a big deal to get 20% slower considering these two facts..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also turn channels are by definition short. i think its maybe its not a big deal to get 20% slower considering these two facts

agreed

@kevinkreiser
Copy link
Member

looks like you need to update the isochrone tests since they change just slightly (i guess they get slightly smaller)

@merkispavel
Copy link
Contributor Author

looks like you need to update the isochrone tests since they change just slightly (i guess they get slightly smaller)

thanks! didn't notice that ci had failed

yeah, it's just 3 points were changed a little bit( +- 1-e4). Fixed 👍

@merkispavel merkispavel merged commit 100a2d9 into master Jul 21, 2021
@kevinkreiser
Copy link
Member

@merkispavel @genadz
one thing i wanted to ask about here was the inverse problem. assuming we are in a right-hand driving country, is it possible that we take a right hand turn channel to make a left turn:

image

here the route is red. i havent checked but i think this is possible. i would, like uturns, hope that we penalize sharp turns off of turn channels so this only happens if its the only possibility for whatever reason. anyway i was just wondering if you saw anything like that in RAD

@merkispavel
Copy link
Contributor Author

merkispavel commented Jul 21, 2021

@kevinkreiser
I didn't see such cases in RAD. The reasons might be

  • there are not such cases in the RAD tests(like in your screenshot). So no one of them tests uturns
  • Turn channel end road sometimes is one way like in the screenshot below.Even if it's not one way - there's a chance that uturn restriction is already added. Plus, as you said, maybe we already assign increased turn weight for such sharp turns.

I'll double check manually that this PR doesn't add such bugs but I bet I won't find them. Non-oneway end road + no uturn restriction .. the chances are pretty low

image)

@kevinkreiser
Copy link
Member

yep i agree the chances are low, i just wanted to point it out

@dnesbitt61
Copy link
Member

the stop_impact is raised when making a sharp turn off of a turn channel - that likely will prevent this.

@nilsnolde nilsnolde deleted the tc-factor-v2 branch February 24, 2024 15:07
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.

None yet

4 participants