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

Document all options available to Lua profiles #3842

Merged
merged 5 commits into from
Mar 28, 2017
Merged

Document all options available to Lua profiles #3842

merged 5 commits into from
Mar 28, 2017

Conversation

systemed
Copy link
Member

@systemed systemed commented Mar 20, 2017

Recent improvements to OSRM have led to a lot of changes to the Lua scripting interface, and refactoring of the default profiles makes them slightly more abstract and difficult to grok for those writing profiles from scratch.

This is therefore an attempt to fully document the attributes that can be read and set from Lua profiles. I've done it from my own understanding and from reading the source, but I may well have missed things or mistaken them!

Recent improvements to OSRM have led to a lot of changes to the Lua scripting interface, and refactoring of the default profiles makes them slightly more abstract and difficult to grok for those writing profiles from scratch.

This is therefore an attempt to fully document the attributes that can be read and set from Lua profiles. I've done it from my own understanding and from reading the source, but I may well have missed things or mistaken them!
Copy link
Member

@daniel-j-h daniel-j-h 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!

docs/profiles.md Outdated
turn_lanes_backward | String | " "
forward_restricted | Boolean | Is this a restricted access road? (e.g. private, deliveries only)
backward_restricted | Boolean | " "
is_startpoint | Boolean | Can a journey start on this way?
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a note that it is used for snapping / to filter out what is in the rtree

docs/profiles.md Outdated
weight | Float | Alternative setter for weight of the whole way in both directions
turn_lanes_forward | String | Directions for individual lanes (normalised OSM turn:lanes value)
turn_lanes_backward | String | " "
forward_restricted | Boolean | Is this a restricted access road? (e.g. private, deliveries only)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a note re. what restricted actually means https://www.openstreetmap.org/user/happygo/diary/40564

docs/profiles.md Outdated
use_turn_restrictions | Boolean | Are turn instructions followed?
continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed?
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)

Copy link
Contributor

@oxidase oxidase Mar 20, 2017

Choose a reason for hiding this comment

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

@systemed please could you add here a new property introduced in #3840 ?
max_turn_weight | Float | Maximum turn penalty weight |

Copy link
Member

@TheMarex TheMarex 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 for taking a stab at this.:+1: Much appreciated.

docs/profiles.md Outdated

Attribute | Type | Notes
----------------------------------------|----------|--------------------------------------------------------------------------
forward_rate | Float | Routing weight on this way per metre
Copy link
Member

Choose a reason for hiding this comment

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

The unit for rate is actually weirder. Speed is meter per seconds, this is a fake speed quantity so the unit is meter per {weight}.

continue_straight_at_waypoint | Boolean | Must the route continue straight on at a via point, or are U-turns allowed?
max_speed_for_map_matching | Float | Maximum vehicle speed to be assumed in matching (in m/s)
max_turn_weight | Float | Maximum turn penalty weight

## way_function

Given an OpenStreetMap way, the way_function will either return nothing (meaning we are not going to route over this way at all), or it will set up a result hash to be returned. The most important thing it will do is set the value of `result.forward_speed` and `result.backward_speed` as a suitable integer value representing the speed for traversing the way.
Copy link
Contributor

Choose a reason for hiding this comment

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

it's just as important to set forward/backward mode

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, agreed. I've not looked at the narrative text (which I think was originally written by @harry-wood) in this PR; this is just to list out the parameters.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah. I remember at the time I noted the need for more detail on what the global variables mean, so this looks like a very useful improvement to the docs

Incidentally from a narrative point of view, it might read more flowingly if you insert this table two paragraphs earlier no? Well doesn't really matter.

docs/profiles.md Outdated
direction_modifier | Read | Enum | Geometry of turn. Defined in include/extractor/guidance/turn_instruction.hpp
turn_type | Read | Enum | Priority of turn. Defined in include/extractor/guidance/turn_instruction.hpp
has_traffic_light | Read | Boolean | Traffic light present at this turn
duration | Write | Float | Penalty to be applied for this turn (s)
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 there are a few properties missing here, most importantly the angle. Also it would be great to document the angle's range and what it represents.

https://github.com/systemed/osrm-backend/blob/eab9672ff6a264269016028d7c422e50a037c84f/src/extractor/scripting_environment_lua.cpp#L364-L380

@daniel-j-h daniel-j-h merged commit ed83d3e into Project-OSRM:master Mar 28, 2017
@systemed systemed deleted the patch-1 branch March 28, 2017 09:59
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.

6 participants