Skip to content

Commit

Permalink
Merge branch 'main' into emartinena/ci_fix
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
  • Loading branch information
luca-della-vedova committed Mar 26, 2024
2 parents 71640a7 + f353f15 commit 5e6cfcd
Show file tree
Hide file tree
Showing 20 changed files with 411 additions and 262 deletions.

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions rmf_building_map_tools/building_map/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ def generate_nav_graphs(self):
g = {}
g['building_name'] = self.name
g['levels'] = {}
g['lifts'] = {}
g['doors'] = {}

if self.coordinate_system == CoordinateSystem.web_mercator:
g['crs_name'] = self.global_transform.crs_name
Expand All @@ -372,6 +374,22 @@ def generate_nav_graphs(self):
g['levels'][level_name] = level_graph
if level_graph['lanes']:
empty = False

for door_edge in level.doors:
door_edge.calc_statistics(level.transformed_vertices)
g['doors'][door_edge.params['name'].value] = {
'endpoints': [
[door_edge.x1, door_edge.y1],
[door_edge.x2, door_edge.y2]
],
'map': level_name
}

for lift_name, lift in self.lifts.items():
g['lifts'][lift_name] = {
'position': [lift.x, lift.y, lift.yaw],
'dims': [lift.width, lift.depth]
}
if not empty:
nav_graphs[f'{i}'] = g
return nav_graphs
Expand Down
2 changes: 1 addition & 1 deletion rmf_building_map_tools/building_map/floor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def triangulate_polygon(self, polygon, triangles):
# to be clipped to lie within the original floor polygon
# for example, if a long triangle crossed a concave region
# and you end up with >=1 polygons and >=1 points or edges.
for item in geom:
for item in geom.geoms:
if item.geom_type == 'Polygon':
self.triangulate_polygon(item, triangles)

Expand Down
11 changes: 8 additions & 3 deletions rmf_building_map_tools/building_map/level.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ def add_edge_from_coords(self, edge_type, p1, p2, props):
ParamValue.DOUBLE,
props.get('speed_limit', 0.0)
])
edge.params['mutex'] = ParamValue([
ParamValue.STRING,
props.get('mutex', "")
])
self.lanes.append(edge)
else:
raise ValueError('unknown edge type!')
Expand Down Expand Up @@ -486,6 +490,10 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True):
l.params['speed_limit'].value > 0.0:
p['speed_limit'] = l.params['speed_limit'].value

if 'mutex' in l.params and \
l.params['mutex'].value:
p['mutex'] = l.params['mutex'].value

if 'demo_mock_floor_name' in l.params and \
l.params['demo_mock_floor_name'].value:
p['demo_mock_floor_name'] = \
Expand All @@ -503,9 +511,6 @@ def generate_nav_graph(self, graph_idx, always_unidirectional=True):
if 'dock_name' in v1.params: # lane segment begins at dock
beginning_dock = v1.params['dock_name'].value

if 'speed_limit' in l.params:
p['speed_limit'] = l.params['speed_limit'].value

if always_unidirectional and l.is_bidirectional():
# now flip things around and make the second link
forward_params = copy.deepcopy(p)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def __call__(self, parser, namespace, values, option_string=None):
parser.add_argument("-c", "--cache", type=str,
default="~/.pit_crew/model_cache.json",
help="Path to pit_crew model cache")
parser.add_argument("-f", "--fuel-tools", action=HTTPDownloadDeprecated,
parser.add_argument("-f", "--fuel-tools", action='store_true',
help="Use ignition fuel tools to download models instead "
"of http", nargs=0)
"of http")
parser.add_argument("-i", "--include", type=str, default=None,
help="Search this directory first for models.")
parser.add_argument("-e", "--export-path", type=str, default=None,
Expand Down Expand Up @@ -92,6 +92,7 @@ def download_models(
input_yaml,
cache=None,
include=None,
fuel_tools=True,
export_path=None):
"""Download models for a given input building yaml."""
# Construct model set
Expand Down Expand Up @@ -119,15 +120,25 @@ def download_models(
else:
model_set.add(model.model_name)

missing_models = pit_crew.get_missing_models(
model_set,
model_path=IGN_FUEL_MODEL_PATH,
cache_file_path=cache,
lower=True,
priority_dir=include,
ign=True,
use_dir_as_name=True
)
if fuel_tools:
missing_models = pit_crew.get_missing_models(
model_set,
model_path=IGN_FUEL_MODEL_PATH,
cache_file_path=cache,
lower=True,
priority_dir=include,
ign=True,
use_dir_as_name=True
)
else:
missing_models = pit_crew.get_missing_models(
model_set,
cache_file_path=cache,
lower=False,
priority_dir=include,
ign=False,
use_dir_as_name=True
)

logger.info("\n== REQUESTED MODEL REPORT ==")
pprint(missing_models)
Expand Down Expand Up @@ -158,9 +169,14 @@ def download_models(

model_downloaded = False
for i in range(5):
model_downloaded = pit_crew.download_model_fuel_tools(
model_name, author_name,
sync_names=True, export_path=export_path)
model_downloaded = False
if fuel_tools:
model_downloaded = pit_crew.download_model_fuel_tools(
model_name, author_name,
sync_names=True, export_path=export_path)
else:
model_downloaded = pit_crew.download_model(
model_name, author_name, sync_names=True)
if model_downloaded:
break
else:
Expand Down Expand Up @@ -202,6 +218,7 @@ def main():
args.INPUT_YAML,
args.cache,
args.include,
args.fuel_tools,
args.export_path)


Expand Down
2 changes: 1 addition & 1 deletion rmf_building_map_tools/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rmf_building_map_tools</name>
<version>1.6.0</version>
<version>1.8.2</version>
<description>RMF Building map tools</description>
<maintainer email="[email protected]">Morgan Quigley</maintainer>
<maintainer email="[email protected]">Marco A. Gutiérrez</maintainer>
Expand Down
2 changes: 1 addition & 1 deletion rmf_building_map_tools/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name=package_name,
version='1.6.0',
version='1.8.1',
packages=[
'building_crowdsim',
'building_crowdsim.navmesh',
Expand Down
Loading

0 comments on commit 5e6cfcd

Please sign in to comment.