diff --git a/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink b/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink
index 07cc78b4eb..15c6c2a793 100644
--- a/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink
+++ b/ROMFS/px4fmu_common/init.d-posix/px4-rc.mavlink
@@ -3,7 +3,7 @@
udp_offboard_port_local=$((14580+px4_instance))
udp_offboard_port_remote=$((14540+px4_instance))
-[ $px4_instance -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps
+[ "$px4_instance" -gt 9 ] && udp_offboard_port_remote=14549 # use the same ports for more than 10 instances to avoid port overlaps
udp_onboard_payload_port_local=$((14280+px4_instance))
udp_onboard_payload_port_remote=$((14030+px4_instance))
udp_onboard_gimbal_port_local=$((13030+px4_instance))
diff --git a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator
index 5493ed38d9..1d982860f2 100644
--- a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator
+++ b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator
@@ -13,108 +13,97 @@ if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0"
sensor_mag_sim start
else
- echo "ERROR [init] simulator_sih failed to start"
+ echo "ERROR [init] simulator_sih failed to start"
exit 1
fi
elif [ "$PX4_SIMULATOR" = "gz" ]; then
# source generated gazebo_env.sh for IGN_GAZEBO_RESOURCE_PATH
- if [ -f gazebo_env.sh ]; then
+ if [ -f ./gazebo_env.sh ]; then
. ./gazebo_env.sh
+
elif [ -f ../gazebo_env.sh ]; then
. ../gazebo_env.sh
fi
-# shellcheck disable=SC2236
- if [ ! -z $PX4_GZ_VERBOSE ]; then
- if [ "$PX4_GZ_VERBOSE" -le "4" ] && [ "$PX4_GZ_VERBOSE" -ge "1" ]; then
- gz_verbose=$PX4_GZ_VERBOSE
- else
- gz_verbose=4
- echo "WARN [init] PX4_GZ_VERBOSE was passed: $PX4_GZ_VERBOSE, not in range [1,4], defaulting to: $gz_verbose."
- fi
- echo "INFO [init] PX4_GZ_VERBOSE set to $gz_verbose."
- else
- gz_verbose=1
- echo "INFO [init] PX4_GZ_VERBOSE not explicitly set, defaulting to: $gz_verbose."
- fi
+ gz_command="ign" # "ign" before garden
+ gz_sub_command="gazebo" # "gazebo" before garden
- gz_world=$( ign topic -l | grep -m 1 -e "/world/.*/clock" | sed 's/\/world\///g; s/\/clock//g' )
-
- gz_version_major=$( ign gazebo --versions | sed 's/\..*//g' )
- gz_version_minor=$( ign gazebo --versions | sed 's/'"${gz_version_major}"\.'//; s/\..*//g' )
- gz_version_point=$( ign gazebo --versions | sed 's/'"${gz_version_major}"\.'//; s/'"${gz_version_minor}"\.'//')
+ # look for running ${gz_command} gazebo world
+ gz_world=$( ${gz_command} topic -l | grep -m 1 -e "/world/.*/clock" | sed 's/\/world\///g; s/\/clock//g' )
- if [ "$gz_version_major" -gt "6" ] || { [ "$gz_version_major" -eq "6" ] && [ "$gz_version_minor" -gt "12" ]; } || { [ "$gz_version_major" -eq "6" ] && [ "$gz_version_minor" -eq "12" ] && [ "$gz_version_point" -gt "0" ]; }; then
- echo "INFO [init] using latest version of MultiCopterMotor plugin."
- else
- echo "WARN [init] using older version of MultiCopterMotor plugin, please update to latest gazebo > 6.12.0."
- if [ "$PX4_SIM_MODEL" = "x500" ]; then
- PX4_SIM_MODEL="x500-Legacy"
- echo "WARN [init] setting PX4_SIM_MODEL -> $PX4_SIM_MODEL from x500 till gazebo > 6.12.0"
- fi
- fi
+ # shellcheck disable=SC2153
+ if [ -z "${gz_world}" ] && [ -n "${PX4_GZ_WORLDS}" ] && [ -n "${PX4_GZ_WORLD}" ]; then
- if [ -z $gz_world ]; then
+ echo "INFO [init] starting gazebo with world: ${PX4_GZ_WORLDS}/${PX4_GZ_WORLD}.sdf"
- # starting ign gazebo with ${PX4_GZ_WORLD} world
- echo "INFO [init] starting ign gazebo"
-# shellcheck disable=SC2153
- ign gazebo --verbose=$gz_verbose -r -s "${PX4_GZ_WORLDS}/${PX4_GZ_WORLD}.sdf" &
+ ${gz_command} ${gz_sub_command} --verbose=1 -r -s "${PX4_GZ_WORLDS}/${PX4_GZ_WORLD}.sdf" &
- if [ -z $HEADLESS ]; then
+ if [ -z "${HEADLESS}" ]; then
# HEADLESS not set, starting ign gazebo gui
- ign gazebo -g &
+ ${gz_command} gazebo -g &
fi
+
else
- echo "INFO [init] ign gazebo already running world: $gz_world"
- PX4_GZ_WORLD=$gz_world
+ echo "INFO [init] gazebo already running world: ${gz_world}"
+ PX4_GZ_WORLD=${gz_world}
fi
-# shellcheck disable=SC2236
- if [ ! -z $PX4_GZ_MODEL ] && [ -z $PX4_GZ_MODEL_NAME ]; then
+ # start gz_bridge
+ if [ -n "${PX4_GZ_MODEL}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ]; then
+ # model specified, gz_bridge will spawn model
-# shellcheck disable=SC2236
- if [ ! -z $PX4_GZ_MODEL_POSE ]; then
+ if [ -n "${PX4_GZ_MODEL_POSE}" ]; then
# Clean potential input line formatting.
- model_pose="$( echo ${PX4_GZ_MODEL_POSE} | sed -e 's/^[ \t]*//; s/[ \t]*$//; s/,/ /g; s/ / /g; s/ /,/g' )"
+ model_pose="$( echo "${PX4_GZ_MODEL_POSE}" | sed -e 's/^[ \t]*//; s/[ \t]*$//; s/,/ /g; s/ / /g; s/ /,/g' )"
echo "INFO [init] PX4_GZ_MODEL_POSE set, spawning at: ${model_pose}"
+
else
echo "WARN [init] PX4_GZ_MODEL_POSE not set, spawning at origin."
model_pose="0,0,0,0,0,0"
fi
+
# start gz bridge with pose arg.
- if gz_bridge start -p "${model_pose}" -m "${PX4_GZ_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
+ if gz_bridge start -p "${model_pose}" -m "${PX4_GZ_MODEL}" -w "${PX4_GZ_WORLD}" -i "${px4_instance}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
+
else
- echo "ERROR [init] ign gazebo failed to start"
+ echo "ERROR [init] gazebo failed to start"
exit 1
fi
- elif [ ! -z $PX4_GZ_MODEL_NAME ] && [ -z $PX4_GZ_MODEL ]; then
+
+ elif [ -n "${PX4_GZ_MODEL_NAME}" ] && [ -z "${PX4_GZ_MODEL}" ]; then
+ # model name specificed, gz_bridge will attach to existing model
+
if gz_bridge start -n "${PX4_GZ_MODEL_NAME}" -w "${PX4_GZ_WORLD}"; then
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
+
else
- echo "ERROR [init] ign gazebo failed to start"
+ echo "ERROR [init] gazebo failed to start"
exit 1
fi
- elif [ ! -z $PX4_SIM_MODEL ] && [ -z $PX4_GZ_MODEL_NAME ] && [ -z $PX4_GZ_MODEL ]; then
+
+ elif [ -n "${PX4_SIM_MODEL}" ] && [ -z "${PX4_GZ_MODEL_NAME}" ] && [ -z "${PX4_GZ_MODEL}" ]; 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
sensor_baro_sim start
sensor_gps_sim start
sensor_mag_sim start
+
else
- echo "ERROR [init] ign gazebo failed to start"
+ echo "ERROR [init] gazebo failed to start"
exit 1
fi
else
- echo "ERROR [init] failed to pass only PX4_GZ_MODEL_NAME or PX4_GZ_MODEL"
+ echo "ERROR [init] failed to pass only PX4_GZ_MODEL_NAME or PX4_GZ_MODEL"
exit 1
fi
@@ -131,13 +120,13 @@ else
echo "PX4 SIM HOST: localhost"
simulator_mavlink start -c $simulator_tcp_port
else
- echo "PX4 SIM HOST: $PX4_SIM_HOST_ADDR"
- simulator_mavlink start -t $PX4_SIM_HOST_ADDR $simulator_tcp_port
+ echo "PX4 SIM HOST: ${PX4_SIM_HOST_ADDR}"
+ simulator_mavlink start -t "${PX4_SIM_HOST_ADDR}" "${simulator_tcp_port}"
fi
else
- echo "PX4 SIM HOST: $PX4_SIM_HOSTNAME"
- simulator_mavlink start -h $PX4_SIM_HOSTNAME $simulator_tcp_port
+ echo "PX4 SIM HOST: ${PX4_SIM_HOSTNAME}"
+ simulator_mavlink start -h "${PX4_SIM_HOSTNAME}" "${simulator_tcp_port}"
fi
fi
diff --git a/Tools/simulation/gz/models/x500-Legacy/model.config b/Tools/simulation/gz/models/x500-Legacy/model.config
deleted file mode 100644
index 590e6e67d5..0000000000
--- a/Tools/simulation/gz/models/x500-Legacy/model.config
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- x500-Legacy
- 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-Legacy/model.sdf b/Tools/simulation/gz/models/x500-Legacy/model.sdf
deleted file mode 100644
index 2517124d01..0000000000
--- a/Tools/simulation/gz/models/x500-Legacy/model.sdf
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
- model://x500-NoPlugin
-
-
- /x500-Legacy_0
- rotor_0_joint
- rotor_0
- ccw
- 0.0125
- 0.025
- 1000.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 0
- 8.06428e-05
- 1e-06
- 10
- velocity
-
-
- /x500-Legacy_0
- rotor_1_joint
- rotor_1
- ccw
- 0.0125
- 0.025
- 1000.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 1
- 8.06428e-05
- 1e-06
- 10
- velocity
-
-
- /x500-Legacy_0
- rotor_2_joint
- rotor_2
- cw
- 0.0125
- 0.025
- 1000.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 2
- 8.06428e-05
- 1e-06
- 10
- velocity
-
-
- /x500-Legacy_0
- rotor_3_joint
- rotor_3
- cw
- 0.0125
- 0.025
- 1000.0
- 8.54858e-06
- 0.016
- command/motor_speed
- 3
- 8.06428e-05
- 1e-06
- 10
- velocity
-
-
-
\ No newline at end of file
diff --git a/Tools/simulation/gz/models/x500-Legacy/thumbnails/1.png b/Tools/simulation/gz/models/x500-Legacy/thumbnails/1.png
deleted file mode 100644
index 0ab16c68ce..0000000000
Binary files a/Tools/simulation/gz/models/x500-Legacy/thumbnails/1.png and /dev/null differ
diff --git a/Tools/simulation/gz/models/x500-Legacy/thumbnails/2.png b/Tools/simulation/gz/models/x500-Legacy/thumbnails/2.png
deleted file mode 100644
index 07edeb2033..0000000000
Binary files a/Tools/simulation/gz/models/x500-Legacy/thumbnails/2.png and /dev/null differ
diff --git a/Tools/simulation/gz/models/x500-Legacy/thumbnails/3.png b/Tools/simulation/gz/models/x500-Legacy/thumbnails/3.png
deleted file mode 100644
index 539da06919..0000000000
Binary files a/Tools/simulation/gz/models/x500-Legacy/thumbnails/3.png and /dev/null differ
diff --git a/Tools/simulation/gz/models/x500-Legacy/thumbnails/4.png b/Tools/simulation/gz/models/x500-Legacy/thumbnails/4.png
deleted file mode 100644
index dc38aa2fc8..0000000000
Binary files a/Tools/simulation/gz/models/x500-Legacy/thumbnails/4.png and /dev/null differ
diff --git a/Tools/simulation/gz/models/x500-Legacy/thumbnails/5.png b/Tools/simulation/gz/models/x500-Legacy/thumbnails/5.png
deleted file mode 100644
index 9e3401e305..0000000000
Binary files a/Tools/simulation/gz/models/x500-Legacy/thumbnails/5.png and /dev/null differ
diff --git a/platforms/posix/Debug/launch_sitl.json.in b/platforms/posix/Debug/launch_sitl.json.in
index f0261448da..ee86ffb77b 100644
--- a/platforms/posix/Debug/launch_sitl.json.in
+++ b/platforms/posix/Debug/launch_sitl.json.in
@@ -2,13 +2,12 @@
"version": "0.2.0",
"configurations": [
{
- "name": "SITL (GZ)",
+ "name": "SITL (gz)",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [
- "${workspaceFolder}/ROMFS/px4fmu_common",
- "-s", "etc/init.d-posix/rcS"
+ "${workspaceFolder}/ROMFS/px4fmu_common"
],
"stopAtEntry": false,
"cwd": "${command:cmake.buildDirectory}/rootfs",
diff --git a/src/modules/simulation/gz_bridge/CMakeLists.txt b/src/modules/simulation/gz_bridge/CMakeLists.txt
index b70ca93e20..4508c64ad8 100644
--- a/src/modules/simulation/gz_bridge/CMakeLists.txt
+++ b/src/modules/simulation/gz_bridge/CMakeLists.txt
@@ -31,21 +31,28 @@
#
############################################################################
-# Find the Ignition_Transport library
-find_package(ignition-transport
+# Find the gz_Transport library
+find_package(gz-transport
#REQUIRED COMPONENTS core
NAMES
ignition-transport8
ignition-transport10
ignition-transport11
+ gz-transport12
#QUIET
)
-if(ignition-transport_FOUND)
+if(gz-transport_FOUND)
add_compile_options(-frtti -fexceptions)
- set(IGN_TRANSPORT_VER ${ignition-transport_VERSION_MAJOR})
+ set(GZ_TRANSPORT_VER ${gz-transport_VERSION_MAJOR})
+
+ 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)
+ endif()
px4_add_module(
MODULE modules__simulation__gz_bridge
@@ -58,7 +65,7 @@ if(ignition-transport_FOUND)
DEPENDS
mixer_module
px4_work_queue
- ignition-transport${IGN_TRANSPORT_VER}::core
+ ${GZ_TRANSPORT_LIB}
MODULE_CONFIG
module.yaml
)
diff --git a/src/modules/simulation/gz_bridge/gazebo_env.sh.in b/src/modules/simulation/gz_bridge/gazebo_env.sh.in
index dbd008cba2..4241851087 100644
--- a/src/modules/simulation/gz_bridge/gazebo_env.sh.in
+++ b/src/modules/simulation/gz_bridge/gazebo_env.sh.in
@@ -4,3 +4,6 @@ export PX4_GZ_MODELS=@PX4_SOURCE_DIR@/Tools/simulation/gz/models
export PX4_GZ_WORLDS=@PX4_SOURCE_DIR@/Tools/simulation/gz/worlds
export IGN_GAZEBO_RESOURCE_PATH=$IGN_GAZEBO_RESOURCE_PATH:$PX4_GZ_MODELS:$PX4_GZ_WORLDS
+
+# IGN -> GZ as of Garden
+export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:$PX4_GZ_MODELS:$PX4_GZ_WORLDS