-
Notifications
You must be signed in to change notification settings - Fork 97
/
CMakeLists.txt
86 lines (68 loc) · 3.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.5)
project(rmf_demos_maps)
find_package(ament_cmake REQUIRED)
install(DIRECTORY
maps/
DESTINATION share/${PROJECT_NAME}
)
ament_package()
file(GLOB_RECURSE traffic_editor_paths "maps/*.building.yaml")
foreach(path ${traffic_editor_paths})
# Get the output world name
string(REGEX REPLACE "\\.[^.]*\.[^.]*$" "" no_extension_path ${path})
string(REGEX MATCH "[^\/]+$" world_name ${no_extension_path})
set(map_path ${path})
set(output_world_name ${world_name})
set(output_dir ${CMAKE_CURRENT_BINARY_DIR}/maps/${output_world_name})
set(output_world_path ${output_dir}/${output_world_name}.world)
set(output_model_dir ${output_dir}/models)
##############################################################################
# Generate Gz world and download Models
##############################################################################
message("BUILDING WORLDFILE WITH COMMAND: ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir}")
if (NO_DOWNLOAD_MODELS)
add_custom_command(
DEPENDS ${map_path}
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir}
OUTPUT ${output_world_path}
)
else()
message("DOWNLOADING MODELS WITH COMMAND: ros2 run rmf_building_map_tools building_map_model_downloader ${map_path}")
add_custom_command(
DEPENDS ${map_path}
COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir}
COMMAND ros2 run rmf_building_map_tools building_map_model_downloader ${map_path} -e ~/.gazebo/models
OUTPUT ${output_world_path}
)
endif()
##############################################################################
# generate the navmesh and required files for crowd simulation for gz
##############################################################################
set(crowd_sim_config_resource ${output_dir}/config_resource/)
add_custom_command(
OUTPUT ${world_name}_crowdsim
COMMAND ros2 run rmf_building_map_tools building_crowdsim ${map_path} ${crowd_sim_config_resource} ${output_world_path}
DEPENDS ${output_world_path}
)
# This will initiate both custom commands: ${output_world_path} and ${world_name}_crowdsim
add_custom_target(generate_${world_name}_crowdsim ALL
DEPENDS ${world_name}_crowdsim
)
##############################################################################
# Generate the nav graphs
##############################################################################
set(output_nav_graphs_dir ${output_dir}/nav_graphs/)
set(output_nav_graphs_phony ${output_nav_graphs_dir}/phony)
add_custom_command(
OUTPUT ${output_nav_graphs_phony}
COMMAND ros2 run rmf_building_map_tools building_map_generator nav ${map_path} ${output_nav_graphs_dir}
DEPENDS ${map_path}
)
add_custom_target(generate_${output_world_name}_nav_graphs ALL
DEPENDS ${output_nav_graphs_phony}
)
install(
DIRECTORY ${output_dir}
DESTINATION share/${PROJECT_NAME}/maps
)
endforeach()