@@ -115,7 +115,7 @@ add_custom_target(generate_zenoh_bridge_configs ALL
115115 COMMAND ros2 run nexus_network_configuration nexus_network_configuration -n ${nexus_network_cfg_path} -o ${zenoh_cfg_output_dir}
116116)
117117
118- install (DIRECTORY launch config rviz scripts DESTINATION share/${PROJECT_NAME} )
118+ install (DIRECTORY launch config rviz scripts maps/ DESTINATION share/${PROJECT_NAME} )
119119# Install the zenoh config directory containing generated configs.
120120message ("zenoh_cfg_output_dir: " ${zenoh_cfg_output_dir} )
121121install (DIRECTORY ${zenoh_cfg_output_dir} DESTINATION share/${PROJECT_NAME} /config/)
@@ -176,4 +176,79 @@ if(BUILD_TESTING)
176176 endif ()
177177endif ()
178178
179+ # Taken from rmf_demos_maps
180+ file (GLOB_RECURSE traffic_editor_paths "maps/*.building.yaml" )
181+
182+ foreach (path ${traffic_editor_paths} )
183+
184+ # Get the output world name
185+ string (REGEX REPLACE "\\ .[^.]*\. [^.]*$" "" no_extension_path ${path} )
186+ string (REGEX MATCH "[^\/ ]+$" world_name ${no_extension_path} )
187+
188+ set (map_path ${path} )
189+ set (output_world_name ${world_name} )
190+ set (output_dir ${CMAKE_CURRENT_BINARY_DIR} /maps/${output_world_name} )
191+ set (output_world_path ${output_dir} /${output_world_name} .world)
192+ set (output_model_dir ${output_dir} /models)
193+
194+ ##############################################################################
195+ # Generate Gz world and download Models
196+ ##############################################################################
197+
198+ message ("BUILDING WORLDFILE WITH COMMAND: ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir} " )
199+ if (NO_DOWNLOAD_MODELS)
200+ add_custom_command (
201+ DEPENDS ${map_path}
202+ COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir}
203+ OUTPUT ${output_world_path}
204+ )
205+ else ()
206+ message ("DOWNLOADING MODELS WITH COMMAND: ros2 run rmf_building_map_tools building_map_model_downloader ${map_path} " )
207+ add_custom_command (
208+ DEPENDS ${map_path}
209+ COMMAND ros2 run rmf_building_map_tools building_map_generator gazebo ${map_path} ${output_world_path} ${output_model_dir}
210+ COMMAND ros2 run rmf_building_map_tools building_map_model_downloader ${map_path} -e ~/.gazebo/models
211+ OUTPUT ${output_world_path}
212+ )
213+ endif ()
214+
215+ ##############################################################################
216+ # generate the navmesh and required files for crowd simulation for gz
217+ ##############################################################################
218+ set (crowd_sim_config_resource ${output_dir} /config_resource/)
219+
220+ add_custom_command (
221+ OUTPUT ${world_name} _crowdsim
222+ COMMAND ros2 run rmf_building_map_tools building_crowdsim ${map_path} ${crowd_sim_config_resource} ${output_world_path}
223+ DEPENDS ${output_world_path}
224+ )
225+
226+ # This will initiate both custom commands: ${output_world_path} and ${world_name}_crowdsim
227+ add_custom_target (generate_${world_name}_crowdsim ALL
228+ DEPENDS ${world_name} _crowdsim
229+ )
230+
231+ ##############################################################################
232+ # Generate the nav graphs
233+ ##############################################################################
234+
235+ set (output_nav_graphs_dir ${output_dir} /nav_graphs/)
236+ set (output_nav_graphs_phony ${output_nav_graphs_dir} /phony)
237+ add_custom_command (
238+ OUTPUT ${output_nav_graphs_phony}
239+ COMMAND ros2 run rmf_building_map_tools building_map_generator nav ${map_path} ${output_nav_graphs_dir}
240+ DEPENDS ${map_path}
241+ )
242+
243+ add_custom_target (generate_${output_world_name}_nav_graphs ALL
244+ DEPENDS ${output_nav_graphs_phony}
245+ )
246+
247+ install (
248+ DIRECTORY ${output_dir}
249+ DESTINATION share/${PROJECT_NAME} /maps
250+ )
251+
252+ endforeach ()
253+
179254ament_package ()
0 commit comments