diff --git a/ROMFS/px4fmu_common/init.d-posix/airframes/4001_x500 b/ROMFS/px4fmu_common/init.d-posix/airframes/4001_gz_x500 similarity index 100% rename from ROMFS/px4fmu_common/init.d-posix/airframes/4001_x500 rename to ROMFS/px4fmu_common/init.d-posix/airframes/4001_gz_x500 diff --git a/ROMFS/px4fmu_common/init.d-posix/airframes/4002_gz_x500_depth b/ROMFS/px4fmu_common/init.d-posix/airframes/4002_gz_x500_depth new file mode 100644 index 0000000000..802ea75c44 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d-posix/airframes/4002_gz_x500_depth @@ -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 diff --git a/ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt b/ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt index 102780e874..9a5075103c 100644 --- a/ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt +++ b/ROMFS/px4fmu_common/init.d-posix/airframes/CMakeLists.txt @@ -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 diff --git a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator index 8716fd70df..dd55a1bd13 100644 --- a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator +++ b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator @@ -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 diff --git a/Tools/simulation/gz/models/x500-NoPlugin/model.config b/Tools/simulation/gz/models/x500-NoPlugin/model.config deleted file mode 100644 index 962c6c9cb4..0000000000 --- a/Tools/simulation/gz/models/x500-NoPlugin/model.config +++ /dev/null @@ -1,11 +0,0 @@ - - - x500-NoPlugin - 1.0 - model.sdf - - Benjamin Perseghetti - bperseghetti@rudislabs.com - - 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. - diff --git a/Tools/simulation/gz/models/x500-NoPlugin/model.sdf b/Tools/simulation/gz/models/x500-NoPlugin/model.sdf deleted file mode 100644 index d27daf63ac..0000000000 --- a/Tools/simulation/gz/models/x500-NoPlugin/model.sdf +++ /dev/null @@ -1,516 +0,0 @@ - - - - 0 0 .24 0 0 0 - false - false - - - 2.0 - - 0.02166666666666667 - 0 - 0 - 0.02166666666666667 - 0 - 0.04000000000000001 - - - true - - - 0 0 .025 0 0 3.141592654 - - - 1 1 1 - model://x500-NoPlugin/meshes/NXP-HGD-CF.dae - - - - - 0.174 0.174 .032 0 0 -.45 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Base.dae - - - - - -0.174 0.174 .032 0 0 -.45 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Base.dae - - - - - 0.174 -0.174 .032 0 0 -.45 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Base.dae - - - - - -0.174 -0.174 .032 0 0 -.45 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Base.dae - - - - - 0.047 .001 .043 1 0 1.57 - false - - - 0 0 1 - .013 .007 - - - - 1.0 1.0 1.0 - 1.0 1.0 1.0 - - - model://x500-NoPlugin/materials/textures/nxp.png - - - - - - -0.023 0 .0515 0 0 -1.57 - false - - - 0 0 1 - .013 .007 - - - - 1.0 1.0 1.0 - 1.0 1.0 1.0 - - - model://x500-NoPlugin/materials/textures/nxp.png - - - - - - -.03 0 .0515 0 0 -1.57 - false - - - 0 0 1 - .032 .0034 - - - - 1.0 1.0 1.0 - 1.0 1.0 1.0 - - - model://x500-NoPlugin/materials/textures/rd.png - - - - - - 0 0 .007 0 0 0 - - - 0.35355339059327373 0.35355339059327373 0.05 - - - - - - 0.001 - 0 - - - - - - - - - 0 -0.098 -.123 -0.35 0 0 - - - 0.015 0.015 0.21 - - - - - - 0.001 - 0 - - - - - - - - - 0 0.098 -.123 0.35 0 0 - - - 0.015 0.015 0.21 - - - - - - 0.001 - 0 - - - - - - - - - 0 -0.132 -.2195 0 0 0 - - - 0.25 0.015 0.015 - - - - - - 0.001 - 0 - - - - - - - - - 0 0.132 -.2195 0 0 0 - - - 0.25 0.015 0.015 - - - - - - 0.001 - 0 - - - - - - - - - 1 - 250 - - - - true - false - - 0.174 -0.174 0.06 0 0 0 - - 0.016076923076923075 - - 3.8464910483993325e-07 - 2.6115851691700804e-05 - 2.649858234714004e-05 - - - - -0.022 -0.14638461538461536 -0.016 0 0 0 - - - 0.8461538461538461 0.8461538461538461 0.8461538461538461 - model://x500-NoPlugin/meshes/1345_prop_ccw.stl - - - - - - - - 0 0 -.032 0 0 0 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Bell.dae - - - - - 0 0 0 0 0 0 - - - 0.2792307692307692 0.016923076923076923 0.0008461538461538462 - - - - - - 0.001 - 0 - - - - - - - - - - base_link - rotor_0 - - 0 0 1 - - -1e+16 - 1e+16 - - - 0 - 0 - - 1 - - - - true - false - - -0.174 0.174 0.06 0 0 0 - - 0.016076923076923075 - - 3.8464910483993325e-07 - 2.6115851691700804e-05 - 2.649858234714004e-05 - - - - -0.022 -0.14638461538461536 -0.016 0 0 0 - - - 0.8461538461538461 0.8461538461538461 0.8461538461538461 - model://x500-NoPlugin/meshes/1345_prop_ccw.stl - - - - - - - - 0 0 -.032 0 0 0 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Bell.dae - - - - - 0 0 0 0 0 0 - - - 0.2792307692307692 0.016923076923076923 0.0008461538461538462 - - - - - - 0.001 - 0 - - - - - - - - - - base_link - rotor_1 - - 0 0 1 - - -1e+16 - 1e+16 - - - 0 - 0 - - 1 - - - - true - false - - 0.174 0.174 0.06 0 0 0 - - 0.016076923076923075 - - 3.8464910483993325e-07 - 2.6115851691700804e-05 - 2.649858234714004e-05 - - - - -0.022 -0.14638461538461536 -0.016 0 0 0 - - - 0.8461538461538461 0.8461538461538461 0.8461538461538461 - model://x500-NoPlugin/meshes/1345_prop_cw.stl - - - - - - - - 0 0 -.032 0 0 0 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Bell.dae - - - - - 0 0 0 0 0 0 - - - 0.2792307692307692 0.016923076923076923 0.0008461538461538462 - - - - - - 0.001 - 0 - - - - - - - - - - base_link - rotor_2 - - 0 0 1 - - -1e+16 - 1e+16 - - - 0 - 0 - - 1 - - - - true - false - - -0.174 -0.174 0.06 0 0 0 - - 0.016076923076923075 - - 3.8464910483993325e-07 - 2.6115851691700804e-05 - 2.649858234714004e-05 - - - - -0.022 -0.14638461538461536 -0.016 0 0 0 - - - 0.8461538461538461 0.8461538461538461 0.8461538461538461 - model://x500-NoPlugin/meshes/1345_prop_cw.stl - - - - - - - - 0 0 -.032 0 0 0 - - - 1 1 1 - model://x500-NoPlugin/meshes/5010Bell.dae - - - - - 0 0 0 0 0 0 - - - 0.2792307692307692 0.016923076923076923 0.0008461538461538462 - - - - - - 0.001 - 0 - - - - - - - - - - base_link - rotor_3 - - 0 0 1 - - -1e+16 - 1e+16 - - - 0 - 0 - - 1 - - - - diff --git a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/1.png b/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/1.png deleted file mode 100644 index 0ab16c68ce..0000000000 Binary files a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/1.png and /dev/null differ diff --git a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/2.png b/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/2.png deleted file mode 100644 index 07edeb2033..0000000000 Binary files a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/2.png and /dev/null differ diff --git a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/3.png b/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/3.png deleted file mode 100644 index 539da06919..0000000000 Binary files a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/3.png and /dev/null differ diff --git a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/4.png b/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/4.png deleted file mode 100644 index dc38aa2fc8..0000000000 Binary files a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/4.png and /dev/null differ diff --git a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/5.png b/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/5.png deleted file mode 100644 index 9e3401e305..0000000000 Binary files a/Tools/simulation/gz/models/x500-NoPlugin/thumbnails/5.png and /dev/null differ diff --git a/Tools/simulation/gz/models/x500-NoPlugin/materials/textures/CF.png b/Tools/simulation/gz/models/x500/materials/textures/CF.png similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/materials/textures/CF.png rename to Tools/simulation/gz/models/x500/materials/textures/CF.png diff --git a/Tools/simulation/gz/models/x500-NoPlugin/materials/textures/nxp.png b/Tools/simulation/gz/models/x500/materials/textures/nxp.png similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/materials/textures/nxp.png rename to Tools/simulation/gz/models/x500/materials/textures/nxp.png diff --git a/Tools/simulation/gz/models/x500-NoPlugin/materials/textures/rd.png b/Tools/simulation/gz/models/x500/materials/textures/rd.png similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/materials/textures/rd.png rename to Tools/simulation/gz/models/x500/materials/textures/rd.png diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/1345_prop_ccw.stl b/Tools/simulation/gz/models/x500/meshes/1345_prop_ccw.stl similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/1345_prop_ccw.stl rename to Tools/simulation/gz/models/x500/meshes/1345_prop_ccw.stl diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/1345_prop_cw.stl b/Tools/simulation/gz/models/x500/meshes/1345_prop_cw.stl similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/1345_prop_cw.stl rename to Tools/simulation/gz/models/x500/meshes/1345_prop_cw.stl diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/5010Base.dae b/Tools/simulation/gz/models/x500/meshes/5010Base.dae similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/5010Base.dae rename to Tools/simulation/gz/models/x500/meshes/5010Base.dae diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/5010Bell.dae b/Tools/simulation/gz/models/x500/meshes/5010Bell.dae similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/5010Bell.dae rename to Tools/simulation/gz/models/x500/meshes/5010Bell.dae diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/CF.png b/Tools/simulation/gz/models/x500/meshes/CF.png similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/CF.png rename to Tools/simulation/gz/models/x500/meshes/CF.png diff --git a/Tools/simulation/gz/models/x500-NoPlugin/meshes/NXP-HGD-CF.dae b/Tools/simulation/gz/models/x500/meshes/NXP-HGD-CF.dae similarity index 100% rename from Tools/simulation/gz/models/x500-NoPlugin/meshes/NXP-HGD-CF.dae rename to Tools/simulation/gz/models/x500/meshes/NXP-HGD-CF.dae diff --git a/Tools/simulation/gz/models/x500/model.sdf b/Tools/simulation/gz/models/x500/model.sdf index c46de3d2d2..7dc600b8cb 100644 --- a/Tools/simulation/gz/models/x500/model.sdf +++ b/Tools/simulation/gz/models/x500/model.sdf @@ -1,10 +1,518 @@ - - model://x500-NoPlugin - - + 0 0 .24 0 0 0 + false + false + + + 2.0 + + 0.02166666666666667 + 0 + 0 + 0.02166666666666667 + 0 + 0.04000000000000001 + + + true + + + 0 0 .025 0 0 3.141592654 + + + 1 1 1 + model://x500/meshes/NXP-HGD-CF.dae + + + + + 0.174 0.174 .032 0 0 -.45 + + + 1 1 1 + model://x500/meshes/5010Base.dae + + + + + -0.174 0.174 .032 0 0 -.45 + + + 1 1 1 + model://x500/meshes/5010Base.dae + + + + + 0.174 -0.174 .032 0 0 -.45 + + + 1 1 1 + model://x500/meshes/5010Base.dae + + + + + -0.174 -0.174 .032 0 0 -.45 + + + 1 1 1 + model://x500/meshes/5010Base.dae + + + + + 0.047 .001 .043 1 0 1.57 + false + + + 0 0 1 + .013 .007 + + + + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + model://x500/materials/textures/nxp.png + + + + + + -0.023 0 .0515 0 0 -1.57 + false + + + 0 0 1 + .013 .007 + + + + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + model://x500/materials/textures/nxp.png + + + + + + -.03 0 .0515 0 0 -1.57 + false + + + 0 0 1 + .032 .0034 + + + + 1.0 1.0 1.0 + 1.0 1.0 1.0 + + + model://x500/materials/textures/rd.png + + + + + + 0 0 .007 0 0 0 + + + 0.35355339059327373 0.35355339059327373 0.05 + + + + + + 0.001 + 0 + + + + + + + + + 0 -0.098 -.123 -0.35 0 0 + + + 0.015 0.015 0.21 + + + + + + 0.001 + 0 + + + + + + + + + 0 0.098 -.123 0.35 0 0 + + + 0.015 0.015 0.21 + + + + + + 0.001 + 0 + + + + + + + + + 0 -0.132 -.2195 0 0 0 + + + 0.25 0.015 0.015 + + + + + + 0.001 + 0 + + + + + + + + + 0 0.132 -.2195 0 0 0 + + + 0.25 0.015 0.015 + + + + + + 0.001 + 0 + + + + + + + + + 1 + 250 + + + + true + false + + 0.174 -0.174 0.06 0 0 0 + + 0.016076923076923075 + + 3.8464910483993325e-07 + 2.6115851691700804e-05 + 2.649858234714004e-05 + + + + -0.022 -0.14638461538461536 -0.016 0 0 0 + + + 0.8461538461538461 0.8461538461538461 0.8461538461538461 + model://x500/meshes/1345_prop_ccw.stl + + + + + + + + 0 0 -.032 0 0 0 + + + 1 1 1 + model://x500/meshes/5010Bell.dae + + + + + 0 0 0 0 0 0 + + + 0.2792307692307692 0.016923076923076923 0.0008461538461538462 + + + + + + 0.001 + 0 + + + + + + + + + + base_link + rotor_0 + + 0 0 1 + + -1e+16 + 1e+16 + + + 0 + 0 + + 1 + + + + true + false + + -0.174 0.174 0.06 0 0 0 + + 0.016076923076923075 + + 3.8464910483993325e-07 + 2.6115851691700804e-05 + 2.649858234714004e-05 + + + + -0.022 -0.14638461538461536 -0.016 0 0 0 + + + 0.8461538461538461 0.8461538461538461 0.8461538461538461 + model://x500/meshes/1345_prop_ccw.stl + + + + + + + + 0 0 -.032 0 0 0 + + + 1 1 1 + model://x500/meshes/5010Bell.dae + + + + + 0 0 0 0 0 0 + + + 0.2792307692307692 0.016923076923076923 0.0008461538461538462 + + + + + + 0.001 + 0 + + + + + + + + + + base_link + rotor_1 + + 0 0 1 + + -1e+16 + 1e+16 + + + 0 + 0 + + 1 + + + + true + false + + 0.174 0.174 0.06 0 0 0 + + 0.016076923076923075 + + 3.8464910483993325e-07 + 2.6115851691700804e-05 + 2.649858234714004e-05 + + + + -0.022 -0.14638461538461536 -0.016 0 0 0 + + + 0.8461538461538461 0.8461538461538461 0.8461538461538461 + model://x500/meshes/1345_prop_cw.stl + + + + + + + + 0 0 -.032 0 0 0 + + + 1 1 1 + model://x500/meshes/5010Bell.dae + + + + + 0 0 0 0 0 0 + + + 0.2792307692307692 0.016923076923076923 0.0008461538461538462 + + + + + + 0.001 + 0 + + + + + + + + + + base_link + rotor_2 + + 0 0 1 + + -1e+16 + 1e+16 + + + 0 + 0 + + 1 + + + + true + false + + -0.174 -0.174 0.06 0 0 0 + + 0.016076923076923075 + + 3.8464910483993325e-07 + 2.6115851691700804e-05 + 2.649858234714004e-05 + + + + -0.022 -0.14638461538461536 -0.016 0 0 0 + + + 0.8461538461538461 0.8461538461538461 0.8461538461538461 + model://x500/meshes/1345_prop_cw.stl + + + + + + + + 0 0 -.032 0 0 0 + + + 1 1 1 + model://x500/meshes/5010Bell.dae + + + + + 0 0 0 0 0 0 + + + 0.2792307692307692 0.016923076923076923 0.0008461538461538462 + + + + + + 0.001 + 0 + + + + + + + + + + base_link + rotor_3 + + 0 0 1 + + -1e+16 + 1e+16 + + + 0 + 0 + + 1 + + + rotor_0_joint rotor_0 ccw diff --git a/Tools/simulation/gz/models/x500-Depth/model.config b/Tools/simulation/gz/models/x500_depth/model.config similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/model.config rename to Tools/simulation/gz/models/x500_depth/model.config diff --git a/Tools/simulation/gz/models/x500-Depth/model.sdf b/Tools/simulation/gz/models/x500_depth/model.sdf similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/model.sdf rename to Tools/simulation/gz/models/x500_depth/model.sdf diff --git a/Tools/simulation/gz/models/x500-Depth/thumbnails/1.png b/Tools/simulation/gz/models/x500_depth/thumbnails/1.png similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/thumbnails/1.png rename to Tools/simulation/gz/models/x500_depth/thumbnails/1.png diff --git a/Tools/simulation/gz/models/x500-Depth/thumbnails/2.png b/Tools/simulation/gz/models/x500_depth/thumbnails/2.png similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/thumbnails/2.png rename to Tools/simulation/gz/models/x500_depth/thumbnails/2.png diff --git a/Tools/simulation/gz/models/x500-Depth/thumbnails/3.png b/Tools/simulation/gz/models/x500_depth/thumbnails/3.png similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/thumbnails/3.png rename to Tools/simulation/gz/models/x500_depth/thumbnails/3.png diff --git a/Tools/simulation/gz/models/x500-Depth/thumbnails/4.png b/Tools/simulation/gz/models/x500_depth/thumbnails/4.png similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/thumbnails/4.png rename to Tools/simulation/gz/models/x500_depth/thumbnails/4.png diff --git a/Tools/simulation/gz/models/x500-Depth/thumbnails/5.png b/Tools/simulation/gz/models/x500_depth/thumbnails/5.png similarity index 100% rename from Tools/simulation/gz/models/x500-Depth/thumbnails/5.png rename to Tools/simulation/gz/models/x500_depth/thumbnails/5.png diff --git a/src/modules/simulation/gz_bridge/CMakeLists.txt b/src/modules/simulation/gz_bridge/CMakeLists.txt index 4508c64ad8..2c6272bda1 100644 --- a/src/modules/simulation/gz_bridge/CMakeLists.txt +++ b/src/modules/simulation/gz_bridge/CMakeLists.txt @@ -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} $ + COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} $ 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} $ + COMMAND ${CMAKE_COMMAND} -E env PX4_SIM_MODEL=gz_${model} PX4_SIM_WORLD=${world_name} $ 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() diff --git a/src/modules/simulation/gz_bridge/gazebo_env.sh.in b/src/modules/simulation/gz_bridge/gz_env.sh.in similarity index 100% rename from src/modules/simulation/gz_bridge/gazebo_env.sh.in rename to src/modules/simulation/gz_bridge/gz_env.sh.in