|
|
@ -2,8 +2,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
set -e |
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
if [ "$#" -lt 6 ]; then |
|
|
|
if [ "$#" -lt 7 ]; then |
|
|
|
echo usage: sitl_run.sh sitl_bin debugger program model src_path build_path |
|
|
|
echo usage: sitl_run.sh sitl_bin debugger program model world src_path build_path |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
@ -16,8 +16,9 @@ sitl_bin="$1" |
|
|
|
debugger="$2" |
|
|
|
debugger="$2" |
|
|
|
program="$3" |
|
|
|
program="$3" |
|
|
|
model="$4" |
|
|
|
model="$4" |
|
|
|
src_path="$5" |
|
|
|
world="$5" |
|
|
|
build_path="$6" |
|
|
|
src_path="$6" |
|
|
|
|
|
|
|
build_path="$7" |
|
|
|
# The rest of the arguments are files to copy into the working dir. |
|
|
|
# The rest of the arguments are files to copy into the working dir. |
|
|
|
|
|
|
|
|
|
|
|
echo SITL ARGS |
|
|
|
echo SITL ARGS |
|
|
@ -26,6 +27,7 @@ echo sitl_bin: $sitl_bin |
|
|
|
echo debugger: $debugger |
|
|
|
echo debugger: $debugger |
|
|
|
echo program: $program |
|
|
|
echo program: $program |
|
|
|
echo model: $model |
|
|
|
echo model: $model |
|
|
|
|
|
|
|
echo world: $world |
|
|
|
echo src_path: $src_path |
|
|
|
echo src_path: $src_path |
|
|
|
echo build_path: $build_path |
|
|
|
echo build_path: $build_path |
|
|
|
|
|
|
|
|
|
|
@ -64,7 +66,7 @@ fi |
|
|
|
cp "$src_path/Tools/posix_lldbinit" "$rootfs/.lldbinit" |
|
|
|
cp "$src_path/Tools/posix_lldbinit" "$rootfs/.lldbinit" |
|
|
|
cp "$src_path/Tools/posix.gdbinit" "$rootfs/.gdbinit" |
|
|
|
cp "$src_path/Tools/posix.gdbinit" "$rootfs/.gdbinit" |
|
|
|
|
|
|
|
|
|
|
|
shift 6 |
|
|
|
shift 7 |
|
|
|
for file in "$@"; do |
|
|
|
for file in "$@"; do |
|
|
|
cp "$file" $rootfs/ |
|
|
|
cp "$file" $rootfs/ |
|
|
|
done |
|
|
|
done |
|
|
@ -79,8 +81,31 @@ elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ]; then |
|
|
|
if [ -x "$(command -v gazebo)" ]; then |
|
|
|
if [ -x "$(command -v gazebo)" ]; then |
|
|
|
# Set the plugin path so Gazebo finds our model and sim |
|
|
|
# Set the plugin path so Gazebo finds our model and sim |
|
|
|
source "$src_path/Tools/setup_gazebo.bash" "${src_path}" "${build_path}" |
|
|
|
source "$src_path/Tools/setup_gazebo.bash" "${src_path}" "${build_path}" |
|
|
|
|
|
|
|
if [ -z $PX4_SITL_WORLD ]; then |
|
|
|
|
|
|
|
#Spawn predefined world |
|
|
|
|
|
|
|
if [ "$world" == "none" ]; then |
|
|
|
|
|
|
|
if [ -f ${src_path}/Tools/sitl_gazebo/worlds/${model}.world ]; then |
|
|
|
|
|
|
|
echo "empty world, default world ${model}.world for model found" |
|
|
|
gzserver "${src_path}/Tools/sitl_gazebo/worlds/${model}.world" & |
|
|
|
gzserver "${src_path}/Tools/sitl_gazebo/worlds/${model}.world" & |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "empty world, setting empty.world as default" |
|
|
|
|
|
|
|
gzserver "${src_path}/Tools/sitl_gazebo/worlds/empty.world" & |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
#Spawn empty world if world with model name doesn't exist |
|
|
|
|
|
|
|
gzserver "${src_path}/Tools/sitl_gazebo/worlds/${world}.world" & |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
if [ -f ${src_path}/Tools/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world ]; then |
|
|
|
|
|
|
|
# Spawn world by name if exists in the worlds directory from environment variable |
|
|
|
|
|
|
|
gzserver "${src_path}/Tools/sitl_gazebo/worlds/${PX4_SITL_WORLD}.world" & |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
# Spawn world from environment variable with absolute path |
|
|
|
|
|
|
|
gzserver "$PX4_SITL_WORLD" & |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
gz model --spawn-file="${src_path}/Tools/sitl_gazebo/models/${model}/${model}.sdf" --model-name=${model} -x 1.01 -y 0.98 -z 0.83 |
|
|
|
|
|
|
|
|
|
|
|
SIM_PID=`echo $!` |
|
|
|
SIM_PID=`echo $!` |
|
|
|
|
|
|
|
|
|
|
|
if [[ -n "$HEADLESS" ]]; then |
|
|
|
if [[ -n "$HEADLESS" ]]; then |
|
|
|