From d23b237fd31efa8e08cff810b71cb46a3c71daa4 Mon Sep 17 00:00:00 2001 From: frederik Date: Fri, 1 Dec 2023 17:39:10 +0100 Subject: [PATCH] removal of blacklist and CMake amends to loop over existing airframes only Signed-off-by: frederik --- .../simulation/gz_bridge/CMakeLists.txt | 38 +++---------------- .../gz_bridge/no_airframe_models.txt | 2 - 2 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 src/modules/simulation/gz_bridge/no_airframe_models.txt diff --git a/src/modules/simulation/gz_bridge/CMakeLists.txt b/src/modules/simulation/gz_bridge/CMakeLists.txt index f0bc632c4998..5ebcf94aa59e 100644 --- a/src/modules/simulation/gz_bridge/CMakeLists.txt +++ b/src/modules/simulation/gz_bridge/CMakeLists.txt @@ -111,56 +111,28 @@ if(gz-transport_FOUND) else() message(WARNING "model directory ${PX4_SOURCE_DIR}/Tools/simulation/gz/models/${model_only} not found") endif() - endforeach() - - foreach(model ${gz_models}) - - # match model to airframe - set(airframe_model_only) - set(airframe_sys_autostart) - set(gz_airframe_found) - foreach(gz_airframe IN LISTS gz_airframes) - - string(REGEX REPLACE ".*_gz_" "" airframe_model_only ${gz_airframe}) - string(REGEX REPLACE "_gz_.*" "" airframe_sys_autostart ${gz_airframe}) - - if(model STREQUAL ${airframe_model_only}) - set(gz_airframe_found ${gz_airframe}) - break() - endif() - endforeach() - - # Check if model is in no_airframe_models.txt These models don't require a corresponding airframe - file(READ no_airframe_models.txt models_raw) - string(REPLACE "\n" ";" models_no_airframe "${models_raw}") - list(FIND models_no_airframe ${model} no_airframe_found) - - if(gz_airframe_found OR no_airframe_found GREATER -1) - #message(STATUS "gz model: ${model} (${airframe_model_only}), airframe: ${gz_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}") - else() - message(WARNING "gz missing model: ${model} (${airframe_model_only}), airframe: ${gz_airframe_found}, SYS_AUTOSTART: ${airframe_sys_autostart}") - endif() foreach(world ${gz_worlds}) get_filename_component("world_name" ${world} NAME_WE) if(world_name STREQUAL "default") - add_custom_target(gz_${model} - COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} $ + add_custom_target(gz_${model_only} + COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model_only} $ WORKING_DIRECTORY ${SITL_WORKING_DIR} USES_TERMINAL DEPENDS px4 ) else() - add_custom_target(gz_${model}_${world_name} - COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} PX4_GZ_WORLD=${world_name} $ + add_custom_target(gz_${model_only}_${world_name} + COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model_only} PX4_GZ_WORLD=${world_name} $ WORKING_DIRECTORY ${SITL_WORKING_DIR} USES_TERMINAL DEPENDS px4 ) endif() endforeach() + endforeach() # PX4_GZ_MODELS, PX4_GZ_WORLDS, GZ_SIM_RESOURCE_PATH diff --git a/src/modules/simulation/gz_bridge/no_airframe_models.txt b/src/modules/simulation/gz_bridge/no_airframe_models.txt deleted file mode 100644 index 4c9c53eaed2a..000000000000 --- a/src/modules/simulation/gz_bridge/no_airframe_models.txt +++ /dev/null @@ -1,2 +0,0 @@ -x500_base -OakD-Lite