compute turn penalties in lua profiles
This commit is contained in:
@@ -73,6 +73,8 @@ ignore_areas = true -- future feature
|
||||
traffic_signal_penalty = 5
|
||||
u_turn_penalty = 20
|
||||
use_turn_restrictions = false
|
||||
turn_penalty = 60
|
||||
turn_bias = 1.4
|
||||
-- End of globals
|
||||
|
||||
function get_exceptions(vector)
|
||||
@@ -308,3 +310,13 @@ function way_function (way)
|
||||
way.type = 1
|
||||
return 1
|
||||
end
|
||||
|
||||
function turn_function (angle)
|
||||
-- compute turn penalty as angle^2, with a left/right bias
|
||||
k = turn_penalty/(90.0*90.0)
|
||||
if angle>=0 then
|
||||
return angle*angle*k/turn_bias
|
||||
else
|
||||
return angle*angle*k*turn_bias
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Testbot, with turn penalty
|
||||
-- Used for testing turn penalties
|
||||
|
||||
require 'testbot'
|
||||
|
||||
function turn_function (angle)
|
||||
return 200*math.abs(angle)/180 -- penalty
|
||||
end
|
||||
Reference in New Issue
Block a user