Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.31k stars 3.33k forks source link

My truck.lua dosn't affect the duration #5761

Closed MoodyJerup closed 2 months ago

MoodyJerup commented 4 years ago

Hello,

I'm currently working on supporting truck-profiles on my site, but I simple can't get a realistic output from my server when using for instance the truck-soft-profile from https://github.com/Project-OSRM/osrm-profiles-contrib/tree/master/5/21/truck-soft

In Denmark all the trucks have a max speed of 80 km/h on motorways, but it's like OSRM doesn't care and only pay attention to some of the turn-penalties and similar.

Can someone help me on how to set a max speed, so the routing-calculation never get over 50 km/h in cities, 80 on motorways and so on?

Below is my altered truck-soft profile: -- Truck profile

api_version = 4

Set = require('lib/set') Sequence = require('lib/sequence') Handlers = require("lib/way_handlers") Relations = require("lib/relations") find_access_tag = require("lib/access").find_access_tag limit = require("lib/maxspeed").limit Utils = require("lib/utils") Measure = require("lib/measure")

function setup() return { properties = { max_speed_for_map_matching = 80/3.6, -- 80kmph -> m/s -- For routing based on duration, but weighted for preferring certain roads weight_name = 'routability', -- For shortest duration without penalties for accessibility -- weight_name = 'duration', -- For shortest distance without penalties for accessibility -- weight_name = 'distance', process_call_tagless_node = false, u_turn_penalty = 30, continue_straight_at_waypoint = true, use_turn_restrictions = true, left_hand_driving = false, traffic_light_penalty = 2, },

default_mode              = mode.driving,
default_speed             = 10,
oneway_handling           = true,
side_road_multiplier      = 0.8,
turn_penalty              = 25,
speed_reduction           = 0.8,
turn_bias                 = 1.075,
cardinal_directions       = false,

-- Size of the vehicle, to be limited by physical restriction of the way
vehicle_height = 2.8, -- in meters
vehicle_width = 2.2, -- in meters

-- Size of the vehicle, to be limited mostly by legal restriction of the way
vehicle_length = 6.0, -- in meters, 4.8m is the length of large or familly car
vehicle_weight = 6000, -- in kilograms

-- a list of suffixes to suppress in name change instructions. The suffixes also include common substrings of each other
suffix_list = {
  'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'North', 'South', 'West', 'East', 'Nor', 'Sou', 'We', 'Ea'
},

barrier_whitelist = Set {
  'cattle_grid',
  'border_control',
  'toll_booth',
  'sally_port',
  'gate',
  'lift_gate',
  'no',
  'entrance',
  'height_restrictor'
},

access_tag_whitelist = Set {
  'yes',
  'motorcar',
  'motor_vehicle',
  'vehicle',
  'permissive',
  'designated',
  'hov'
},

access_tag_blacklist = Set {
  'no',
  'agricultural',
  'forestry',
  'emergency',
  'psv',
  'customers',
  'private',
  'delivery',
  'destination'
},

-- tags disallow access to in combination with highway=service
service_access_tag_blacklist = Set {
    'private'
},

restricted_access_tag_list = Set {
  'private',
  'delivery',
  'destination',
  'customers',
},

access_tags_hierarchy = Sequence {
  'motorcar',
  'motor_vehicle',
  'vehicle',
  'access'
},

service_tag_forbidden = Set {
  'emergency_access'
},

restrictions = Sequence {
  'motorcar',
  'motor_vehicle',
  'vehicle'
},

classes = Sequence {
    'toll', 'motorway', 'ferry', 'restricted', 'tunnel'
},

-- classes to support for exclude flags
excludable = Sequence {
    Set {'toll'},
    Set {'motorway'},
    Set {'ferry'}
},

avoid = Set {
  'area',
  -- 'toll',    -- uncomment this to avoid tolls
  'reversible',
  'impassable',
  'hov_lanes',
  'steps',
  'construction',
  'proposed'
},

speeds = Sequence {
  highway = {
    motorway        = 90,
    motorway_link   = 45,
    trunk           = 85,
    trunk_link      = 40,
    primary         = 65,
    primary_link    = 30,
    secondary       = 55,
    secondary_link  = 25,
    tertiary        = 40,
    tertiary_link   = 20,
    unclassified    = 25,
    residential     = 25,
    living_street   = 10,
    service         = 15
  }
},

highway_penalties = {
  motorway        = 1,
  motorway_link   = 1,
  trunk           = 1,
  trunk_link      = 1,
  primary         = 1,
  primary_link    = 1,
  secondary       = 1,
  secondary_link  = 1,
  tertiary        = 0.9,
  tertiary_link   = 0.9,
  unclassified    = 0.8,
  residential     = 0.7,
  living_street   = 0.3,
  service         = 0.2,
  track           = 0.1
},

service_penalties = {
  alley             = 0.5,
  parking           = 0.5,
  parking_aisle     = 0.5,
  driveway          = 0.5,
  ["drive-through"] = 0.5,
  ["drive-thru"] = 0.5
},

restricted_highway_whitelist = Set {
  'motorway',
  'motorway_link',
  'trunk',
  'trunk_link',
  'primary',
  'primary_link',
  'secondary',
  'secondary_link',
  'tertiary',
  'tertiary_link',
  'residential',
  'living_street',
  'unclassified',
  'service'
},

construction_whitelist = Set {
  'no',
  'widening',
  'minor',
},

route_speeds = {
  ferry = 5,
  shuttle_train = 10
},

bridge_speeds = {
  movable = 5
},

-- surface/trackype/smoothness
-- values were estimated from looking at the photos at the relevant wiki pages

-- max speed for surfaces
surface_speeds = {
  asphalt = nil,    -- nil mean no limit. removing the line has the same effect
  concrete = nil,
  ["concrete:plates"] = nil,
  ["concrete:lanes"] = nil,
  paved = nil,

  cement = 80,
  compacted = 80,
  fine_gravel = 80,

  paving_stones = 60,
  metal = 60,
  bricks = 60,

  grass = 40,
  wood = 40,
  sett = 40,
  grass_paver = 40,
  gravel = 40,
  unpaved = 40,
  ground = 40,
  dirt = 40,
  pebblestone = 40,
  tartan = 40,

  cobblestone = 30,
  clay = 30,

  earth = 20,
  stone = 20,
  rocky = 20,
  sand = 20,

  mud = 10
},

-- max speed for tracktypes
tracktype_speeds = {
  grade1 =  60,
  grade2 =  40,
  grade3 =  30,
  grade4 =  25,
  grade5 =  20
},

-- max speed for smoothnesses
smoothness_speeds = {
  intermediate    =  80,
  bad             =  40,
  very_bad        =  20,
  horrible        =  10,
  very_horrible   =  5,
  impassable      =  0
},

-- http://wiki.openstreetmap.org/wiki/Speed_limits
maxspeed_table_default = {
  urban = 40,
  rural = 70,
  trunk = 80,
  motorway = 90
},

-- List only exceptions
maxspeed_table = {
  ["at:rural"] = 100,
  ["at:trunk"] = 100,
  ["be:motorway"] = 120,
  ["be-vlg:rural"] = 70,
  ["by:urban"] = 60,
  ["by:motorway"] = 110,
  ["ch:rural"] = 80,
  ["ch:trunk"] = 100,
  ["ch:motorway"] = 120,
  ["cz:trunk"] = 0,
  ["cz:motorway"] = 0,
  ["de:living_street"] = 7,
  ["de:rural"] = 100,
  ["de:motorway"] = 0,
  ["dk:urban"] = 40,
  ["dk:rural"] = 70,
  ["dk:trunk"] = 80,
  ["dk:motorway"] = 90,                  
  ["fr:rural"] = 80,
  ["gb:nsl_single"] = (60*1609)/1000,
  ["gb:nsl_dual"] = (70*1609)/1000,
  ["gb:motorway"] = (70*1609)/1000,
  ["nl:rural"] = 80,
  ["nl:trunk"] = 100,
  ['no:rural'] = 80,
  ['no:motorway'] = 110,
  ['pl:rural'] = 100,
  ['pl:trunk'] = 120,
  ['pl:motorway'] = 140,
  ["ro:trunk"] = 100,
  ["ru:living_street"] = 20,
  ["ru:urban"] = 60,
  ["ru:motorway"] = 110,
  ["uk:nsl_single"] = (60*1609)/1000,
  ["uk:nsl_dual"] = (70*1609)/1000,
  ["uk:motorway"] = (70*1609)/1000,
  ['za:urban'] = 60,
  ['za:rural'] = 100,
  ["none"] = 140
},

relation_types = Sequence {
  "route"
},

-- classify highway tags when necessary for turn weights
highway_turn_classification = {
},

-- classify access tags when necessary for turn weights
access_turn_classification = {
}

} end

SiarheiFedartsou commented 2 months ago

Stale.