first cut at porting travel mode, some tests fail
This commit is contained in:
+13
-1
@@ -94,7 +94,13 @@ u_turn_penalty = 20
|
||||
use_turn_restrictions = false
|
||||
turn_penalty = 60
|
||||
turn_bias = 1.4
|
||||
-- End of globals
|
||||
|
||||
|
||||
--modes
|
||||
mode_normal = 1
|
||||
mode_pushing = 2
|
||||
mode_ferry = 3
|
||||
mode_train = 4
|
||||
|
||||
|
||||
local function parse_maxspeed(source)
|
||||
@@ -229,6 +235,7 @@ function way_function (way)
|
||||
-- public_transport platforms (new tagging platform)
|
||||
way.speed = platform_speeds[public_transport]
|
||||
elseif railway and railway_speeds[railway] then
|
||||
way.mode = mode_train
|
||||
-- railways
|
||||
if access and access_tag_whitelist[access] then
|
||||
way.speed = railway_speeds[railway]
|
||||
@@ -251,11 +258,14 @@ function way_function (way)
|
||||
if pedestrian_speeds[highway] then
|
||||
-- pedestrian-only ways and areas
|
||||
way.speed = pedestrian_speeds[highway]
|
||||
way.mode = mode_pushing
|
||||
elseif man_made and man_made_speeds[man_made] then
|
||||
-- man made structures
|
||||
way.speed = man_made_speeds[man_made]
|
||||
way.mode = mode_pushing
|
||||
elseif foot == 'yes' then
|
||||
way.speed = walking_speed
|
||||
way.mode = mode_pushing
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -308,9 +318,11 @@ function way_function (way)
|
||||
if junction ~= "roundabout" then
|
||||
if way.direction == Way.oneway then
|
||||
way.backward_speed = walking_speed
|
||||
way.mode = mode_pushing
|
||||
elseif way.direction == Way.opposite then
|
||||
way.backward_speed = walking_speed
|
||||
way.speed = way.speed
|
||||
way.mode = mode_pushing
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
-- Secondary road: 18km/h = 18000m/3600s = 100m/20s
|
||||
-- Tertiary road: 12km/h = 12000m/3600s = 100m/30s
|
||||
|
||||
-- modes:
|
||||
-- 1: normal
|
||||
-- 2: route
|
||||
-- 3: river downstream
|
||||
-- 4: river upstream
|
||||
-- 5: steps down
|
||||
-- 6: steps up
|
||||
|
||||
speed_profile = {
|
||||
["primary"] = 36,
|
||||
["secondary"] = 18,
|
||||
@@ -61,12 +69,16 @@ function way_function (way)
|
||||
|
||||
if route ~= nil and durationIsValid(duration) then
|
||||
way.duration = math.max( 1, parseDuration(duration) )
|
||||
way.mode = 2
|
||||
way.backward_mode = 2
|
||||
else
|
||||
local speed_forw = speed_profile[highway] or speed_profile['default']
|
||||
local speed_back = speed_forw
|
||||
|
||||
if highway == "river" then
|
||||
local temp_speed = speed_forw;
|
||||
way.mode = 3
|
||||
way.backward_mode = 4
|
||||
speed_forw = temp_speed*1.5
|
||||
speed_back = temp_speed/1.5
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user