Project-OSRM / osrm-backend

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

Changing speed limits in OSRM Profile (to incorporate new profiles) are not working #6507

Closed usamahafeezbutt closed 1 year ago

usamahafeezbutt commented 1 year ago

I'm trying to create some new profiles using the existing car.lua and bicycle.lua. I'm majorly concerned about excluding motorways from route and limiting the speed as per vehicle. The vehicles I'm trying to incorporate are paxster (max speed 60 Kmh), kyburz (max speed 40 Kmh) these are used for distribution purposes. I have changed the speed as below:

properties = { max_speed_for_map_matching = 60/3.6, -- 180kmph -> 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 = 20, continue_straight_at_waypoint = true, use_turn_restrictions = true, left_hand_driving = false, traffic_light_penalty = 2, },

speeds = Sequence { highway = { --motorway = 90, --motorway_link = 45, trunk = 60, trunk_link = 40, primary = 60, primary_link = 30, secondary = 55, secondary_link = 25, tertiary = 18, tertiary_link = 12, unclassified = 25, residential = 25, living_street = 10, service = 15 } }, 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    =  60,
  bad             =  40,
  very_bad        =  20,
  horrible        =  10,
  very_horrible   =  5,
  impassable      =  0
},

-- http://wiki.openstreetmap.org/wiki/Speed_limits
maxspeed_table_default = {
  urban = 50,
  rural = 60,
  trunk = 60,
  --motorway = 130
},

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

that worked for me with just assigning the limits to

asphalt = nil, -- nil mean no limit. removing the line has the same effect concrete = nil, ["concrete:plates"] = nil, ["concrete:lanes"] = nil, paved = nil,

these nil values to the speed we needed for our particular vehicles.