set backward speed properly, partially fixes #936
This commit is contained in:
parent
7b14de13ec
commit
85a007d87b
@ -16,7 +16,7 @@ Feature: Car - Max speed restrictions
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | time |
|
| from | to | route | time |
|
||||||
| a | b | ab | 42s ~10% |
|
| a | b | ab | 64s ~10% |
|
||||||
| b | c | bc | 545s ~10% |
|
| b | c | bc | 545s ~10% |
|
||||||
|
|
||||||
Scenario: Car - Do not ignore maxspeed when higher than way speed
|
Scenario: Car - Do not ignore maxspeed when higher than way speed
|
||||||
@ -30,26 +30,25 @@ Feature: Car - Max speed restrictions
|
|||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | time |
|
| from | to | route | time |
|
||||||
| a | b | ab | 144s ~10% |
|
| a | b | ab | 216s ~10% |
|
||||||
| b | c | bc | 64s ~10% |
|
| b | c | bc | 64s ~10% |
|
||||||
|
|
||||||
Scenario: Car - Forward/backward maxspeed
|
Scenario: Car - Forward/backward maxspeed
|
||||||
Given the shortcuts
|
Given the shortcuts
|
||||||
| key | value |
|
| key | value |
|
||||||
| car-1 | 11s ~10% |
|
| car | 17s ~10% |
|
||||||
| car | 18s ~10% |
|
| run | 109s ~10% |
|
||||||
| run | 110s ~10% |
|
| walk | 219s ~10% |
|
||||||
| walk | 220s ~10% |
|
|
||||||
| snail | 1080s ~10% |
|
| snail | 1080s ~10% |
|
||||||
|
|
||||||
And a grid size of 100 meters
|
And a grid size of 100 meters
|
||||||
|
|
||||||
Then routability should be
|
Then routability should be
|
||||||
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
|
| maxspeed | maxspeed:forward | maxspeed:backward | forw | backw |
|
||||||
| | | | car-1 | car-1 |
|
| | | | car | car |
|
||||||
| 10 | | | run | run |
|
| 10 | | | run | run |
|
||||||
| | 10 | | run | car-1 |
|
| | 10 | | run | car |
|
||||||
| | | 10 | car-1 | run |
|
| | | 10 | car | run |
|
||||||
| 1 | 10 | | run | snail |
|
| 1 | 10 | | run | snail |
|
||||||
| 1 | | 10 | snail | run |
|
| 1 | | 10 | snail | run |
|
||||||
| 1 | 5 | 10 | walk | run |
|
| 1 | 5 | 10 | walk | run |
|
||||||
|
@ -72,7 +72,7 @@ local function parse_maxspeed(source)
|
|||||||
if string.match(source, "mph") or string.match(source, "mp/h") then
|
if string.match(source, "mph") or string.match(source, "mp/h") then
|
||||||
n = (n*1609)/1000;
|
n = (n*1609)/1000;
|
||||||
end
|
end
|
||||||
return abs(n*0.66)
|
return n
|
||||||
end
|
end
|
||||||
|
|
||||||
function node_function (node)
|
function node_function (node)
|
||||||
@ -251,6 +251,10 @@ function way_function (way)
|
|||||||
way.ignore_in_grid = true
|
way.ignore_in_grid = true
|
||||||
end
|
end
|
||||||
way.type = 1
|
way.type = 1
|
||||||
|
way.speed = abs(way.speed*0.66) -- scaling of travel times.
|
||||||
|
if(way.backward_speed > 0) then
|
||||||
|
way.backward_speed = abs(way.backward_speed*0.66) -- scaling of travel times.
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user