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

Blind user mode. #3694

Merged
merged 32 commits into from Feb 14, 2024
Merged

Blind user mode. #3694

merged 32 commits into from Feb 14, 2024

Conversation

grzezlo
Copy link
Contributor

@grzezlo grzezlo commented Aug 4, 2022

Special optional mode implemented in Valhalla turn-by-turn, for use in Seeing Assistant applications from @transition-technologies:

  • Announcing crossed streets, the stairs, bridges, tunnels, gates and bollards, which need to be passed on route.
  • Information about traffic signals on crosswalks.
  • Route numbers not announced for named routes.
  • Added blind_user_mode switch in query parameters.

No idea how to write the tests, also where to announce this new feature in CHANGELOG.md (maybe under ADDED: Indoor routing near line 84?)

Added processing of crossing=traffic_signals in mjolnir/pbfgraphparser.c, so updated `taginfo.json' too.

Issue

fixes #2989

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

No special requirements.

Special optional mode implemented in Valhalla for use in Seeing Assistant applications from @transition-technologies:
- Announcing crossed streets, the stairs, bridges, tunnels, gates and bollards, which need to be passed on route.
- Information about traffic signals on crosswalks.
- Route numbers not announced for named routes.
- Added blind_user_mode switch in query parameters.
@kevinkreiser
Copy link
Member

This is awesome I'll take a look at it more closely tonight most likely

@kevinkreiser
Copy link
Member

@grzezlo would there be any chance you could update your branch to get the latest master merged in? i know its been a long time but i'm hoping you'd still be interested in merging this

@grzezlo
Copy link
Contributor Author

grzezlo commented Mar 31, 2023

No problem, @kevinkreiser, merged.

@nilsnolde
Copy link
Member

nilsnolde commented Dec 2, 2023

I'm just looking at this again after a long time. Sorry for the wait @grzezlo I could fully understand if you moved on by now. I'd still be super interested to merge this and I know @kevinkreiser as well. So I'd help out on this if you'd prefer that.

One thing I'm wondering: how about including the OSM tag tactile_paving? It's used quite well it seems, > 3 Mio nodes & ways and could be used to prefer edges when blind_user_mode = true. Could also be done in a separate PR. Maybe that'd even be better. I'll spend some more time in the next weeks reviewing this work. Thanks again!

@@ -482,4 +482,5 @@ message Options {
uint32 matrix_locations = 54; // a one to many or many to one time distance matrix. Does not affect
} // sources_to_targets when either sources or targets has more than 1 location
// or when CostMatrix is the selected matrix mode.
bool blind_user_mode = 81; // route: additional maneuvers and informations for blind users.
Copy link
Member

@nilsnolde nilsnolde Dec 3, 2023

Choose a reason for hiding this comment

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

I was just looking at "vehicle types" and realized we already have smth you want in our request parameters, however, not documented. In PBF we have transport_type which is being set by either bicycle_type request param or type for all other modes, also pedestrian (not documented). Maybe we should use that instead of this boolean? Then we can make it a TravelType which will make more sense once we get to implement tactile_paving in costing. Let me know if you need some code pointers. What do you think @grzezlo ?

@grzezlo
Copy link
Contributor Author

grzezlo commented Dec 21, 2023

Thanks @nilsnolde for your comments and first of all for interest in the subject. Sorry for my late answer. In fact I moved to other projects, but Valhalla is still interesting for me and used as a routing engine in our app.
Regarding your idea: my implementation of the blindUserMode focused primarily on the narrative directions extension, as a next stage I thought about extending it to suggest some route planning optimisations, but I didn't manage it in given time.
But your idea opens exciting possibilities.
Preferring tactile pawing is one of them, other would be to prefer intersections with "traffic_signals:sound" or "traffic_signals:vibration" tags.
In some cases Valhalla plans route straight via the intersection, not giving precisely the crossings, although they are drawn on map: some workaround was to make our own customizations of "walkway_factor" and "sidewalk_factor" in query, but it affected some other cases which became non-optimal.
I thought about forcing the engine in blind user mode to always route via crossings on intersections if they're drawn, but didn't have enough understanding of the internal route planning mechanism to achieve it.

@nilsnolde
Copy link
Member

Thanks for your good thoughts here @grzezlo ! It's again a while gone that I said I'll look into it more. It's far down the PR list by now, I guess it's not as much hitting my attention, I'll try to change that, I really want this functionality.

Is it ok for you if I commit to your branch instead of reviewing? I mean both in the end of course, but maybe that'd be more efficient?

@kevinkreiser
Copy link
Member

i felt the same way about this but again didnt find anyy time. unless @grzezlo has time to also work on it, i would suggest you make a new branch from master and then merge @grzezlo's branch into that. that way you can let his branch unchanged and have all your work in a place you can more easily commit to

@grzezlo
Copy link
Contributor Author

grzezlo commented Dec 21, 2023

@nilsnolde modyfying this branch is ok for me, in such scenario all work on it will be in one place.

@chrstnbwnkl
Copy link
Contributor

chrstnbwnkl commented Jan 23, 2024

I have picked this up again, and apart from resolving merge conflicts, I did two things:

  • move the request option from /blind_user_mode to /costing_options/type, making use of an existing parameter
  • add some gurka tests

Having it as a costing option while not actually impacting the costing at all is a bit misleading maybe, but @nilsnolde pointed out that also modifying the costing could be a good addition to this in the future.

EDIT: had to fix some tests, astar_bikeshare was a particularly ugly one 😄 since no admins are built for the paris_bss_tiles, driving_side_right() was set to false by default, leading to higher stop impacts at right turns (assuming left side driving). Since this PR introduces parsing of crossing=traffic_signals tags, there are some edges which now have traffic_signal=true, which led to higher stop impacts at unexpected turns.

I assume the best way to go about this is to simply acknowledge missing admins for this test and all the weird behavior that comes with it for now.

Some matrix and isochrone tests were also affected by the added traffic signal tag, I adapted them to match the new results.

For reference, the failing isochrone test in the Utrecht tiles (blue = old result, yellow = new result, green points: nodes tagged with crossing=traffic_signals ). As expected, the contours are a bit smaller due to the increased stop impact.

Update: reversed parsing of nodes tagged crossing=traffic_signals, see comment below

a map displaying different isochrone LineString outputs from Valhalla

: options_(options), trip_path_(etp),
blind_mode_(options.costing_type() == Costing_Type_pedestrian &&
options.costings().find(Costing::pedestrian)->second.options().transport_type() ==
"blind") {
Copy link
Member

Choose a reason for hiding this comment

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

ok so to look a bit more like the other types we should:

over in pedestriancost.cc we parse out kFook and kWheelchair, we should add kBlind
then in triplegbuilder we call on a trip edge set_pedestrian_type which stores this type on the edges of the path so we'll need to update the proto with that blind value as well (trip edge is a proto struct)

Copy link
Member

Choose a reason for hiding this comment

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

should also add std::to_lower in costing for parsing to be a little more lenient

} else if (tag.first == "highway") {
n.set_traffic_signal(tag.second == "traffic_signals");
n.set_traffic_signal(n.traffic_signal() || tag.second == "traffic_signals");
Copy link
Member

Choose a reason for hiding this comment

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

this has the potential to make the alogrithm think that we have to stop multiple times in a row in quick succession when a car traffic light and a cross walk light are next to each other. we might want to move pedestrian crossing to be a new node type or use the spare bit on node

@@ -278,7 +281,33 @@ std::list<Maneuver> ManeuversBuilder::Produce() {
std::string(" | left_similar_traversable_outbound =") +
std::to_string(xedge_counts.left_similar_traversable_outbound));
#endif

if (blind_mode_)
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we add more braces here, i know i never ask for that but in this case wrap the switch

@@ -134,6 +144,7 @@ constexpr auto kCrossStreetNamesTag = "<CROSS_STREET_NAMES>";
constexpr auto kRoundaboutExitStreetNamesTag = "<ROUNDABOUT_EXIT_STREET_NAMES>";
constexpr auto kRoundaboutExitBeginStreetNamesTag = "<ROUNDABOUT_EXIT_BEGIN_STREET_NAMES>";
constexpr auto kRampExitNumbersVisualTag = "<EXIT_NUMBERS>";
constexpr auto kObjectLabelTag = "<object_label>";
Copy link
Contributor

Choose a reason for hiding this comment

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

upper case

@chrstnbwnkl
Copy link
Contributor

After some review rounds now, the only big question remaining is how to enable announcements for passing pedestrian traffic signals without messing with stop_impact on DirectedEdge and without compromising backwards compatibility (as @gknisely pointed out, adding a new NodeType on TripLeg would lead to a runtime error).

@kevinkreiser
Copy link
Member

is there anything left to do here? from my point of view we covered most of it and since we reverted the graphparser change we can merge now and come back to the whole crosswalk (traffic_signals) thing as a separate issue

@chrstnbwnkl
Copy link
Contributor

From my side this is all set. In the last CI run, the tests I added failed only in the build release (and I wasn't able to reproduce it locally). Just merged master, so let's see if this was a hick up of some sort

@chrstnbwnkl
Copy link
Contributor

Okay, seems like I have to have another look at those tests

Copy link
Member

@kevinkreiser kevinkreiser left a comment

Choose a reason for hiding this comment

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

thank you so much @grzezlo for startign this and @chrstnbwnkl for bringing it over the line!

@kevinkreiser kevinkreiser merged commit e7a5c16 into valhalla:master Feb 14, 2024
7 checks passed
@grzezlo grzezlo deleted the BlindUserMode branch February 15, 2024 09:48
@mkandulavm
Copy link

mkandulavm commented Feb 17, 2024

Hi

I am getting this exception when making a route call
Caught an exception: No such node (instructions.pass)

Any possibility above merged code requires changes for graph tile generation ?
I ask as the "instructions.pass" line in narrative_dictionary.h was recently committed and previously where I was getting a route response is now failing with exception after pulling latest from master :(

@nilsnolde
Copy link
Member

from what I can see that key is in all 29 published locales, so your problem seems to be that you're again not really on master. updating locales for odin is done during building the library, which will write them from locales/*.json to a public header in ${CMAKE_BINARY_DIR}/odin/locales.h.

and as a general rule, unless we bump the major version, we never require new tile builds for any new commits..

@nilsnolde
Copy link
Member

are you sure you're really re-compiling valhalla when you pull (vs just installing new headers..)?

@mkandulavm
Copy link

mkandulavm commented Feb 17, 2024

@nilsnolde thank you for the comment. I have a custom locale which is missing the "pass". I am not aware of this to be added and I now understand the meaning of the exception.
Thanks again ! My issue got fixed.

@nilsnolde
Copy link
Member

Well we don’t expect people to bring their own locales tbh. I’d recommend to consider adding it to transifex. If it’s > 95% translated we’ll add it to the repo and this sort of thing can’t happen.

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.

Blind users costing model
5 participants