-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Pass additional variables to turn_function #2822
Conversation
Few notes here:
|
@TheMarex AFAIK, Lua has no concept of function overloading, so the following works:
The additional arguments passed by |
// segment_length is in metres, weight is in deciseconds, this converts those | ||
// to km/h | ||
const double approach_speed = approach_segment_length / (approach_road_segments.back().weight/10) * 3.6; // km/h | ||
const double exit_speed = exit_segment_length / (exit_road_segments.front().weight/10) * 3.6; // km/h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format-3.8 all the things
I think turn penalties for bikes could be improved quite a bit. however i think the type of road your turning from/to might be more important that the approach/exit speeds. The typical example is that turning left form a big road into a small road at a intersection without traffic lights should incur a much more significant penalty that turning left from a small road into a small road, since you often will have to wait for a gap in car traffic before you can turn. Similarly, the penalty for doing a u-turn depends more on the type of road that the speed of the bike traffic, since doing a u-turn typically implies crossing the road. This is why is suggested in #592 that the way type are passed to the penalty function. An alternative is to only depend a real-world measurements, but of course that requires sufficient data. Turn penalties for bikes could perhaps be improved a bit by using approach/exit speeds, but I don't think it's worth it. |
Some further discussion on this one has happened in other forums. Some points that were raised:
|
I've pulled this into #2912. Closing here in favour of a structure based approach (instead of passing single parameters to the function). |
This PR is to address #1735, and hopefully make turn penalties better by considering the approach/exit speeds for each turn. As pointed out on #1735, doing a u-turn on a 70mph (112km/h) road should be super expensive. On the car profile, currently we only penalize this turn by 3.3 seconds, and most 60km/h 90 degree turns are penalized by ~0.8 to ~1.2 (left vs right, depending on the bias).
This turn penalty calculation only occurs during
osrm-extract
, this PR will not include a mechanism to adjust the turn penalty if traffic data updates are used inosrm-contract
.My plan is to update the
turn_function
for thecar.lua
profile only. Other profiles are probably a bit less affected by this, although @emiltin, any thoughts you have on how this might apply to the bike turn penalty would be appreciated.Tasklist
References
http://nacto.org/docs/usdg/effect_of_radius_of_curvature_for_right_turning_vehicles_wolfe.pdf
http://onlinepubs.trb.org/onlinepubs/conferences/2011/RSS/3/Wolfermann,A.pdf
http://www.istiee.org/te/papers/N55/ET_2013_55_1_Mehar.pdf
Other useful factors
#592