From 29f352d49d53284b741e19e8b7056a1d1341c507 Mon Sep 17 00:00:00 2001 From: Dusan Zivkovic Date: Mon, 7 Aug 2023 09:18:51 +0000 Subject: [PATCH] px4-rc.simulator: set Gazebo coordinate frame reference (SIM_GZ_HOME_* params) from PX4_HOME_* env variables --- ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator index 01216f7910..b0025563df 100644 --- a/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator +++ b/ROMFS/px4fmu_common/init.d-posix/px4-rc.simulator @@ -38,6 +38,19 @@ if [ "$PX4_SIMULATOR" = "sihsim" ] || [ "$(param show -q SYS_AUTOSTART)" -eq "0" elif [ "$PX4_SIMULATOR" = "gz" ] || [ "$(param show -q SIM_GZ_EN)" -eq "1" ]; then + # set local coordinate frame reference + if [ -n "${PX4_HOME_LAT}" ]; then + param set SIM_GZ_HOME_LAT ${PX4_HOME_LAT} + fi + + if [ -n "${PX4_HOME_LON}" ]; then + param set SIM_GZ_HOME_LON ${PX4_HOME_LON} + fi + + if [ -n "${PX4_HOME_ALT}" ]; then + param set SIM_GZ_HOME_ALT ${PX4_HOME_LON} + fi + # source generated gz_env.sh for GZ_SIM_RESOURCE_PATH if [ -f ./gz_env.sh ]; then . ./gz_env.sh