Spawn models separately from gazebo models

Detach model spawning process from the world description file, so that the same model can be used with different worlds
This commit is contained in:
JaeyoungLim
2020-03-16 22:41:51 +01:00
committed by Julian Oes
parent 8738c26426
commit 2ef37cd065
4 changed files with 99 additions and 30 deletions

View File

@@ -66,30 +66,34 @@ set(models none shell
standard_vtol tailsitter tiltrotor
rover boat
uuv_hippocampus)
set(worlds none empty warehouse)
set(all_posix_vmd_make_targets)
foreach(viewer ${viewers})
foreach(debugger ${debuggers})
foreach(model ${models})
if (debugger STREQUAL "none")
if (model STREQUAL "none")
set(_targ_name "${viewer}")
else()
set(_targ_name "${viewer}_${model}")
endif()
else()
if (model STREQUAL "none")
set(_targ_name "${viewer}___${debugger}")
else()
set(_targ_name "${viewer}_${model}_${debugger}")
endif()
endif()
foreach(world ${worlds})
if (world STREQUAL "none")
if (debugger STREQUAL "none")
if (model STREQUAL "none")
set(_targ_name "${viewer}")
else()
set(_targ_name "${viewer}_${model}")
endif()
else()
if (model STREQUAL "none")
set(_targ_name "${viewer}___${debugger}")
else()
set(_targ_name "${viewer}_${model}_${debugger}")
endif()
endif()
add_custom_target(${_targ_name}
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
$<TARGET_FILE:px4>
${debugger}
${viewer}
${model}
${world}
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
@@ -97,12 +101,47 @@ foreach(viewer ${viewers})
DEPENDS
logs_symlink
)
list(APPEND all_posix_vmd_make_targets ${_targ_name})
if (viewer STREQUAL "gazebo")
add_dependencies(${_targ_name} px4 sitl_gazebo)
elseif(viewer STREQUAL "jmavsim")
add_dependencies(${_targ_name} px4 git_jmavsim)
endif()
list(APPEND all_posix_vmd_make_targets ${_targ_name})
if (viewer STREQUAL "gazebo")
add_dependencies(${_targ_name} px4 sitl_gazebo)
elseif(viewer STREQUAL "jmavsim")
add_dependencies(${_targ_name} px4 git_jmavsim)
endif()
else()
if (viewer STREQUAL "gazebo")
if (debugger STREQUAL "none")
if (model STREQUAL "none")
set(_targ_name "${viewer}___${world}")
else()
set(_targ_name "${viewer}_${model}__${world}")
endif()
else()
if (model STREQUAL "none")
set(_targ_name "${viewer}__${debugger}_${world}")
else()
set(_targ_name "${viewer}_${model}_${debugger}_${world}")
endif()
endif()
add_custom_target(${_targ_name}
COMMAND ${PX4_SOURCE_DIR}/Tools/sitl_run.sh
$<TARGET_FILE:px4>
${debugger}
${viewer}
${model}
${world}
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS
logs_symlink
)
list(APPEND all_posix_vmd_make_targets ${_targ_name})
add_dependencies(${_targ_name} px4 sitl_gazebo)
endif()
endif()
endforeach()
endforeach()
endforeach()
endforeach()

View File

@@ -61,6 +61,7 @@ foreach(test_name ${tests})
none
none
test_${test_name}_generated
none
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})
@@ -79,6 +80,7 @@ add_test(NAME mavlink
none
none
test_mavlink
none
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})
@@ -96,6 +98,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
none
none
test_shutdown
none
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})
@@ -112,6 +115,7 @@ add_test(NAME dyn
none
none
test_dyn_hello
none
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
$<TARGET_FILE:examples__dyn_hello>
@@ -135,6 +139,7 @@ foreach(cmd_name ${test_cmds})
none
none
cmd_${cmd_name}_generated
none
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR})