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

Prevent bicycles from using stairs #4614

Merged

Conversation

leonardehrenfried
Copy link
Member

Summary

This hard-bans bicycles from using stairs even as a last resort.

Whether this is too strict or there are nuances we need to discuss in the developer meeting.

Issue

Fixes #4613

Unit tests

Added.

cc @tsobuskerudbyen

@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2022

Codecov Report

Base: 60.63% // Head: 60.65% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (542b4a5) compared to base (4a0796c).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #4614      +/-   ##
=============================================
+ Coverage      60.63%   60.65%   +0.02%     
- Complexity     12229    12251      +22     
=============================================
  Files           1580     1580              
  Lines          63461    63491      +30     
  Branches        6994     6997       +3     
=============================================
+ Hits           38481    38513      +32     
  Misses         22801    22801              
+ Partials        2179     2177       -2     
Impacted Files Coverage Δ
...outing/api/request/preference/BikePreferences.java 88.88% <100.00%> (+0.69%) ⬆️
...dalone/config/routerequest/RouteRequestConfig.java 97.94% <100.00%> (+0.02%) ⬆️
.../opentripplanner/street/model/edge/StreetEdge.java 87.25% <100.00%> (+0.05%) ⬆️
...va/org/opentripplanner/api/mapping/ModeMapper.java 11.11% <0.00%> (-0.66%) ⬇️
...g/opentripplanner/api/mapping/RouteTypeMapper.java 0.00% <0.00%> (ø)
.../opentripplanner/api/parameter/ApiRequestMode.java 100.00% <0.00%> (ø)
...legacygraphqlapi/generated/LegacyGraphQLTypes.java 0.00% <0.00%> (ø)
.../standalone/config/framework/json/NodeAdapter.java 95.23% <0.00%> (+1.19%) ⬆️
...entripplanner/transit/model/basic/TransitMode.java 95.65% <0.00%> (+1.20%) ⬆️
...g/opentripplanner/api/parameter/QualifiedMode.java 68.42% <0.00%> (+2.63%) ⬆️
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@leonardehrenfried
Copy link
Member Author

At today's developer meeting we talked about it: we want to not totally ban bicycles on stairs but we want to give a very high default penalty so it's only used as a last resort. This cost is configurable so you can also exclude bikes on stairs.

@optionsome
Copy link
Member

I discussed this with some people at HSL and they thought it might make sense to perhaps modify the cost based on https://wiki.openstreetmap.org/wiki/Key:ramp but would we then need two new parameters (bicycle walking on stairs with and without ramps)? I don't want to force you into doing this now but it's something we could consider and perhaps I (or someone else from Digitransit) could implement it at some point.

Also, I wonder if the stairs reluctance is actually a client specific thing or something we should configure in the "safety" values as it would be more flexible in taking into account different tagging? However, the stairs also affect the traversal time so it's a bit more complicated.

@leonardehrenfried
Copy link
Member Author

I discussed this with some people at HSL and they thought it might make sense to perhaps modify the cost based on https://wiki.openstreetmap.org/wiki/Key:ramp but would we then need two new parameters (bicycle walking on stairs with and without ramps)? I don't want to force you into doing this now but it's something we could consider and perhaps I (or someone else from Digitransit) could implement it at some point.

Also, I wonder if the stairs reluctance is actually a client specific thing or something we should configure in the "safety" values as it would be more flexible in taking into account different tagging? However, the stairs also affect the traversal time so it's a bit more complicated.

At the moment it's not possible to assign a bike safety value to a set of stairs as bikes are not allowed on it:

props.setProperties("highway=steps", pedestrianWayProperties);

That doesn't mean that we cannot change it. Let's discuss it in the dev meeting.

@leonardehrenfried leonardehrenfried marked this pull request as draft November 29, 2022 09:04
@t2gran t2gran added this to the 2.3 milestone Dec 1, 2022
@leonardehrenfried leonardehrenfried marked this pull request as ready for review December 1, 2022 14:48
@leonardehrenfried
Copy link
Member Author

leonardehrenfried commented Dec 1, 2022

At today's meeting we discussed this. @hannesj and I were of the opinion that it's best to have a separate reluctance parameter, which I already added last week.

@optionsome, if you disagree, lets discuss this in the issue.

Comment on lines 238 to 240
if (mode.isCycling() && isStairs()) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we set this already in the WayPropetySet, then we wouldn't need to check it during runtime?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, this can go away. The tag mapper already does that (

props.setProperties("highway=steps", pedestrianWayProperties);
) but my test doesn't reflect this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

hannesj
hannesj previously approved these changes Dec 2, 2022
Comment on lines 49 to 50
// very high reluctance to carry the bike up/down a flight of stairs
this.stairsReluctance = 100;
Copy link
Member

Choose a reason for hiding this comment

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

Would you bike for 1h40m to avoid walking the stairs for 1 minute? I think 10 probably are better. We should try to use sensible values - if not, we undermine what "reluctance" mean.

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 was thinking more like: cycling 100 meters to avoid a one meter stairs. I would definitely take the long way.

Am I thinking about it the wrong way?

Copy link
Member

Choose a reason for hiding this comment

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

We usually use time as a unit, if not it you must adjust when the speed changes. Generaflized-cost is equivalent of spending 1 second on a transit vehicle.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a reason for this is that by default the time and cost of switching between walking and biking is 0, we should have some more reasonable defaults. That way the multiplier here can be more realistic

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 tested it with the original case in Kongsberg and even with a comparatively low reluctance of 10 the stairs are avoided. That is what we want.

Before

Screenshot from 2022-12-05 10-01-45

After

Screenshot from 2022-12-05 10-01-27

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I realised that I already do that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Or are you talking about the bike switch cost/time?

Copy link
Member

Choose a reason for hiding this comment

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

I think is correct, multiplying the weigh is a reluctance. Strictly is a scalar, but the weight in transit seconds. See StreetEdge

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have a separate PR, where we change the default switch time & cost?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's a good idea.

@t2gran
Copy link
Member

t2gran commented Dec 5, 2022

Should I be using Units.reluctance to make it easier to read?

We have a way to go here, but yes I think that would be nice. Some day we might use over own types instead of ints and doubles, then we can enforce "unit-safty" as well. You may leave it for now.

@leonardehrenfried
Copy link
Member Author

I realised that I already did use Units.reluctance.

@leonardehrenfried leonardehrenfried merged commit 13fadaf into opentripplanner:dev-2.x Dec 5, 2022
t2gran pushed a commit that referenced this pull request Dec 5, 2022
@leonardehrenfried leonardehrenfried deleted the bike-stairs branch December 5, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bicycles are allowed to traverse stairs
5 participants