Skip to content

Commit

Permalink
add length threshold for sidewalk generation
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchenplus committed Oct 5, 2024
1 parent 2cbeead commit fd1cae1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion mosstool/map/_map_util/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"BUS": 100,
"SUBWAY": 180,
}
MIN_HAS_WALK_LANE_LENGTH = 5
LARGE_LANE_NUM_THRESHOLD = 4
SMALL_LANE_NUM_THRESHOLD = 2
DEFAULT_TURN_NUM = {
Expand Down
6 changes: 5 additions & 1 deletion mosstool/map/builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
traffic_light_min_direction_group: int = 3,
default_lane_width: float = 3.2,
gen_sidewalk_speed_limit: float = 0,
gen_sidewalk_length_limit: float = 5.0,
expand_roads: bool = False,
road_expand_mode: Union[Literal["L"], Literal["M"], Literal["R"]] = "R",
aoi_mode: Union[Literal["append"], Literal["overwrite"]] = "overwrite",
Expand Down Expand Up @@ -85,6 +86,7 @@ def __init__(
- traffic_light_min_direction_group (int): minimum number of lane directions for traffic-light generation
- default_lane_width (float): default lane width
- gen_sidewalk_speed_limit (float): speed limit to generate sidewalk
- gen_sidewalk_speed_limit (float): length limit to generate sidewalk
- expand_roads (bool): expand roads according to junction type
- road_expand_mode (str): road expand mode
- aoi_mode (str): aoi appending mode. `append` takes effect when the input `net` is Map, incrementally adding the input AOIs; `overwrite` only adds the input AOIs, ignoring existing ones.
Expand All @@ -104,6 +106,7 @@ def __init__(
self.public_transport = public_transport
self.default_lane_width = default_lane_width
self.gen_sidewalk_speed_limit = gen_sidewalk_speed_limit
self.gen_sidewalk_length_limit = gen_sidewalk_length_limit
self.expand_roads = expand_roads
self.road_expand_mode = road_expand_mode
self.aoi_mode = aoi_mode
Expand Down Expand Up @@ -1170,7 +1173,8 @@ def filter_way_ids(wids):
self.map_roads[wid]["highway"] in HAS_WALK_LANES_HIGHWAY
or self.map_roads[wid]["max_speed"] <= self.gen_sidewalk_speed_limit
)
and self.map_roads[wid]["lanes"][0].length >= MIN_HAS_WALK_LANE_LENGTH
and self.map_roads[wid]["lanes"][0].length
>= self.gen_sidewalk_length_limit
]

def get_lane(wid):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mosstool"
version = "1.0.5"
version = "1.0.6"
description = "MObility Simulation System toolbox "
authors = ["Jun Zhang <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit fd1cae1

Please sign in to comment.