mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 04:53:34 +08:00
Update px4-rc.gzsim. Fix gz_world checking for PX4_GZ_STANDALONE=1 mode. Priority of gz_world (really running) over PX4_GZ_WORLD (#25346)
This commit is contained in:
@@ -28,11 +28,15 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Look for an already running world
|
||||||
|
get_gz_world() {
|
||||||
|
gz_world=$( ${gz_command} topic -l | grep -m 1 -e "^/world/.*/clock" | sed 's/\/world\///g; s/\/clock//g' )
|
||||||
|
}
|
||||||
|
|
||||||
# If not standalone
|
# If not standalone
|
||||||
if [ -z "${PX4_GZ_STANDALONE}" ]; then
|
if [ -z "${PX4_GZ_STANDALONE}" ]; then
|
||||||
|
|
||||||
# Look for an already running world
|
get_gz_world
|
||||||
gz_world=$( ${gz_command} topic -l | grep -m 1 -e "^/world/.*/clock" | sed 's/\/world\///g; s/\/clock//g' )
|
|
||||||
|
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
if [ -z "${gz_world}" ] && [ -n "${PX4_GZ_WORLD}" ]; then
|
if [ -z "${gz_world}" ] && [ -n "${PX4_GZ_WORLD}" ]; then
|
||||||
@@ -66,6 +70,13 @@ fi
|
|||||||
|
|
||||||
# Wait for Gazebo world to be ready before proceeding
|
# Wait for Gazebo world to be ready before proceeding
|
||||||
check_scene_info() {
|
check_scene_info() {
|
||||||
|
|
||||||
|
get_gz_world
|
||||||
|
|
||||||
|
if [ -n "${PX4_GZ_STANDALONE}" ] && [ -n "${gz_world}" ]; then
|
||||||
|
PX4_GZ_WORLD=${gz_world}
|
||||||
|
fi
|
||||||
|
|
||||||
SERVICE_INFO=$(${gz_command} service -i --service "/world/${PX4_GZ_WORLD}/scene/info" 2>&1)
|
SERVICE_INFO=$(${gz_command} service -i --service "/world/${PX4_GZ_WORLD}/scene/info" 2>&1)
|
||||||
if echo "$SERVICE_INFO" | grep -q "Service providers"; then
|
if echo "$SERVICE_INFO" | grep -q "Service providers"; then
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user