SITL gz make airframes simulator specific
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name Gazebo x500 depth
|
||||
#
|
||||
# @type Quadrotor
|
||||
#
|
||||
|
||||
. ${R}etc/init.d/rc.mc_defaults
|
||||
|
||||
PX4_SIMULATOR=${PX4_SIMULATOR:=gz}
|
||||
PX4_GZ_WORLD=${PX4_GZ_WORLD:=default}
|
||||
PX4_SIM_MODEL=${PX4_SIM_MODEL:=x500_depth}
|
||||
|
||||
param set-default CA_AIRFRAME 0
|
||||
param set-default CA_ROTOR_COUNT 4
|
||||
|
||||
param set-default CA_ROTOR0_PX 0.13
|
||||
param set-default CA_ROTOR0_PY 0.22
|
||||
param set-default CA_ROTOR0_KM 0.05
|
||||
|
||||
param set-default CA_ROTOR1_PX -0.13
|
||||
param set-default CA_ROTOR1_PY -0.20
|
||||
param set-default CA_ROTOR1_KM 0.05
|
||||
|
||||
param set-default CA_ROTOR2_PX 0.13
|
||||
param set-default CA_ROTOR2_PY -0.22
|
||||
param set-default CA_ROTOR2_KM -0.05
|
||||
|
||||
param set-default CA_ROTOR3_PX -0.13
|
||||
param set-default CA_ROTOR3_PY 0.20
|
||||
param set-default CA_ROTOR3_KM -0.05
|
||||
|
||||
param set-default SIM_GZ_FUNC1 101
|
||||
param set-default SIM_GZ_FUNC2 102
|
||||
param set-default SIM_GZ_FUNC3 103
|
||||
param set-default SIM_GZ_FUNC4 104
|
||||
|
||||
param set-default SIM_GZ_MIN1 150
|
||||
param set-default SIM_GZ_MIN2 150
|
||||
param set-default SIM_GZ_MIN3 150
|
||||
param set-default SIM_GZ_MIN4 150
|
||||
|
||||
param set-default SIM_GZ_MAX1 1000
|
||||
param set-default SIM_GZ_MAX2 1000
|
||||
param set-default SIM_GZ_MAX3 1000
|
||||
param set-default SIM_GZ_MAX4 1000
|
||||
|
||||
param set-default MPC_THR_HOVER 0.60
|
||||
@@ -72,7 +72,8 @@ px4_add_romfs_files(
|
||||
3010_jsbsim_quadrotor_x
|
||||
3011_jsbsim_hexarotor_x
|
||||
|
||||
4001_x500
|
||||
4001_gz_x500
|
||||
4002_gz_x500_depth
|
||||
|
||||
2507_cloudship
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0"
|
||||
|
||||
elif [ "$PX4_SIMULATOR" = "gz" ]; then
|
||||
|
||||
# source generated gazebo_env.sh for IGN_GAZEBO_RESOURCE_PATH
|
||||
if [ -f ./gazebo_env.sh ]; then
|
||||
. ./gazebo_env.sh
|
||||
# source generated gz_env.sh for IGN_GAZEBO_RESOURCE_PATH
|
||||
if [ -f ./gz_env.sh ]; then
|
||||
. ./gz_env.sh
|
||||
|
||||
elif [ -f ../gazebo_env.sh ]; then
|
||||
. ../gazebo_env.sh
|
||||
elif [ -f ../gz_env.sh ]; then
|
||||
. ../gz_env.sh
|
||||
fi
|
||||
|
||||
# "gz sim" only avaiilable in Garden and later
|
||||
@@ -111,7 +111,7 @@ elif [ "$PX4_SIMULATOR" = "gz" ]; then
|
||||
|
||||
echo "WARN [init] PX4_GZ_MODEL_NAME or PX4_GZ_MODEL not set using PX4_SIM_MODEL."
|
||||
|
||||
if gz_bridge start -m "${PX4_SIM_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
|
||||
if gz_bridge start -m "${PX4_SIM_MODEL#*gz_}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
|
||||
sensor_baro_sim start
|
||||
sensor_gps_sim start
|
||||
sensor_mag_sim start
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<model>
|
||||
<name>x500-NoPlugin</name>
|
||||
<version>1.0</version>
|
||||
<sdf version="1.9">model.sdf</sdf>
|
||||
<author>
|
||||
<name>Benjamin Perseghetti</name>
|
||||
<email>bperseghetti@rudislabs.com</email>
|
||||
</author>
|
||||
<description>Model of the NXP HoverGames Drone development kit (KIT-HGDRONEK66). The PX4 software compatible kit provides mechanical, RC remote and other components needed to evaluate the RDDRONE-FMUK66 reference design. The FMU includes 100Base-T1 Automotive Ethernet, dual CAN transceivers, as well as SE050 secure element, and works with add on boards NavQPlus, MR-T1ETH8, MR-T1ADAPT, and CAN-nodes such as UCANS32K1SIC. Kit may be used with, and contains the components needed for the HoverGames.com coding challenges.</description>
|
||||
</model>
|
||||
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@@ -48,7 +48,7 @@ if(gz-transport_FOUND)
|
||||
|
||||
set(GZ_TRANSPORT_VER ${gz-transport_VERSION_MAJOR})
|
||||
|
||||
if (GZ_TRANSPORT_VER GREATER_EQUAL 12)
|
||||
if(GZ_TRANSPORT_VER GREATER_EQUAL 12)
|
||||
set(GZ_TRANSPORT_LIB gz-transport${GZ_TRANSPORT_VER}::core)
|
||||
else()
|
||||
set(GZ_TRANSPORT_LIB ignition-transport${GZ_TRANSPORT_VER}::core)
|
||||
@@ -82,21 +82,74 @@ if(gz-transport_FOUND)
|
||||
${PX4_SOURCE_DIR}/Tools/simulation/gz/worlds/*.sdf
|
||||
)
|
||||
|
||||
# find corresponding airframes
|
||||
file(GLOB gz_airframes
|
||||
RELATIVE ${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes
|
||||
${PX4_SOURCE_DIR}/ROMFS/px4fmu_common/init.d-posix/airframes/*_gz_*
|
||||
)
|
||||
|
||||
# remove any .post files
|
||||
foreach(gz_airframe IN LISTS gz_airframes)
|
||||
if(gz_airframe MATCHES ".post")
|
||||
list(REMOVE_ITEM gz_airframes ${gz_airframe})
|
||||
endif()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES gz_airframes)
|
||||
|
||||
foreach(gz_airframe IN LISTS gz_airframes)
|
||||
set(model_only)
|
||||
string(REGEX REPLACE ".*_gz_" "" model_only ${gz_airframe})
|
||||
|
||||
if(EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gz/models/${model_only}")
|
||||
|
||||
if((EXISTS "${PX4_SOURCE_DIR}/Tools/simulation/gz/models/${model_only}/model.sdf"))
|
||||
#message(STATUS "Ignition SDF file found for ${model_only}")
|
||||
else()
|
||||
message(WARNING "Ignition no SDF file found for ${model_only}")
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
if(gz_airframe_found)
|
||||
#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 MATCHES "default")
|
||||
if(world_name STREQUAL "default")
|
||||
add_custom_target(gz_${model}
|
||||
COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=${model} $<TARGET_FILE:px4>
|
||||
COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} $<TARGET_FILE:px4>
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||
USES_TERMINAL
|
||||
DEPENDS px4
|
||||
)
|
||||
else()
|
||||
add_custom_target(gz_${model}_${world_name}
|
||||
COMMAND ${CMAKE_COMMAND} -E env PX4_GZ_MODEL=${model} PX4_GZ_WORLD=${world_name} $<TARGET_FILE:px4>
|
||||
COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} PX4_SIM_WORLD=${world_name} $<TARGET_FILE:px4>
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||
USES_TERMINAL
|
||||
DEPENDS px4
|
||||
@@ -105,9 +158,7 @@ if(gz-transport_FOUND)
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
|
||||
# TODO: PX4_GZ_MODELS_PATH
|
||||
# PX4_GZ_WORLDS_PATH
|
||||
configure_file(gazebo_env.sh.in ${PX4_BINARY_DIR}/rootfs/gazebo_env.sh)
|
||||
# PX4_GZ_MODELS, PX4_GZ_WORLDS, GZ_SIM_RESOURCE_PATH
|
||||
configure_file(gz_env.sh.in ${PX4_BINARY_DIR}/rootfs/gz_env.sh)
|
||||
|
||||
endif()
|
||||
|
||||